bitsnap-react 1.18.0 → 1.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +106 -0
- package/README.md +98 -0
- package/dist/BitsnapCart-E72W5RRZ.mjs +2 -0
- package/dist/BitsnapCart-LHJ6KOTV.css +2 -0
- package/dist/BitsnapCart-LHJ6KOTV.css.map +1 -0
- package/dist/BitsnapCart-Q2HER6GU.js +2 -0
- package/dist/BitsnapCart-Q2HER6GU.js.map +1 -0
- package/dist/CartProvider-677CE2FI.js +2 -0
- package/dist/CartProvider-677CE2FI.js.map +1 -0
- package/dist/CartProvider-YPDOFSYC.mjs +2 -0
- package/dist/{PanelModelFiles-JZFSF7BF.mjs → PanelModelFiles-4B2HYGIE.mjs} +2 -2
- package/dist/{PanelModelFiles-7HPXWONN.js → PanelModelFiles-EKQRLF46.js} +2 -2
- package/dist/PanelModelFiles-EKQRLF46.js.map +1 -0
- package/dist/analytics.js +1 -1
- package/dist/analytics.js.map +1 -1
- package/dist/analytics.mjs +1 -1
- package/dist/catalog.js +1 -1
- package/dist/catalog.js.map +1 -1
- package/dist/catalog.mjs +1 -1
- package/dist/chat.css +2 -0
- package/dist/chat.css.map +1 -0
- package/dist/chat.d.mts +172 -0
- package/dist/chat.d.ts +172 -0
- package/dist/chat.js +2 -0
- package/dist/chat.js.map +1 -0
- package/dist/chat.mjs +2 -0
- package/dist/chat.mjs.map +1 -0
- package/dist/chunk-2FD2QP4Y.js +2 -0
- package/dist/chunk-2FD2QP4Y.js.map +1 -0
- package/dist/chunk-5JRUPLXY.mjs +2 -0
- package/dist/chunk-5JRUPLXY.mjs.map +1 -0
- package/dist/chunk-5M6M7FAR.mjs +2 -0
- package/dist/chunk-5M6M7FAR.mjs.map +1 -0
- package/dist/chunk-6Q3VGPSF.js.map +1 -1
- package/dist/chunk-AAC576BC.mjs +5 -0
- package/dist/chunk-AAC576BC.mjs.map +1 -0
- package/dist/{chunk-4OVOKGGS.mjs → chunk-AB37DWOK.mjs} +2 -2
- package/dist/{chunk-ZATPBYOA.js → chunk-BUYTK7KM.js} +2 -2
- package/dist/chunk-BUYTK7KM.js.map +1 -0
- package/dist/{chunk-DP2NOHCI.js → chunk-D2ASWUXM.js} +2 -2
- package/dist/chunk-D2ASWUXM.js.map +1 -0
- package/dist/chunk-DDIEFKNP.mjs +2 -0
- package/dist/{chunk-ZHTMK5TA.mjs.map → chunk-DDIEFKNP.mjs.map} +1 -1
- package/dist/{chunk-4HGZZJEL.js → chunk-DOJICJCQ.js} +2 -2
- package/dist/chunk-DOJICJCQ.js.map +1 -0
- package/dist/chunk-EMR4YXNY.mjs +2 -0
- package/dist/chunk-EMR4YXNY.mjs.map +1 -0
- package/dist/{chunk-JA62KNAQ.js → chunk-GJOGATP6.js} +2 -2
- package/dist/chunk-GJOGATP6.js.map +1 -0
- package/dist/chunk-GQ5OKU74.js +2 -0
- package/dist/chunk-GQ5OKU74.js.map +1 -0
- package/dist/chunk-JSDGZ4NY.js.map +1 -1
- package/dist/chunk-KHQEDQYF.js +5 -0
- package/dist/chunk-KHQEDQYF.js.map +1 -0
- package/dist/chunk-KOYBZORL.js.map +1 -1
- package/dist/chunk-LGPNJ5XE.js +2 -0
- package/dist/chunk-LGPNJ5XE.js.map +1 -0
- package/dist/chunk-MDAFPGPA.js +2 -0
- package/dist/chunk-MDAFPGPA.js.map +1 -0
- package/dist/{chunk-JHJ3ZZF4.mjs → chunk-MMLBQHBM.mjs} +2 -2
- package/dist/chunk-MWWEPEU2.js +2 -0
- package/dist/chunk-MWWEPEU2.js.map +1 -0
- package/dist/{chunk-GEBRXFT3.mjs → chunk-N523LFAM.mjs} +2 -2
- package/dist/chunk-NWXZ45TV.js +2 -0
- package/dist/chunk-NWXZ45TV.js.map +1 -0
- package/dist/chunk-OFPRIENJ.mjs +2 -0
- package/dist/chunk-OFPRIENJ.mjs.map +1 -0
- package/dist/chunk-OR566YJI.mjs +2 -0
- package/dist/chunk-OR566YJI.mjs.map +1 -0
- package/dist/chunk-Q337IQNA.js +2 -0
- package/dist/chunk-Q337IQNA.js.map +1 -0
- package/dist/chunk-SCEWYZUZ.mjs +2 -0
- package/dist/chunk-SCEWYZUZ.mjs.map +1 -0
- package/dist/{chunk-CF45RDMD.mjs → chunk-SSSF64M7.mjs} +2 -2
- package/dist/{chunk-CF45RDMD.mjs.map → chunk-SSSF64M7.mjs.map} +1 -1
- package/dist/chunk-W3RGQYPD.js.map +1 -1
- package/dist/chunk-WG54EHST.mjs +2 -0
- package/dist/chunk-WG54EHST.mjs.map +1 -0
- package/dist/chunk-XEXPQFKN.mjs +2 -0
- package/dist/chunk-XEXPQFKN.mjs.map +1 -0
- package/dist/chunk-YV2C276H.js +2 -0
- package/dist/chunk-YV2C276H.js.map +1 -0
- package/dist/consent.js.map +1 -1
- package/dist/course.d.mts +2 -14
- package/dist/course.d.ts +2 -14
- package/dist/course.js +1 -1
- package/dist/course.js.map +1 -1
- package/dist/course.mjs +1 -1
- package/dist/course.mjs.map +1 -1
- package/dist/embed/analytics.js +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +288 -4
- package/dist/index.d.ts +288 -4
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/internal.js.map +1 -1
- package/dist/methods-64D5DD6K.js +2 -0
- package/dist/methods-64D5DD6K.js.map +1 -0
- package/dist/methods-NQA3DFLE.mjs +2 -0
- package/dist/methods-NQA3DFLE.mjs.map +1 -0
- package/dist/model-files-client-P4PORZJ6.js.map +1 -1
- package/dist/models.js.map +1 -1
- package/dist/returns.js +1 -1
- package/dist/returns.js.map +1 -1
- package/dist/returns.mjs +1 -1
- package/dist/texts-9kfgClsA.d.mts +14 -0
- package/dist/texts-9kfgClsA.d.ts +14 -0
- package/dist/{types-D6LsoycW.d.mts → types-B-sjyZQs.d.mts} +7 -1
- package/dist/{types-ClFCVzk_.d.ts → types-iRe6ix2y.d.ts} +7 -1
- package/dist/viewer3d.js.map +1 -1
- package/dist/viewer3d.mjs +1 -1
- package/dist/viewer3d.mjs.map +1 -1
- package/dist/widgets-BT2LN2Nq.d.mts +547 -0
- package/dist/widgets-BVOSj9fU.d.ts +547 -0
- package/package.json +18 -3
- package/dist/CartProvider-OEI526IN.js +0 -2
- package/dist/CartProvider-OEI526IN.js.map +0 -1
- package/dist/CartProvider-RYAA3JDA.mjs +0 -2
- package/dist/PanelModelFiles-7HPXWONN.js.map +0 -1
- package/dist/chunk-4HGZZJEL.js.map +0 -1
- package/dist/chunk-5X7TP3TQ.mjs +0 -2
- package/dist/chunk-5X7TP3TQ.mjs.map +0 -1
- package/dist/chunk-7RXW6XFY.js +0 -2
- package/dist/chunk-7RXW6XFY.js.map +0 -1
- package/dist/chunk-DP2NOHCI.js.map +0 -1
- package/dist/chunk-EVIDNS22.mjs +0 -2
- package/dist/chunk-EVIDNS22.mjs.map +0 -1
- package/dist/chunk-G4V2KWTV.js +0 -2
- package/dist/chunk-G4V2KWTV.js.map +0 -1
- package/dist/chunk-GWF3MRUP.js +0 -2
- package/dist/chunk-GWF3MRUP.js.map +0 -1
- package/dist/chunk-JA62KNAQ.js.map +0 -1
- package/dist/chunk-UPAOIY4R.mjs +0 -2
- package/dist/chunk-UPAOIY4R.mjs.map +0 -1
- package/dist/chunk-V5ECGBFW.js +0 -5
- package/dist/chunk-V5ECGBFW.js.map +0 -1
- package/dist/chunk-VNV5BD4X.js +0 -2
- package/dist/chunk-VNV5BD4X.js.map +0 -1
- package/dist/chunk-VNYHJT6V.mjs +0 -2
- package/dist/chunk-VNYHJT6V.mjs.map +0 -1
- package/dist/chunk-WJO5GSY3.mjs +0 -5
- package/dist/chunk-WJO5GSY3.mjs.map +0 -1
- package/dist/chunk-ZATPBYOA.js.map +0 -1
- package/dist/chunk-ZHTMK5TA.mjs +0 -2
- package/dist/methods-AULQDKVS.mjs +0 -2
- package/dist/methods-PMH5VQ25.js +0 -2
- package/dist/methods-PMH5VQ25.js.map +0 -1
- /package/dist/{CartProvider-RYAA3JDA.mjs.map → BitsnapCart-E72W5RRZ.mjs.map} +0 -0
- /package/dist/{methods-AULQDKVS.mjs.map → CartProvider-YPDOFSYC.mjs.map} +0 -0
- /package/dist/{PanelModelFiles-JZFSF7BF.mjs.map → PanelModelFiles-4B2HYGIE.mjs.map} +0 -0
- /package/dist/{chunk-4OVOKGGS.mjs.map → chunk-AB37DWOK.mjs.map} +0 -0
- /package/dist/{chunk-JHJ3ZZF4.mjs.map → chunk-MMLBQHBM.mjs.map} +0 -0
- /package/dist/{chunk-GEBRXFT3.mjs.map → chunk-N523LFAM.mjs.map} +0 -0
package/dist/index.d.mts
CHANGED
|
@@ -4,13 +4,16 @@ 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
|
-
import { P as PanelLoginProps, a as PanelProps, G as GetThemeOutput } from './types-
|
|
10
|
-
export { b as PanelScreen, c as PanelSearchParamsType } from './types-
|
|
9
|
+
import { P as PanelLoginProps, a as PanelProps, G as GetThemeOutput } from './types-B-sjyZQs.mjs';
|
|
10
|
+
export { b as PanelScreen, c as PanelSearchParamsType } from './types-B-sjyZQs.mjs';
|
|
11
|
+
import { e as ChatThreadProps, c as ChannelProps } from './widgets-BT2LN2Nq.mjs';
|
|
12
|
+
export { d as ChatBuyRequest, C as ChatTexts, f as ChatWidgetBaseProps } from './widgets-BT2LN2Nq.mjs';
|
|
11
13
|
import './models.mjs';
|
|
12
14
|
import '@bufbuild/protobuf/wkt';
|
|
13
15
|
import '@bufbuild/protobuf';
|
|
16
|
+
import './texts-9kfgClsA.mjs';
|
|
14
17
|
|
|
15
18
|
type AppleButtonType = "plain" | "add-money" | "book" | "buy" | "check-out" | "continue" | "contribute" | "donate" | "order" | "pay" | "reload" | "rent" | "set-up" | "subscribe" | "support" | "tip" | "top-up";
|
|
16
19
|
type ColorType = "black" | "white" | "white-outline";
|
|
@@ -207,6 +210,26 @@ type CheckoutTexts = {
|
|
|
207
210
|
paymentMethodCodDescription: string;
|
|
208
211
|
/** Error shown when the shop refused cash on delivery for the order. */
|
|
209
212
|
paymentMethodCodUnavailable: string;
|
|
213
|
+
/** Status while the provider confirms a payment started from an express button. */
|
|
214
|
+
expressPending: string;
|
|
215
|
+
/** Status after the provider confirmed the payment. */
|
|
216
|
+
expressConfirmed: string;
|
|
217
|
+
/** Status when the provider reports a failed payment. */
|
|
218
|
+
expressFailed: string;
|
|
219
|
+
/** Status when the buyer cancelled the provider's payment flow. */
|
|
220
|
+
expressCancelled: string;
|
|
221
|
+
/** Shown while the payment is still unconfirmed after a page return. */
|
|
222
|
+
expressPendingLong: string;
|
|
223
|
+
/** Error shown when the provider's button could not be loaded. */
|
|
224
|
+
expressLoadFailed: string;
|
|
225
|
+
/** Error shown when the cart cannot be paid with this provider right now. */
|
|
226
|
+
expressCartUnavailable: string;
|
|
227
|
+
/** Error shown when another tab/provider changed the same cart line. */
|
|
228
|
+
expressCartConflict: string;
|
|
229
|
+
/** Shown when the server total changed between mounting and paying. */
|
|
230
|
+
expressPriceChanged: string;
|
|
231
|
+
/** Error shown when a product could not be added before the InPost binding. */
|
|
232
|
+
expressProductUnavailable: string;
|
|
210
233
|
};
|
|
211
234
|
|
|
212
235
|
type BitsnapCartProps = {
|
|
@@ -265,6 +288,256 @@ type Props$2 = {
|
|
|
265
288
|
};
|
|
266
289
|
declare function Wrapper$1(props: Props$2): react_jsx_runtime.JSX.Element;
|
|
267
290
|
|
|
291
|
+
type CartEnvironment = "test" | "production";
|
|
292
|
+
type CartSnapshotLine = {
|
|
293
|
+
lineId: string;
|
|
294
|
+
/** The id the cart was uploaded with; the same id `/buy` takes. */
|
|
295
|
+
productId: string;
|
|
296
|
+
variantId: string;
|
|
297
|
+
quantity: number;
|
|
298
|
+
name: string;
|
|
299
|
+
imageUrl?: string;
|
|
300
|
+
unitPriceMinor: number;
|
|
301
|
+
lineTotalMinor: number;
|
|
302
|
+
tax?: number;
|
|
303
|
+
currency: string;
|
|
304
|
+
};
|
|
305
|
+
type CartSnapshot = {
|
|
306
|
+
cartId: string;
|
|
307
|
+
revision: number;
|
|
308
|
+
status: "open" | "bound" | "checkout" | "ordered" | "expired";
|
|
309
|
+
environment: CartEnvironment;
|
|
310
|
+
currency: string;
|
|
311
|
+
locale: string;
|
|
312
|
+
lines: CartSnapshotLine[];
|
|
313
|
+
subtotalMinor: number;
|
|
314
|
+
deliveryMinor: number;
|
|
315
|
+
discountMinor: number;
|
|
316
|
+
totalMinor: number;
|
|
317
|
+
couponCode?: string;
|
|
318
|
+
expiresAt: number;
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
type FetchLike = (input: string, init?: RequestInit) => Promise<Response>;
|
|
322
|
+
|
|
323
|
+
/** Official `binding_place` values this SDK exposes. */
|
|
324
|
+
declare const INPOST_BINDING_PLACES: readonly ["PRODUCT_CARD", "BASKET_SUMMARY", "MINICART_PAGE", "CHECKOUT_PAGE", "ORDER_CREATE", "THANK_YOU_PAGE"];
|
|
325
|
+
type InPostBindingPlace = (typeof INPOST_BINDING_PLACES)[number];
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* React glue between the express client and the buttons. Everything is
|
|
329
|
+
* browser-only: nothing is requested while rendering on the server, and no
|
|
330
|
+
* state is shared between two projects or two hosts.
|
|
331
|
+
*/
|
|
332
|
+
type ExpressItem = {
|
|
333
|
+
id: string;
|
|
334
|
+
quantity: number;
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* InPost Pay on a product page or in a cart.
|
|
339
|
+
*
|
|
340
|
+
* The button is the official InPost Pay widget: this component renders its
|
|
341
|
+
* documented `<inpost-izi-button>` element, loads the widget lazily in the
|
|
342
|
+
* browser and gives it the documented callbacks. The basket itself is durable
|
|
343
|
+
* on Bitsnap: the first click uploads the cart, binds it through the InPost
|
|
344
|
+
* merchant API (server side) and returns only the basket key the widget needs.
|
|
345
|
+
*
|
|
346
|
+
* Nothing renders unless the backend says the provider is available with a
|
|
347
|
+
* public `merchantClientId`; a 501, an old backend or a missing credential
|
|
348
|
+
* shows no button at all.
|
|
349
|
+
*/
|
|
350
|
+
type InPostPayButtonProps = {
|
|
351
|
+
/**
|
|
352
|
+
* The Bitsnap project of the cart. Optional when the page already called
|
|
353
|
+
* `setProjectID(projectID)`; given here it is configured for the page.
|
|
354
|
+
*/
|
|
355
|
+
projectID?: string;
|
|
356
|
+
/** Bitsnap host; defaults to the configured one. */
|
|
357
|
+
host?: string;
|
|
358
|
+
locale?: string;
|
|
359
|
+
/** Text overrides, as on `BitsnapCheckout`. */
|
|
360
|
+
texts?: Partial<CheckoutTexts>;
|
|
361
|
+
/** Checkout appearance tokens and slots for the status line. */
|
|
362
|
+
appearance?: CheckoutAppearance;
|
|
363
|
+
/**
|
|
364
|
+
* Explicit cart lines (a custom cart layout that is not the Bitsnap drawer).
|
|
365
|
+
* The SDK uploads and prices them; it never edits the merchant's own state.
|
|
366
|
+
* Omitted: the Bitsnap cart is the basket.
|
|
367
|
+
*/
|
|
368
|
+
items?: ExpressItem[];
|
|
369
|
+
/** Product to add to the basket on click (product page placement). */
|
|
370
|
+
productId?: string;
|
|
371
|
+
/** Quantity of `productId`; default 1. */
|
|
372
|
+
quantity?: number;
|
|
373
|
+
/** Official widget placement; defaults to PRODUCT_CARD with `productId`, else BASKET_SUMMARY. */
|
|
374
|
+
bindingPlace?: InPostBindingPlace;
|
|
375
|
+
/** Official widget `variation` attribute (visual variant). */
|
|
376
|
+
variation?: string;
|
|
377
|
+
className?: string;
|
|
378
|
+
style?: CSSProperties;
|
|
379
|
+
/** Analytics of the buttons; on by default, `false` opts out. */
|
|
380
|
+
analytics?: AnalyticsOption;
|
|
381
|
+
/**
|
|
382
|
+
* Called after the browser's `orderCreated` event when the server status has
|
|
383
|
+
* been checked. The event is only a hint: `status` is `completed` only when
|
|
384
|
+
* the signed server-side order state confirms it.
|
|
385
|
+
*/
|
|
386
|
+
onOrderCreated?: (info: {
|
|
387
|
+
providerOrderId?: string;
|
|
388
|
+
status?: "pending" | "completed" | "cancelled" | "failed";
|
|
389
|
+
}) => void;
|
|
390
|
+
/** After InPost changed the basket in its app; the canonical snapshot. */
|
|
391
|
+
onBasketChanged?: (snapshot: CartSnapshot) => void;
|
|
392
|
+
/** Test/custom fetch (for example a mocked storefront). */
|
|
393
|
+
fetch?: FetchLike;
|
|
394
|
+
/** Bounds for the server confirmation (tests use a fake sleep). */
|
|
395
|
+
confirmation?: {
|
|
396
|
+
timeoutMs?: number;
|
|
397
|
+
intervalMs?: number;
|
|
398
|
+
sleep?: (ms: number) => Promise<void>;
|
|
399
|
+
now?: () => number;
|
|
400
|
+
};
|
|
401
|
+
};
|
|
402
|
+
/**
|
|
403
|
+
* Standalone InPost Pay button for a product or cart page. Inside
|
|
404
|
+
* `<BitsnapCheckout>` the checkout renders this component itself.
|
|
405
|
+
*/
|
|
406
|
+
declare function InPostPayButton(props: InPostPayButtonProps): react_jsx_runtime.JSX.Element;
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* Loader of the official Revolut Checkout embed script.
|
|
410
|
+
*
|
|
411
|
+
* The script is loaded only in the browser and only when a Revolut Pay button
|
|
412
|
+
* is about to render: it never runs during server rendering and never lands in
|
|
413
|
+
* the initial bundle of a page without the button. One `<script>` per mode is
|
|
414
|
+
* shared by every button on the page, including two shops using different
|
|
415
|
+
* public keys (the SDK is keyed per `payments()` call, not globally).
|
|
416
|
+
*/
|
|
417
|
+
type RevolutMode = "prod" | "sandbox";
|
|
418
|
+
type RevolutPaymentEvent = {
|
|
419
|
+
type: "success";
|
|
420
|
+
orderId: string;
|
|
421
|
+
} | {
|
|
422
|
+
type: "error";
|
|
423
|
+
error: {
|
|
424
|
+
message?: string;
|
|
425
|
+
};
|
|
426
|
+
orderId: string;
|
|
427
|
+
} | {
|
|
428
|
+
type: "cancel";
|
|
429
|
+
dropOffState?: string;
|
|
430
|
+
orderId?: string;
|
|
431
|
+
};
|
|
432
|
+
type RevolutPayButtonStyle = {
|
|
433
|
+
height?: string;
|
|
434
|
+
size?: "large" | "small";
|
|
435
|
+
radius?: "none" | "small" | "large" | "round";
|
|
436
|
+
variant?: "dark" | "light" | "light-outlined";
|
|
437
|
+
action?: "donate" | "pay" | "subscribe" | "buy";
|
|
438
|
+
};
|
|
439
|
+
type RevolutPayPaymentOptions = {
|
|
440
|
+
currency: string;
|
|
441
|
+
totalAmount: number;
|
|
442
|
+
createOrder: () => Promise<{
|
|
443
|
+
publicId: string;
|
|
444
|
+
}>;
|
|
445
|
+
buttonStyle?: RevolutPayButtonStyle;
|
|
446
|
+
mobileRedirectUrls?: {
|
|
447
|
+
success: string;
|
|
448
|
+
failure: string;
|
|
449
|
+
cancel: string;
|
|
450
|
+
};
|
|
451
|
+
redirectUrls?: {
|
|
452
|
+
success: string;
|
|
453
|
+
failure: string;
|
|
454
|
+
cancel: string;
|
|
455
|
+
};
|
|
456
|
+
validate?: () => Promise<boolean> | boolean;
|
|
457
|
+
};
|
|
458
|
+
type RevolutPayModule = {
|
|
459
|
+
mount: (target: string | HTMLElement | null, options: RevolutPayPaymentOptions) => void;
|
|
460
|
+
on: {
|
|
461
|
+
(event: "click", callback: () => void): void;
|
|
462
|
+
(event: "payment", callback: (payload: RevolutPaymentEvent) => void): void;
|
|
463
|
+
};
|
|
464
|
+
destroy: () => void;
|
|
465
|
+
};
|
|
466
|
+
type RevolutPaymentsModule = {
|
|
467
|
+
revolutPay: RevolutPayModule;
|
|
468
|
+
destroy?: () => void;
|
|
469
|
+
};
|
|
470
|
+
type RevolutCheckoutNamespace = {
|
|
471
|
+
payments: (options: {
|
|
472
|
+
publicToken: string;
|
|
473
|
+
mode?: RevolutMode;
|
|
474
|
+
locale?: string;
|
|
475
|
+
}) => Promise<RevolutPaymentsModule>;
|
|
476
|
+
};
|
|
477
|
+
declare global {
|
|
478
|
+
interface Window {
|
|
479
|
+
RevolutCheckout?: RevolutCheckoutNamespace;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* Revolut Pay, mounted through the official Revolut Checkout embed script.
|
|
485
|
+
*
|
|
486
|
+
* The SDK is lazy: it loads only after Bitsnap says the provider is available
|
|
487
|
+
* with a public `publicKey`, and only in the browser. The order is created by
|
|
488
|
+
* the server (`createOrder` calls Bitsnap), never by the browser's numbers.
|
|
489
|
+
*
|
|
490
|
+
* A widget `success` event is a UX signal only: the button shows "confirming"
|
|
491
|
+
* and asks Bitsnap (`revolut/status`) until the verified webhook settles the
|
|
492
|
+
* order. Only then are the purchased lines removed from the cart. Cancel,
|
|
493
|
+
* failure and timeout keep the cart exactly as it was.
|
|
494
|
+
*/
|
|
495
|
+
type RevolutPaymentOutcome = {
|
|
496
|
+
status: "completed";
|
|
497
|
+
orderId?: string;
|
|
498
|
+
} | {
|
|
499
|
+
status: "pending";
|
|
500
|
+
} | {
|
|
501
|
+
status: "failed";
|
|
502
|
+
} | {
|
|
503
|
+
status: "cancelled";
|
|
504
|
+
};
|
|
505
|
+
type RevolutPayButtonProps = {
|
|
506
|
+
/** Bitsnap project; optional when the page called `setProjectID(...)`. */
|
|
507
|
+
projectID?: string;
|
|
508
|
+
host?: string;
|
|
509
|
+
locale?: string;
|
|
510
|
+
texts?: Partial<CheckoutTexts>;
|
|
511
|
+
appearance?: CheckoutAppearance;
|
|
512
|
+
/** Explicit cart lines for a custom cart layout; omitted: the Bitsnap cart. */
|
|
513
|
+
items?: ExpressItem[];
|
|
514
|
+
/** Product page support: uploads this product (with `quantity`) as the cart. */
|
|
515
|
+
productId?: string;
|
|
516
|
+
quantity?: number;
|
|
517
|
+
country?: string;
|
|
518
|
+
couponCode?: string;
|
|
519
|
+
/** Page the buyer returns to; defaults to the current page. */
|
|
520
|
+
returnUrl?: string;
|
|
521
|
+
cancelUrl?: string;
|
|
522
|
+
/** Official Revolut button appearance. */
|
|
523
|
+
buttonStyle?: RevolutPayButtonStyle;
|
|
524
|
+
className?: string;
|
|
525
|
+
style?: CSSProperties;
|
|
526
|
+
analytics?: AnalyticsOption;
|
|
527
|
+
/** Called with the browser-level outcome; `completed` is server-confirmed. */
|
|
528
|
+
onPaymentResult?: (outcome: RevolutPaymentOutcome) => void;
|
|
529
|
+
fetch?: FetchLike;
|
|
530
|
+
/** Polling bounds for the server confirmation (tests use a fake sleep). */
|
|
531
|
+
confirmation?: {
|
|
532
|
+
timeoutMs?: number;
|
|
533
|
+
intervalMs?: number;
|
|
534
|
+
sleep?: (ms: number) => Promise<void>;
|
|
535
|
+
now?: () => number;
|
|
536
|
+
};
|
|
537
|
+
};
|
|
538
|
+
/** Standalone Revolut Pay button for a product or cart page. */
|
|
539
|
+
declare function RevolutPayButton(props: RevolutPayButtonProps): react_jsx_runtime.JSX.Element;
|
|
540
|
+
|
|
268
541
|
type PublicNotificationGroup = {
|
|
269
542
|
id: string;
|
|
270
543
|
isOn?: boolean;
|
|
@@ -697,4 +970,15 @@ declare function persistReturnURL(returnURL: string | null): void;
|
|
|
697
970
|
declare function readPersistedReturnURL(): string | null;
|
|
698
971
|
declare function buildAccessTokenRedirect(returnURL: string, accessToken: string): string;
|
|
699
972
|
|
|
700
|
-
|
|
973
|
+
/**
|
|
974
|
+
* A buyer's pack thread for one service product. Loads the chat on demand;
|
|
975
|
+
* the same component is exported eagerly from `bitsnap-react/chat`.
|
|
976
|
+
*/
|
|
977
|
+
declare function ChatThread(props: ChatThreadProps): react_jsx_runtime.JSX.Element;
|
|
978
|
+
/**
|
|
979
|
+
* A community channel. Loads the chat on demand; the same component is
|
|
980
|
+
* exported eagerly from `bitsnap-react/chat`.
|
|
981
|
+
*/
|
|
982
|
+
declare function Channel(props: ChannelProps): react_jsx_runtime.JSX.Element;
|
|
983
|
+
|
|
984
|
+
export { AnalyticsOption, Wrapper$2 as ApplePayButton, type Props$3 as ApplePayButtonProps, Bitsnap, type BitsnapCartProps, BitsnapCart as BitsnapCheckout, type BuyErrorData, CHECKOUT_SLOT_NAMES, Channel, ChannelProps, ChatThread, ChatThreadProps, 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,13 +4,16 @@ 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
|
-
import { P as PanelLoginProps, a as PanelProps, G as GetThemeOutput } from './types-
|
|
10
|
-
export { b as PanelScreen, c as PanelSearchParamsType } from './types-
|
|
9
|
+
import { P as PanelLoginProps, a as PanelProps, G as GetThemeOutput } from './types-iRe6ix2y.js';
|
|
10
|
+
export { b as PanelScreen, c as PanelSearchParamsType } from './types-iRe6ix2y.js';
|
|
11
|
+
import { e as ChatThreadProps, c as ChannelProps } from './widgets-BVOSj9fU.js';
|
|
12
|
+
export { d as ChatBuyRequest, C as ChatTexts, f as ChatWidgetBaseProps } from './widgets-BVOSj9fU.js';
|
|
11
13
|
import './models.js';
|
|
12
14
|
import '@bufbuild/protobuf/wkt';
|
|
13
15
|
import '@bufbuild/protobuf';
|
|
16
|
+
import './texts-9kfgClsA.js';
|
|
14
17
|
|
|
15
18
|
type AppleButtonType = "plain" | "add-money" | "book" | "buy" | "check-out" | "continue" | "contribute" | "donate" | "order" | "pay" | "reload" | "rent" | "set-up" | "subscribe" | "support" | "tip" | "top-up";
|
|
16
19
|
type ColorType = "black" | "white" | "white-outline";
|
|
@@ -207,6 +210,26 @@ type CheckoutTexts = {
|
|
|
207
210
|
paymentMethodCodDescription: string;
|
|
208
211
|
/** Error shown when the shop refused cash on delivery for the order. */
|
|
209
212
|
paymentMethodCodUnavailable: string;
|
|
213
|
+
/** Status while the provider confirms a payment started from an express button. */
|
|
214
|
+
expressPending: string;
|
|
215
|
+
/** Status after the provider confirmed the payment. */
|
|
216
|
+
expressConfirmed: string;
|
|
217
|
+
/** Status when the provider reports a failed payment. */
|
|
218
|
+
expressFailed: string;
|
|
219
|
+
/** Status when the buyer cancelled the provider's payment flow. */
|
|
220
|
+
expressCancelled: string;
|
|
221
|
+
/** Shown while the payment is still unconfirmed after a page return. */
|
|
222
|
+
expressPendingLong: string;
|
|
223
|
+
/** Error shown when the provider's button could not be loaded. */
|
|
224
|
+
expressLoadFailed: string;
|
|
225
|
+
/** Error shown when the cart cannot be paid with this provider right now. */
|
|
226
|
+
expressCartUnavailable: string;
|
|
227
|
+
/** Error shown when another tab/provider changed the same cart line. */
|
|
228
|
+
expressCartConflict: string;
|
|
229
|
+
/** Shown when the server total changed between mounting and paying. */
|
|
230
|
+
expressPriceChanged: string;
|
|
231
|
+
/** Error shown when a product could not be added before the InPost binding. */
|
|
232
|
+
expressProductUnavailable: string;
|
|
210
233
|
};
|
|
211
234
|
|
|
212
235
|
type BitsnapCartProps = {
|
|
@@ -265,6 +288,256 @@ type Props$2 = {
|
|
|
265
288
|
};
|
|
266
289
|
declare function Wrapper$1(props: Props$2): react_jsx_runtime.JSX.Element;
|
|
267
290
|
|
|
291
|
+
type CartEnvironment = "test" | "production";
|
|
292
|
+
type CartSnapshotLine = {
|
|
293
|
+
lineId: string;
|
|
294
|
+
/** The id the cart was uploaded with; the same id `/buy` takes. */
|
|
295
|
+
productId: string;
|
|
296
|
+
variantId: string;
|
|
297
|
+
quantity: number;
|
|
298
|
+
name: string;
|
|
299
|
+
imageUrl?: string;
|
|
300
|
+
unitPriceMinor: number;
|
|
301
|
+
lineTotalMinor: number;
|
|
302
|
+
tax?: number;
|
|
303
|
+
currency: string;
|
|
304
|
+
};
|
|
305
|
+
type CartSnapshot = {
|
|
306
|
+
cartId: string;
|
|
307
|
+
revision: number;
|
|
308
|
+
status: "open" | "bound" | "checkout" | "ordered" | "expired";
|
|
309
|
+
environment: CartEnvironment;
|
|
310
|
+
currency: string;
|
|
311
|
+
locale: string;
|
|
312
|
+
lines: CartSnapshotLine[];
|
|
313
|
+
subtotalMinor: number;
|
|
314
|
+
deliveryMinor: number;
|
|
315
|
+
discountMinor: number;
|
|
316
|
+
totalMinor: number;
|
|
317
|
+
couponCode?: string;
|
|
318
|
+
expiresAt: number;
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
type FetchLike = (input: string, init?: RequestInit) => Promise<Response>;
|
|
322
|
+
|
|
323
|
+
/** Official `binding_place` values this SDK exposes. */
|
|
324
|
+
declare const INPOST_BINDING_PLACES: readonly ["PRODUCT_CARD", "BASKET_SUMMARY", "MINICART_PAGE", "CHECKOUT_PAGE", "ORDER_CREATE", "THANK_YOU_PAGE"];
|
|
325
|
+
type InPostBindingPlace = (typeof INPOST_BINDING_PLACES)[number];
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* React glue between the express client and the buttons. Everything is
|
|
329
|
+
* browser-only: nothing is requested while rendering on the server, and no
|
|
330
|
+
* state is shared between two projects or two hosts.
|
|
331
|
+
*/
|
|
332
|
+
type ExpressItem = {
|
|
333
|
+
id: string;
|
|
334
|
+
quantity: number;
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* InPost Pay on a product page or in a cart.
|
|
339
|
+
*
|
|
340
|
+
* The button is the official InPost Pay widget: this component renders its
|
|
341
|
+
* documented `<inpost-izi-button>` element, loads the widget lazily in the
|
|
342
|
+
* browser and gives it the documented callbacks. The basket itself is durable
|
|
343
|
+
* on Bitsnap: the first click uploads the cart, binds it through the InPost
|
|
344
|
+
* merchant API (server side) and returns only the basket key the widget needs.
|
|
345
|
+
*
|
|
346
|
+
* Nothing renders unless the backend says the provider is available with a
|
|
347
|
+
* public `merchantClientId`; a 501, an old backend or a missing credential
|
|
348
|
+
* shows no button at all.
|
|
349
|
+
*/
|
|
350
|
+
type InPostPayButtonProps = {
|
|
351
|
+
/**
|
|
352
|
+
* The Bitsnap project of the cart. Optional when the page already called
|
|
353
|
+
* `setProjectID(projectID)`; given here it is configured for the page.
|
|
354
|
+
*/
|
|
355
|
+
projectID?: string;
|
|
356
|
+
/** Bitsnap host; defaults to the configured one. */
|
|
357
|
+
host?: string;
|
|
358
|
+
locale?: string;
|
|
359
|
+
/** Text overrides, as on `BitsnapCheckout`. */
|
|
360
|
+
texts?: Partial<CheckoutTexts>;
|
|
361
|
+
/** Checkout appearance tokens and slots for the status line. */
|
|
362
|
+
appearance?: CheckoutAppearance;
|
|
363
|
+
/**
|
|
364
|
+
* Explicit cart lines (a custom cart layout that is not the Bitsnap drawer).
|
|
365
|
+
* The SDK uploads and prices them; it never edits the merchant's own state.
|
|
366
|
+
* Omitted: the Bitsnap cart is the basket.
|
|
367
|
+
*/
|
|
368
|
+
items?: ExpressItem[];
|
|
369
|
+
/** Product to add to the basket on click (product page placement). */
|
|
370
|
+
productId?: string;
|
|
371
|
+
/** Quantity of `productId`; default 1. */
|
|
372
|
+
quantity?: number;
|
|
373
|
+
/** Official widget placement; defaults to PRODUCT_CARD with `productId`, else BASKET_SUMMARY. */
|
|
374
|
+
bindingPlace?: InPostBindingPlace;
|
|
375
|
+
/** Official widget `variation` attribute (visual variant). */
|
|
376
|
+
variation?: string;
|
|
377
|
+
className?: string;
|
|
378
|
+
style?: CSSProperties;
|
|
379
|
+
/** Analytics of the buttons; on by default, `false` opts out. */
|
|
380
|
+
analytics?: AnalyticsOption;
|
|
381
|
+
/**
|
|
382
|
+
* Called after the browser's `orderCreated` event when the server status has
|
|
383
|
+
* been checked. The event is only a hint: `status` is `completed` only when
|
|
384
|
+
* the signed server-side order state confirms it.
|
|
385
|
+
*/
|
|
386
|
+
onOrderCreated?: (info: {
|
|
387
|
+
providerOrderId?: string;
|
|
388
|
+
status?: "pending" | "completed" | "cancelled" | "failed";
|
|
389
|
+
}) => void;
|
|
390
|
+
/** After InPost changed the basket in its app; the canonical snapshot. */
|
|
391
|
+
onBasketChanged?: (snapshot: CartSnapshot) => void;
|
|
392
|
+
/** Test/custom fetch (for example a mocked storefront). */
|
|
393
|
+
fetch?: FetchLike;
|
|
394
|
+
/** Bounds for the server confirmation (tests use a fake sleep). */
|
|
395
|
+
confirmation?: {
|
|
396
|
+
timeoutMs?: number;
|
|
397
|
+
intervalMs?: number;
|
|
398
|
+
sleep?: (ms: number) => Promise<void>;
|
|
399
|
+
now?: () => number;
|
|
400
|
+
};
|
|
401
|
+
};
|
|
402
|
+
/**
|
|
403
|
+
* Standalone InPost Pay button for a product or cart page. Inside
|
|
404
|
+
* `<BitsnapCheckout>` the checkout renders this component itself.
|
|
405
|
+
*/
|
|
406
|
+
declare function InPostPayButton(props: InPostPayButtonProps): react_jsx_runtime.JSX.Element;
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* Loader of the official Revolut Checkout embed script.
|
|
410
|
+
*
|
|
411
|
+
* The script is loaded only in the browser and only when a Revolut Pay button
|
|
412
|
+
* is about to render: it never runs during server rendering and never lands in
|
|
413
|
+
* the initial bundle of a page without the button. One `<script>` per mode is
|
|
414
|
+
* shared by every button on the page, including two shops using different
|
|
415
|
+
* public keys (the SDK is keyed per `payments()` call, not globally).
|
|
416
|
+
*/
|
|
417
|
+
type RevolutMode = "prod" | "sandbox";
|
|
418
|
+
type RevolutPaymentEvent = {
|
|
419
|
+
type: "success";
|
|
420
|
+
orderId: string;
|
|
421
|
+
} | {
|
|
422
|
+
type: "error";
|
|
423
|
+
error: {
|
|
424
|
+
message?: string;
|
|
425
|
+
};
|
|
426
|
+
orderId: string;
|
|
427
|
+
} | {
|
|
428
|
+
type: "cancel";
|
|
429
|
+
dropOffState?: string;
|
|
430
|
+
orderId?: string;
|
|
431
|
+
};
|
|
432
|
+
type RevolutPayButtonStyle = {
|
|
433
|
+
height?: string;
|
|
434
|
+
size?: "large" | "small";
|
|
435
|
+
radius?: "none" | "small" | "large" | "round";
|
|
436
|
+
variant?: "dark" | "light" | "light-outlined";
|
|
437
|
+
action?: "donate" | "pay" | "subscribe" | "buy";
|
|
438
|
+
};
|
|
439
|
+
type RevolutPayPaymentOptions = {
|
|
440
|
+
currency: string;
|
|
441
|
+
totalAmount: number;
|
|
442
|
+
createOrder: () => Promise<{
|
|
443
|
+
publicId: string;
|
|
444
|
+
}>;
|
|
445
|
+
buttonStyle?: RevolutPayButtonStyle;
|
|
446
|
+
mobileRedirectUrls?: {
|
|
447
|
+
success: string;
|
|
448
|
+
failure: string;
|
|
449
|
+
cancel: string;
|
|
450
|
+
};
|
|
451
|
+
redirectUrls?: {
|
|
452
|
+
success: string;
|
|
453
|
+
failure: string;
|
|
454
|
+
cancel: string;
|
|
455
|
+
};
|
|
456
|
+
validate?: () => Promise<boolean> | boolean;
|
|
457
|
+
};
|
|
458
|
+
type RevolutPayModule = {
|
|
459
|
+
mount: (target: string | HTMLElement | null, options: RevolutPayPaymentOptions) => void;
|
|
460
|
+
on: {
|
|
461
|
+
(event: "click", callback: () => void): void;
|
|
462
|
+
(event: "payment", callback: (payload: RevolutPaymentEvent) => void): void;
|
|
463
|
+
};
|
|
464
|
+
destroy: () => void;
|
|
465
|
+
};
|
|
466
|
+
type RevolutPaymentsModule = {
|
|
467
|
+
revolutPay: RevolutPayModule;
|
|
468
|
+
destroy?: () => void;
|
|
469
|
+
};
|
|
470
|
+
type RevolutCheckoutNamespace = {
|
|
471
|
+
payments: (options: {
|
|
472
|
+
publicToken: string;
|
|
473
|
+
mode?: RevolutMode;
|
|
474
|
+
locale?: string;
|
|
475
|
+
}) => Promise<RevolutPaymentsModule>;
|
|
476
|
+
};
|
|
477
|
+
declare global {
|
|
478
|
+
interface Window {
|
|
479
|
+
RevolutCheckout?: RevolutCheckoutNamespace;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* Revolut Pay, mounted through the official Revolut Checkout embed script.
|
|
485
|
+
*
|
|
486
|
+
* The SDK is lazy: it loads only after Bitsnap says the provider is available
|
|
487
|
+
* with a public `publicKey`, and only in the browser. The order is created by
|
|
488
|
+
* the server (`createOrder` calls Bitsnap), never by the browser's numbers.
|
|
489
|
+
*
|
|
490
|
+
* A widget `success` event is a UX signal only: the button shows "confirming"
|
|
491
|
+
* and asks Bitsnap (`revolut/status`) until the verified webhook settles the
|
|
492
|
+
* order. Only then are the purchased lines removed from the cart. Cancel,
|
|
493
|
+
* failure and timeout keep the cart exactly as it was.
|
|
494
|
+
*/
|
|
495
|
+
type RevolutPaymentOutcome = {
|
|
496
|
+
status: "completed";
|
|
497
|
+
orderId?: string;
|
|
498
|
+
} | {
|
|
499
|
+
status: "pending";
|
|
500
|
+
} | {
|
|
501
|
+
status: "failed";
|
|
502
|
+
} | {
|
|
503
|
+
status: "cancelled";
|
|
504
|
+
};
|
|
505
|
+
type RevolutPayButtonProps = {
|
|
506
|
+
/** Bitsnap project; optional when the page called `setProjectID(...)`. */
|
|
507
|
+
projectID?: string;
|
|
508
|
+
host?: string;
|
|
509
|
+
locale?: string;
|
|
510
|
+
texts?: Partial<CheckoutTexts>;
|
|
511
|
+
appearance?: CheckoutAppearance;
|
|
512
|
+
/** Explicit cart lines for a custom cart layout; omitted: the Bitsnap cart. */
|
|
513
|
+
items?: ExpressItem[];
|
|
514
|
+
/** Product page support: uploads this product (with `quantity`) as the cart. */
|
|
515
|
+
productId?: string;
|
|
516
|
+
quantity?: number;
|
|
517
|
+
country?: string;
|
|
518
|
+
couponCode?: string;
|
|
519
|
+
/** Page the buyer returns to; defaults to the current page. */
|
|
520
|
+
returnUrl?: string;
|
|
521
|
+
cancelUrl?: string;
|
|
522
|
+
/** Official Revolut button appearance. */
|
|
523
|
+
buttonStyle?: RevolutPayButtonStyle;
|
|
524
|
+
className?: string;
|
|
525
|
+
style?: CSSProperties;
|
|
526
|
+
analytics?: AnalyticsOption;
|
|
527
|
+
/** Called with the browser-level outcome; `completed` is server-confirmed. */
|
|
528
|
+
onPaymentResult?: (outcome: RevolutPaymentOutcome) => void;
|
|
529
|
+
fetch?: FetchLike;
|
|
530
|
+
/** Polling bounds for the server confirmation (tests use a fake sleep). */
|
|
531
|
+
confirmation?: {
|
|
532
|
+
timeoutMs?: number;
|
|
533
|
+
intervalMs?: number;
|
|
534
|
+
sleep?: (ms: number) => Promise<void>;
|
|
535
|
+
now?: () => number;
|
|
536
|
+
};
|
|
537
|
+
};
|
|
538
|
+
/** Standalone Revolut Pay button for a product or cart page. */
|
|
539
|
+
declare function RevolutPayButton(props: RevolutPayButtonProps): react_jsx_runtime.JSX.Element;
|
|
540
|
+
|
|
268
541
|
type PublicNotificationGroup = {
|
|
269
542
|
id: string;
|
|
270
543
|
isOn?: boolean;
|
|
@@ -697,4 +970,15 @@ declare function persistReturnURL(returnURL: string | null): void;
|
|
|
697
970
|
declare function readPersistedReturnURL(): string | null;
|
|
698
971
|
declare function buildAccessTokenRedirect(returnURL: string, accessToken: string): string;
|
|
699
972
|
|
|
700
|
-
|
|
973
|
+
/**
|
|
974
|
+
* A buyer's pack thread for one service product. Loads the chat on demand;
|
|
975
|
+
* the same component is exported eagerly from `bitsnap-react/chat`.
|
|
976
|
+
*/
|
|
977
|
+
declare function ChatThread(props: ChatThreadProps): react_jsx_runtime.JSX.Element;
|
|
978
|
+
/**
|
|
979
|
+
* A community channel. Loads the chat on demand; the same component is
|
|
980
|
+
* exported eagerly from `bitsnap-react/chat`.
|
|
981
|
+
*/
|
|
982
|
+
declare function Channel(props: ChannelProps): react_jsx_runtime.JSX.Element;
|
|
983
|
+
|
|
984
|
+
export { AnalyticsOption, Wrapper$2 as ApplePayButton, type Props$3 as ApplePayButtonProps, Bitsnap, type BitsnapCartProps, BitsnapCart as BitsnapCheckout, type BuyErrorData, CHECKOUT_SLOT_NAMES, Channel, ChannelProps, ChatThread, ChatThreadProps, 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 };
|