bitsnap-react 1.11.1 → 1.12.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.
- package/README.md +37 -7
- package/dist/CartProvider-WPJWECBS.mjs +2 -0
- package/dist/CartProvider-YPZ3HD7W.js +2 -0
- package/dist/CartProvider-YPZ3HD7W.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/chunk-3ITTSNWG.js +2 -0
- package/dist/chunk-3ITTSNWG.js.map +1 -0
- package/dist/chunk-4BV5IUZH.js +2 -0
- package/dist/chunk-4BV5IUZH.js.map +1 -0
- package/dist/{chunk-UFIOJGJZ.js → chunk-4ZFIL5S7.js} +2 -2
- package/dist/chunk-4ZFIL5S7.js.map +1 -0
- package/dist/{chunk-JUDR4EZA.mjs → chunk-DRAKVCD7.mjs} +2 -2
- package/dist/{chunk-HWQNT6XU.mjs → chunk-G3VVAVG7.mjs} +2 -2
- package/dist/chunk-GJNFDUJN.mjs +4 -0
- package/dist/chunk-GJNFDUJN.mjs.map +1 -0
- package/dist/{chunk-ETGHIHWR.mjs → chunk-HBPSSGYN.mjs} +2 -2
- package/dist/{chunk-WGJTXDIS.js → chunk-HDLCLZOK.js} +2 -2
- package/dist/chunk-HDLCLZOK.js.map +1 -0
- package/dist/{chunk-3IVLQILF.js → chunk-I6BRDRPB.js} +2 -2
- package/dist/chunk-I6BRDRPB.js.map +1 -0
- package/dist/chunk-JSDGZ4NY.js.map +1 -1
- package/dist/chunk-KOYBZORL.js.map +1 -1
- package/dist/{chunk-VPBFEAFQ.js → chunk-MZSLLGFS.js} +2 -2
- package/dist/chunk-MZSLLGFS.js.map +1 -0
- package/dist/{chunk-UCL4Y7L3.js → chunk-STVEBT6M.js} +2 -2
- package/dist/chunk-STVEBT6M.js.map +1 -0
- package/dist/{chunk-IJLHU2MA.mjs → chunk-T2YSOHJM.mjs} +2 -2
- package/dist/{chunk-IJLHU2MA.mjs.map → chunk-T2YSOHJM.mjs.map} +1 -1
- package/dist/chunk-T3PAOMHI.mjs +2 -0
- package/dist/chunk-T3PAOMHI.mjs.map +1 -0
- package/dist/chunk-VDLJW4JJ.mjs +2 -0
- package/dist/chunk-VDLJW4JJ.mjs.map +1 -0
- package/dist/{chunk-DWRBPP32.mjs → chunk-VF62KDNS.mjs} +2 -2
- package/dist/chunk-VRL3IF5J.js +4 -0
- package/dist/chunk-VRL3IF5J.js.map +1 -0
- package/dist/chunk-XIHGWNTS.js.map +1 -1
- package/dist/consent.js.map +1 -1
- package/dist/course.js +1 -1
- package/dist/course.js.map +1 -1
- package/dist/course.mjs +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 +97 -2
- package/dist/index.d.ts +97 -2
- 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-FVDH6Y57.mjs +2 -0
- package/dist/methods-ISVX5JQ7.js +2 -0
- package/dist/methods-ISVX5JQ7.js.map +1 -0
- 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/package.json +2 -2
- package/dist/CartProvider-QY2DMNCC.js +0 -2
- package/dist/CartProvider-QY2DMNCC.js.map +0 -1
- package/dist/CartProvider-XMHPQRWC.mjs +0 -2
- package/dist/chunk-2PK36NGB.mjs +0 -4
- package/dist/chunk-2PK36NGB.mjs.map +0 -1
- package/dist/chunk-2X32DDUM.mjs +0 -2
- package/dist/chunk-2X32DDUM.mjs.map +0 -1
- package/dist/chunk-3IVLQILF.js.map +0 -1
- package/dist/chunk-FBTYZHXM.js +0 -4
- package/dist/chunk-FBTYZHXM.js.map +0 -1
- package/dist/chunk-G2UOTVS5.mjs +0 -2
- package/dist/chunk-G2UOTVS5.mjs.map +0 -1
- package/dist/chunk-Q25D7OAO.js +0 -2
- package/dist/chunk-Q25D7OAO.js.map +0 -1
- package/dist/chunk-UCL4Y7L3.js.map +0 -1
- package/dist/chunk-UFIOJGJZ.js.map +0 -1
- package/dist/chunk-VPBFEAFQ.js.map +0 -1
- package/dist/chunk-WGJTXDIS.js.map +0 -1
- package/dist/chunk-YBGAYEJQ.js +0 -2
- package/dist/chunk-YBGAYEJQ.js.map +0 -1
- package/dist/methods-ALO22YWQ.mjs +0 -2
- package/dist/methods-ZBX4BTDE.js +0 -2
- package/dist/methods-ZBX4BTDE.js.map +0 -1
- /package/dist/{CartProvider-XMHPQRWC.mjs.map → CartProvider-WPJWECBS.mjs.map} +0 -0
- /package/dist/{chunk-JUDR4EZA.mjs.map → chunk-DRAKVCD7.mjs.map} +0 -0
- /package/dist/{chunk-HWQNT6XU.mjs.map → chunk-G3VVAVG7.mjs.map} +0 -0
- /package/dist/{chunk-ETGHIHWR.mjs.map → chunk-HBPSSGYN.mjs.map} +0 -0
- /package/dist/{chunk-DWRBPP32.mjs.map → chunk-VF62KDNS.mjs.map} +0 -0
- /package/dist/{methods-ALO22YWQ.mjs.map → methods-FVDH6Y57.mjs.map} +0 -0
package/dist/index.d.mts
CHANGED
|
@@ -28,6 +28,8 @@ type Props$3 = {
|
|
|
28
28
|
name: string;
|
|
29
29
|
id: string;
|
|
30
30
|
price: number;
|
|
31
|
+
/** Currency of `price` (minor units); defaults to PLN. */
|
|
32
|
+
currency?: string;
|
|
31
33
|
quantity: number;
|
|
32
34
|
isDeliverable?: boolean;
|
|
33
35
|
metadata?: {
|
|
@@ -95,7 +97,7 @@ type CheckoutAppearanceTokens = {
|
|
|
95
97
|
* Stable slot names. They are exposed as `data-bitsnap-checkout-slot`
|
|
96
98
|
* attributes so they can also be targeted from plain CSS.
|
|
97
99
|
*/
|
|
98
|
-
declare const CHECKOUT_SLOT_NAMES: readonly ["root", "overlay", "panel", "header", "title", "closeButton", "productList", "product", "productImage", "productName", "productPrice", "quantityControl", "quantityInput", "quantityButton", "removeButton", "summary", "totalLabel", "totalValue", "deliveryText", "countryLabel", "countryTrigger", "countryDropdown", "countrySearch", "countryOption", "paymentButtons", "checkoutButton", "emptyState", "error", "skeleton"];
|
|
100
|
+
declare const CHECKOUT_SLOT_NAMES: readonly ["root", "overlay", "panel", "header", "title", "closeButton", "productList", "product", "productImage", "productName", "productPrice", "quantityControl", "quantityInput", "quantityButton", "removeButton", "summary", "totalLabel", "totalValue", "deliveryText", "summaryNote", "countryLabel", "countryTrigger", "countryDropdown", "countrySearch", "countryOption", "paymentButtons", "paymentMethods", "paymentMethodOption", "checkoutButton", "emptyState", "error", "skeleton"];
|
|
99
101
|
type CheckoutSlotName = (typeof CHECKOUT_SLOT_NAMES)[number];
|
|
100
102
|
type CheckoutSlotAppearance = SlotAppearance;
|
|
101
103
|
type CheckoutAppearanceElements = AppearanceElements<CheckoutSlotName>;
|
|
@@ -145,6 +147,60 @@ type CheckoutTexts = {
|
|
|
145
147
|
currencyUnsupported: string;
|
|
146
148
|
/** Error shown when a price changed after the product was added. */
|
|
147
149
|
priceChanged: string;
|
|
150
|
+
/** Accessible name of the close button of the drawer. */
|
|
151
|
+
close: string;
|
|
152
|
+
/** Remove button of a cart line (also read together with the product name). */
|
|
153
|
+
remove: string;
|
|
154
|
+
/** Accessible name of the quantity control and its input. */
|
|
155
|
+
quantity: string;
|
|
156
|
+
/** Accessible name of the "+" quantity button. */
|
|
157
|
+
increaseQuantity: string;
|
|
158
|
+
/** Accessible name of the "-" quantity button. */
|
|
159
|
+
decreaseQuantity: string;
|
|
160
|
+
/** Accessible name of the cart button when it only shows an icon. */
|
|
161
|
+
openCart: string;
|
|
162
|
+
/** Hidden label of the number of products badge; the number is appended after a colon. */
|
|
163
|
+
cartItemsCount: string;
|
|
164
|
+
/** Label before the lowest price of the last 30 days; the price is appended. */
|
|
165
|
+
lowestPrice30Days: string;
|
|
166
|
+
/** Shown instead of the lowest price when the price has no history. */
|
|
167
|
+
noPriceHistory: string;
|
|
168
|
+
/** Error shown when redirecting to the payment failed. */
|
|
169
|
+
redirectFailed: string;
|
|
170
|
+
/** Error shown when a subscription is added to the cart. */
|
|
171
|
+
subscriptionUnsupported: string;
|
|
172
|
+
/** Country search placeholder. */
|
|
173
|
+
searchCountry: string;
|
|
174
|
+
/** Shown when the country search has no match. */
|
|
175
|
+
noCountriesFound: string;
|
|
176
|
+
/** Hint under the checkout button when no country is chosen. */
|
|
177
|
+
countryRequired: string;
|
|
178
|
+
/** Title of the Apple Pay and Google Pay sheet total. */
|
|
179
|
+
paymentForCart: string;
|
|
180
|
+
/** Coupon label in the Google Pay sheet; the code is appended. */
|
|
181
|
+
coupon: string;
|
|
182
|
+
/** Note under the cart total. */
|
|
183
|
+
extrasCalculatedNext: string;
|
|
184
|
+
/** Error shown when the products of the cart could not be loaded. */
|
|
185
|
+
loadFailed: string;
|
|
186
|
+
/** Button that loads the cart again. */
|
|
187
|
+
retry: string;
|
|
188
|
+
/** Heading of the payment method choice (shown only when the shop offers paying by hand). */
|
|
189
|
+
paymentMethodLegend: string;
|
|
190
|
+
/** Option that pays through the shop's online gateway. */
|
|
191
|
+
paymentMethodOnline: string;
|
|
192
|
+
/** Hint under the online option. */
|
|
193
|
+
paymentMethodOnlineDescription: string;
|
|
194
|
+
/** Manual option when the seller takes bank transfers only. */
|
|
195
|
+
paymentMethodManualTransfer: string;
|
|
196
|
+
/** Manual option when the seller takes BLIK transfers to a phone number only. */
|
|
197
|
+
paymentMethodManualBlik: string;
|
|
198
|
+
/** Manual option when the seller takes both. */
|
|
199
|
+
paymentMethodManualBoth: string;
|
|
200
|
+
/** What paying by hand means: the details come after the order is placed. */
|
|
201
|
+
paymentMethodManualDescription: string;
|
|
202
|
+
/** Shown with a selected manual option that includes BLIK to a phone number. */
|
|
203
|
+
paymentMethodManualBlikNote: string;
|
|
148
204
|
};
|
|
149
205
|
|
|
150
206
|
type BitsnapCartProps = {
|
|
@@ -358,6 +414,27 @@ type Err = {
|
|
|
358
414
|
};
|
|
359
415
|
declare function Err(message: string, type?: ErrTypes, data?: unknown): Err;
|
|
360
416
|
|
|
417
|
+
/**
|
|
418
|
+
* The buyer's choice between paying online and paying the seller by hand
|
|
419
|
+
* (bank transfer or "BLIK przelew na telefon"), offered when the seller turned
|
|
420
|
+
* on "show at checkout" for the manual payment gateway.
|
|
421
|
+
*
|
|
422
|
+
* `POST /public-commerce/payment-methods` takes the body of `/buy` and answers
|
|
423
|
+
* `{ success: true, choice: null }` (nothing to choose) or
|
|
424
|
+
* `{ success: true, choice: { methods, manualAccountTypes } }`. The pick goes
|
|
425
|
+
* to `/buy` as `paymentMethod`. Anything else (an old backend, an error, a
|
|
426
|
+
* timeout) counts as "nothing to choose", so the cart buys as before.
|
|
427
|
+
*/
|
|
428
|
+
|
|
429
|
+
type PaymentMethod = "online" | "manual";
|
|
430
|
+
type ManualAccountType = "bankTransfer" | "blik";
|
|
431
|
+
type PaymentMethodChoice = {
|
|
432
|
+
/** In the seller's order; the first one is selected by default. */
|
|
433
|
+
methods: PaymentMethod[];
|
|
434
|
+
/** How the manual option is paid; decides its label. */
|
|
435
|
+
manualAccountTypes: ManualAccountType[];
|
|
436
|
+
};
|
|
437
|
+
|
|
361
438
|
declare function setLocale(locale?: string): void;
|
|
362
439
|
declare function getLocale(): string;
|
|
363
440
|
|
|
@@ -442,6 +519,10 @@ declare const linkRequestSchema: z__default.ZodObject<{
|
|
|
442
519
|
answer: z__default.ZodOptional<z__default.ZodBoolean>;
|
|
443
520
|
}, z__default.core.$strip>>>;
|
|
444
521
|
blikCode: z__default.ZodOptional<z__default.ZodString>;
|
|
522
|
+
paymentMethod: z__default.ZodOptional<z__default.ZodEnum<{
|
|
523
|
+
online: "online";
|
|
524
|
+
manual: "manual";
|
|
525
|
+
}>>;
|
|
445
526
|
couponCode: z__default.ZodOptional<z__default.ZodString>;
|
|
446
527
|
redirect: z__default.ZodOptional<z__default.ZodObject<{
|
|
447
528
|
successURL: z__default.ZodOptional<z__default.ZodString>;
|
|
@@ -454,8 +535,14 @@ declare namespace Bitsnap {
|
|
|
454
535
|
* Adds a product or variant to the cart. Returns an `Err` instead of adding
|
|
455
536
|
* anything when the backend does not know the id
|
|
456
537
|
* (`item-ids-not-found`, with the unknown ids in `data`).
|
|
538
|
+
*
|
|
539
|
+
* `args.url` is the product page: the cart links the item's image and name
|
|
540
|
+
* to it. A relative URL is resolved against the current page; only `http`
|
|
541
|
+
* and `https` links are kept.
|
|
457
542
|
*/
|
|
458
543
|
function addProductToCart(id: string, quantity?: number, metadata?: Record<string, string | undefined>, args?: {
|
|
544
|
+
/** Product page the cart item links to. */
|
|
545
|
+
url?: string;
|
|
459
546
|
name?: string;
|
|
460
547
|
price?: number;
|
|
461
548
|
currency?: string;
|
|
@@ -465,7 +552,15 @@ declare namespace Bitsnap {
|
|
|
465
552
|
function showCart(): void;
|
|
466
553
|
function hideCart(): void;
|
|
467
554
|
}
|
|
555
|
+
/**
|
|
556
|
+
* Whether the buyer may choose between paying online and paying the seller by
|
|
557
|
+
* transfer / BLIK to a phone number, for the cart `/buy` would get. `null`
|
|
558
|
+
* means nothing to choose, also when the request fails.
|
|
559
|
+
*/
|
|
560
|
+
declare function getPaymentMethodChoice(request: LinkRequest): Promise<PaymentMethodChoice | null>;
|
|
468
561
|
declare function createPaymentURL(request: LinkRequest): Promise<Err | {
|
|
562
|
+
projectId?: string | undefined;
|
|
563
|
+
orderId?: string | undefined;
|
|
469
564
|
url: string;
|
|
470
565
|
}>;
|
|
471
566
|
/**
|
|
@@ -548,4 +643,4 @@ declare function persistReturnURL(returnURL: string | null): void;
|
|
|
548
643
|
declare function readPersistedReturnURL(): string | null;
|
|
549
644
|
declare function buildAccessTokenRedirect(returnURL: string, accessToken: string): string;
|
|
550
645
|
|
|
551
|
-
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, PanelProps, PanelProvider, type PublicNotificationGroup, PublicOrderPage, buildAccessTokenRedirect, createCheckout, createPaymentURL, getAllowedReturnOrigins, getLocale, getPanelConfig, getReferenceIfPossible, getReturnURLFromSearch, injectReferenceToRequestIfNeeded, persistReturnURL, readPersistedReturnURL, setAllowedReturnOrigins, setCustomHost, setHost, setLocale, setLoginURL, setPanelConfig, setProjectID as setPanelProjectID, setProjectID$1 as setProjectID, setTheme, usePanelConfig };
|
|
646
|
+
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, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -28,6 +28,8 @@ type Props$3 = {
|
|
|
28
28
|
name: string;
|
|
29
29
|
id: string;
|
|
30
30
|
price: number;
|
|
31
|
+
/** Currency of `price` (minor units); defaults to PLN. */
|
|
32
|
+
currency?: string;
|
|
31
33
|
quantity: number;
|
|
32
34
|
isDeliverable?: boolean;
|
|
33
35
|
metadata?: {
|
|
@@ -95,7 +97,7 @@ type CheckoutAppearanceTokens = {
|
|
|
95
97
|
* Stable slot names. They are exposed as `data-bitsnap-checkout-slot`
|
|
96
98
|
* attributes so they can also be targeted from plain CSS.
|
|
97
99
|
*/
|
|
98
|
-
declare const CHECKOUT_SLOT_NAMES: readonly ["root", "overlay", "panel", "header", "title", "closeButton", "productList", "product", "productImage", "productName", "productPrice", "quantityControl", "quantityInput", "quantityButton", "removeButton", "summary", "totalLabel", "totalValue", "deliveryText", "countryLabel", "countryTrigger", "countryDropdown", "countrySearch", "countryOption", "paymentButtons", "checkoutButton", "emptyState", "error", "skeleton"];
|
|
100
|
+
declare const CHECKOUT_SLOT_NAMES: readonly ["root", "overlay", "panel", "header", "title", "closeButton", "productList", "product", "productImage", "productName", "productPrice", "quantityControl", "quantityInput", "quantityButton", "removeButton", "summary", "totalLabel", "totalValue", "deliveryText", "summaryNote", "countryLabel", "countryTrigger", "countryDropdown", "countrySearch", "countryOption", "paymentButtons", "paymentMethods", "paymentMethodOption", "checkoutButton", "emptyState", "error", "skeleton"];
|
|
99
101
|
type CheckoutSlotName = (typeof CHECKOUT_SLOT_NAMES)[number];
|
|
100
102
|
type CheckoutSlotAppearance = SlotAppearance;
|
|
101
103
|
type CheckoutAppearanceElements = AppearanceElements<CheckoutSlotName>;
|
|
@@ -145,6 +147,60 @@ type CheckoutTexts = {
|
|
|
145
147
|
currencyUnsupported: string;
|
|
146
148
|
/** Error shown when a price changed after the product was added. */
|
|
147
149
|
priceChanged: string;
|
|
150
|
+
/** Accessible name of the close button of the drawer. */
|
|
151
|
+
close: string;
|
|
152
|
+
/** Remove button of a cart line (also read together with the product name). */
|
|
153
|
+
remove: string;
|
|
154
|
+
/** Accessible name of the quantity control and its input. */
|
|
155
|
+
quantity: string;
|
|
156
|
+
/** Accessible name of the "+" quantity button. */
|
|
157
|
+
increaseQuantity: string;
|
|
158
|
+
/** Accessible name of the "-" quantity button. */
|
|
159
|
+
decreaseQuantity: string;
|
|
160
|
+
/** Accessible name of the cart button when it only shows an icon. */
|
|
161
|
+
openCart: string;
|
|
162
|
+
/** Hidden label of the number of products badge; the number is appended after a colon. */
|
|
163
|
+
cartItemsCount: string;
|
|
164
|
+
/** Label before the lowest price of the last 30 days; the price is appended. */
|
|
165
|
+
lowestPrice30Days: string;
|
|
166
|
+
/** Shown instead of the lowest price when the price has no history. */
|
|
167
|
+
noPriceHistory: string;
|
|
168
|
+
/** Error shown when redirecting to the payment failed. */
|
|
169
|
+
redirectFailed: string;
|
|
170
|
+
/** Error shown when a subscription is added to the cart. */
|
|
171
|
+
subscriptionUnsupported: string;
|
|
172
|
+
/** Country search placeholder. */
|
|
173
|
+
searchCountry: string;
|
|
174
|
+
/** Shown when the country search has no match. */
|
|
175
|
+
noCountriesFound: string;
|
|
176
|
+
/** Hint under the checkout button when no country is chosen. */
|
|
177
|
+
countryRequired: string;
|
|
178
|
+
/** Title of the Apple Pay and Google Pay sheet total. */
|
|
179
|
+
paymentForCart: string;
|
|
180
|
+
/** Coupon label in the Google Pay sheet; the code is appended. */
|
|
181
|
+
coupon: string;
|
|
182
|
+
/** Note under the cart total. */
|
|
183
|
+
extrasCalculatedNext: string;
|
|
184
|
+
/** Error shown when the products of the cart could not be loaded. */
|
|
185
|
+
loadFailed: string;
|
|
186
|
+
/** Button that loads the cart again. */
|
|
187
|
+
retry: string;
|
|
188
|
+
/** Heading of the payment method choice (shown only when the shop offers paying by hand). */
|
|
189
|
+
paymentMethodLegend: string;
|
|
190
|
+
/** Option that pays through the shop's online gateway. */
|
|
191
|
+
paymentMethodOnline: string;
|
|
192
|
+
/** Hint under the online option. */
|
|
193
|
+
paymentMethodOnlineDescription: string;
|
|
194
|
+
/** Manual option when the seller takes bank transfers only. */
|
|
195
|
+
paymentMethodManualTransfer: string;
|
|
196
|
+
/** Manual option when the seller takes BLIK transfers to a phone number only. */
|
|
197
|
+
paymentMethodManualBlik: string;
|
|
198
|
+
/** Manual option when the seller takes both. */
|
|
199
|
+
paymentMethodManualBoth: string;
|
|
200
|
+
/** What paying by hand means: the details come after the order is placed. */
|
|
201
|
+
paymentMethodManualDescription: string;
|
|
202
|
+
/** Shown with a selected manual option that includes BLIK to a phone number. */
|
|
203
|
+
paymentMethodManualBlikNote: string;
|
|
148
204
|
};
|
|
149
205
|
|
|
150
206
|
type BitsnapCartProps = {
|
|
@@ -358,6 +414,27 @@ type Err = {
|
|
|
358
414
|
};
|
|
359
415
|
declare function Err(message: string, type?: ErrTypes, data?: unknown): Err;
|
|
360
416
|
|
|
417
|
+
/**
|
|
418
|
+
* The buyer's choice between paying online and paying the seller by hand
|
|
419
|
+
* (bank transfer or "BLIK przelew na telefon"), offered when the seller turned
|
|
420
|
+
* on "show at checkout" for the manual payment gateway.
|
|
421
|
+
*
|
|
422
|
+
* `POST /public-commerce/payment-methods` takes the body of `/buy` and answers
|
|
423
|
+
* `{ success: true, choice: null }` (nothing to choose) or
|
|
424
|
+
* `{ success: true, choice: { methods, manualAccountTypes } }`. The pick goes
|
|
425
|
+
* to `/buy` as `paymentMethod`. Anything else (an old backend, an error, a
|
|
426
|
+
* timeout) counts as "nothing to choose", so the cart buys as before.
|
|
427
|
+
*/
|
|
428
|
+
|
|
429
|
+
type PaymentMethod = "online" | "manual";
|
|
430
|
+
type ManualAccountType = "bankTransfer" | "blik";
|
|
431
|
+
type PaymentMethodChoice = {
|
|
432
|
+
/** In the seller's order; the first one is selected by default. */
|
|
433
|
+
methods: PaymentMethod[];
|
|
434
|
+
/** How the manual option is paid; decides its label. */
|
|
435
|
+
manualAccountTypes: ManualAccountType[];
|
|
436
|
+
};
|
|
437
|
+
|
|
361
438
|
declare function setLocale(locale?: string): void;
|
|
362
439
|
declare function getLocale(): string;
|
|
363
440
|
|
|
@@ -442,6 +519,10 @@ declare const linkRequestSchema: z__default.ZodObject<{
|
|
|
442
519
|
answer: z__default.ZodOptional<z__default.ZodBoolean>;
|
|
443
520
|
}, z__default.core.$strip>>>;
|
|
444
521
|
blikCode: z__default.ZodOptional<z__default.ZodString>;
|
|
522
|
+
paymentMethod: z__default.ZodOptional<z__default.ZodEnum<{
|
|
523
|
+
online: "online";
|
|
524
|
+
manual: "manual";
|
|
525
|
+
}>>;
|
|
445
526
|
couponCode: z__default.ZodOptional<z__default.ZodString>;
|
|
446
527
|
redirect: z__default.ZodOptional<z__default.ZodObject<{
|
|
447
528
|
successURL: z__default.ZodOptional<z__default.ZodString>;
|
|
@@ -454,8 +535,14 @@ declare namespace Bitsnap {
|
|
|
454
535
|
* Adds a product or variant to the cart. Returns an `Err` instead of adding
|
|
455
536
|
* anything when the backend does not know the id
|
|
456
537
|
* (`item-ids-not-found`, with the unknown ids in `data`).
|
|
538
|
+
*
|
|
539
|
+
* `args.url` is the product page: the cart links the item's image and name
|
|
540
|
+
* to it. A relative URL is resolved against the current page; only `http`
|
|
541
|
+
* and `https` links are kept.
|
|
457
542
|
*/
|
|
458
543
|
function addProductToCart(id: string, quantity?: number, metadata?: Record<string, string | undefined>, args?: {
|
|
544
|
+
/** Product page the cart item links to. */
|
|
545
|
+
url?: string;
|
|
459
546
|
name?: string;
|
|
460
547
|
price?: number;
|
|
461
548
|
currency?: string;
|
|
@@ -465,7 +552,15 @@ declare namespace Bitsnap {
|
|
|
465
552
|
function showCart(): void;
|
|
466
553
|
function hideCart(): void;
|
|
467
554
|
}
|
|
555
|
+
/**
|
|
556
|
+
* Whether the buyer may choose between paying online and paying the seller by
|
|
557
|
+
* transfer / BLIK to a phone number, for the cart `/buy` would get. `null`
|
|
558
|
+
* means nothing to choose, also when the request fails.
|
|
559
|
+
*/
|
|
560
|
+
declare function getPaymentMethodChoice(request: LinkRequest): Promise<PaymentMethodChoice | null>;
|
|
468
561
|
declare function createPaymentURL(request: LinkRequest): Promise<Err | {
|
|
562
|
+
projectId?: string | undefined;
|
|
563
|
+
orderId?: string | undefined;
|
|
469
564
|
url: string;
|
|
470
565
|
}>;
|
|
471
566
|
/**
|
|
@@ -548,4 +643,4 @@ declare function persistReturnURL(returnURL: string | null): void;
|
|
|
548
643
|
declare function readPersistedReturnURL(): string | null;
|
|
549
644
|
declare function buildAccessTokenRedirect(returnURL: string, accessToken: string): string;
|
|
550
645
|
|
|
551
|
-
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, PanelProps, PanelProvider, type PublicNotificationGroup, PublicOrderPage, buildAccessTokenRedirect, createCheckout, createPaymentURL, getAllowedReturnOrigins, getLocale, getPanelConfig, getReferenceIfPossible, getReturnURLFromSearch, injectReferenceToRequestIfNeeded, persistReturnURL, readPersistedReturnURL, setAllowedReturnOrigins, setCustomHost, setHost, setLocale, setLoginURL, setPanelConfig, setProjectID as setPanelProjectID, setProjectID$1 as setProjectID, setTheme, usePanelConfig };
|
|
646
|
+
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, 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 };
|