bitsnap-react 1.12.0 → 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.
Files changed (90) hide show
  1. package/README.md +27 -3
  2. package/dist/CartProvider-WPJWECBS.mjs +2 -0
  3. package/dist/CartProvider-YPZ3HD7W.js +2 -0
  4. package/dist/CartProvider-YPZ3HD7W.js.map +1 -0
  5. package/dist/analytics.js +1 -1
  6. package/dist/analytics.js.map +1 -1
  7. package/dist/analytics.mjs +1 -1
  8. package/dist/catalog.js +1 -1
  9. package/dist/catalog.js.map +1 -1
  10. package/dist/catalog.mjs +1 -1
  11. package/dist/{chunk-XTIY6PXH.js → chunk-3ITTSNWG.js} +2 -2
  12. package/dist/chunk-3ITTSNWG.js.map +1 -0
  13. package/dist/chunk-4BV5IUZH.js +2 -0
  14. package/dist/chunk-4BV5IUZH.js.map +1 -0
  15. package/dist/{chunk-6IACFTJR.js → chunk-4ZFIL5S7.js} +2 -2
  16. package/dist/chunk-4ZFIL5S7.js.map +1 -0
  17. package/dist/{chunk-E5DCEFI2.mjs → chunk-DRAKVCD7.mjs} +2 -2
  18. package/dist/{chunk-5R3WR22A.mjs → chunk-G3VVAVG7.mjs} +2 -2
  19. package/dist/chunk-GJNFDUJN.mjs +4 -0
  20. package/dist/chunk-GJNFDUJN.mjs.map +1 -0
  21. package/dist/{chunk-3QG7H2AI.mjs → chunk-HBPSSGYN.mjs} +2 -2
  22. package/dist/{chunk-DF2IK2GN.js → chunk-HDLCLZOK.js} +2 -2
  23. package/dist/chunk-HDLCLZOK.js.map +1 -0
  24. package/dist/{chunk-DGUIG334.js → chunk-I6BRDRPB.js} +2 -2
  25. package/dist/chunk-I6BRDRPB.js.map +1 -0
  26. package/dist/chunk-JSDGZ4NY.js.map +1 -1
  27. package/dist/chunk-KOYBZORL.js.map +1 -1
  28. package/dist/{chunk-ICFYSZTV.js → chunk-MZSLLGFS.js} +2 -2
  29. package/dist/chunk-MZSLLGFS.js.map +1 -0
  30. package/dist/{chunk-MLSKHOA3.js → chunk-STVEBT6M.js} +2 -2
  31. package/dist/chunk-STVEBT6M.js.map +1 -0
  32. package/dist/{chunk-FF2ICGFQ.mjs → chunk-T2YSOHJM.mjs} +2 -2
  33. package/dist/{chunk-FF2ICGFQ.mjs.map → chunk-T2YSOHJM.mjs.map} +1 -1
  34. package/dist/chunk-T3PAOMHI.mjs +2 -0
  35. package/dist/chunk-T3PAOMHI.mjs.map +1 -0
  36. package/dist/{chunk-QSIKRVZL.mjs → chunk-VDLJW4JJ.mjs} +2 -2
  37. package/dist/{chunk-UCESDAEC.mjs → chunk-VF62KDNS.mjs} +2 -2
  38. package/dist/chunk-VRL3IF5J.js +4 -0
  39. package/dist/chunk-VRL3IF5J.js.map +1 -0
  40. package/dist/chunk-XIHGWNTS.js.map +1 -1
  41. package/dist/consent.js.map +1 -1
  42. package/dist/course.js +1 -1
  43. package/dist/course.js.map +1 -1
  44. package/dist/course.mjs +1 -1
  45. package/dist/embed/analytics.js +1 -1
  46. package/dist/errors.js.map +1 -1
  47. package/dist/index.css +1 -1
  48. package/dist/index.css.map +1 -1
  49. package/dist/index.d.mts +49 -2
  50. package/dist/index.d.ts +49 -2
  51. package/dist/index.js +1 -1
  52. package/dist/index.js.map +1 -1
  53. package/dist/index.mjs +1 -1
  54. package/dist/index.mjs.map +1 -1
  55. package/dist/internal.js.map +1 -1
  56. package/dist/methods-FVDH6Y57.mjs +2 -0
  57. package/dist/methods-ISVX5JQ7.js +2 -0
  58. package/dist/methods-ISVX5JQ7.js.map +1 -0
  59. package/dist/models.js.map +1 -1
  60. package/dist/returns.js +1 -1
  61. package/dist/returns.js.map +1 -1
  62. package/dist/returns.mjs +1 -1
  63. package/package.json +26 -51
  64. package/dist/CartProvider-XNFSUOCB.js +0 -2
  65. package/dist/CartProvider-XNFSUOCB.js.map +0 -1
  66. package/dist/CartProvider-YMJ7RFO4.mjs +0 -2
  67. package/dist/chunk-4BW6J7FP.js +0 -4
  68. package/dist/chunk-4BW6J7FP.js.map +0 -1
  69. package/dist/chunk-6IACFTJR.js.map +0 -1
  70. package/dist/chunk-DF2IK2GN.js.map +0 -1
  71. package/dist/chunk-DGUIG334.js.map +0 -1
  72. package/dist/chunk-ERL4Z7M7.js +0 -2
  73. package/dist/chunk-ERL4Z7M7.js.map +0 -1
  74. package/dist/chunk-ICFYSZTV.js.map +0 -1
  75. package/dist/chunk-MLSKHOA3.js.map +0 -1
  76. package/dist/chunk-P4Q5KXKS.mjs +0 -2
  77. package/dist/chunk-P4Q5KXKS.mjs.map +0 -1
  78. package/dist/chunk-PNTO3L2C.mjs +0 -4
  79. package/dist/chunk-PNTO3L2C.mjs.map +0 -1
  80. package/dist/chunk-XTIY6PXH.js.map +0 -1
  81. package/dist/methods-DDGOXLP6.mjs +0 -2
  82. package/dist/methods-RQPDIUUN.js +0 -2
  83. package/dist/methods-RQPDIUUN.js.map +0 -1
  84. /package/dist/{CartProvider-YMJ7RFO4.mjs.map → CartProvider-WPJWECBS.mjs.map} +0 -0
  85. /package/dist/{chunk-E5DCEFI2.mjs.map → chunk-DRAKVCD7.mjs.map} +0 -0
  86. /package/dist/{chunk-5R3WR22A.mjs.map → chunk-G3VVAVG7.mjs.map} +0 -0
  87. /package/dist/{chunk-3QG7H2AI.mjs.map → chunk-HBPSSGYN.mjs.map} +0 -0
  88. /package/dist/{chunk-QSIKRVZL.mjs.map → chunk-VDLJW4JJ.mjs.map} +0 -0
  89. /package/dist/{chunk-UCESDAEC.mjs.map → chunk-VF62KDNS.mjs.map} +0 -0
  90. /package/dist/{methods-DDGOXLP6.mjs.map → methods-FVDH6Y57.mjs.map} +0 -0
package/dist/index.d.mts CHANGED
@@ -97,7 +97,7 @@ type CheckoutAppearanceTokens = {
97
97
  * Stable slot names. They are exposed as `data-bitsnap-checkout-slot`
98
98
  * attributes so they can also be targeted from plain CSS.
99
99
  */
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", "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"];
101
101
  type CheckoutSlotName = (typeof CHECKOUT_SLOT_NAMES)[number];
102
102
  type CheckoutSlotAppearance = SlotAppearance;
103
103
  type CheckoutAppearanceElements = AppearanceElements<CheckoutSlotName>;
@@ -185,6 +185,22 @@ type CheckoutTexts = {
185
185
  loadFailed: string;
186
186
  /** Button that loads the cart again. */
187
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;
188
204
  };
189
205
 
190
206
  type BitsnapCartProps = {
@@ -398,6 +414,27 @@ type Err = {
398
414
  };
399
415
  declare function Err(message: string, type?: ErrTypes, data?: unknown): Err;
400
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
+
401
438
  declare function setLocale(locale?: string): void;
402
439
  declare function getLocale(): string;
403
440
 
@@ -482,6 +519,10 @@ declare const linkRequestSchema: z__default.ZodObject<{
482
519
  answer: z__default.ZodOptional<z__default.ZodBoolean>;
483
520
  }, z__default.core.$strip>>>;
484
521
  blikCode: z__default.ZodOptional<z__default.ZodString>;
522
+ paymentMethod: z__default.ZodOptional<z__default.ZodEnum<{
523
+ online: "online";
524
+ manual: "manual";
525
+ }>>;
485
526
  couponCode: z__default.ZodOptional<z__default.ZodString>;
486
527
  redirect: z__default.ZodOptional<z__default.ZodObject<{
487
528
  successURL: z__default.ZodOptional<z__default.ZodString>;
@@ -511,6 +552,12 @@ declare namespace Bitsnap {
511
552
  function showCart(): void;
512
553
  function hideCart(): void;
513
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>;
514
561
  declare function createPaymentURL(request: LinkRequest): Promise<Err | {
515
562
  projectId?: string | undefined;
516
563
  orderId?: string | undefined;
@@ -596,4 +643,4 @@ declare function persistReturnURL(returnURL: string | null): void;
596
643
  declare function readPersistedReturnURL(): string | null;
597
644
  declare function buildAccessTokenRedirect(returnURL: string, accessToken: string): string;
598
645
 
599
- 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
@@ -97,7 +97,7 @@ type CheckoutAppearanceTokens = {
97
97
  * Stable slot names. They are exposed as `data-bitsnap-checkout-slot`
98
98
  * attributes so they can also be targeted from plain CSS.
99
99
  */
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", "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"];
101
101
  type CheckoutSlotName = (typeof CHECKOUT_SLOT_NAMES)[number];
102
102
  type CheckoutSlotAppearance = SlotAppearance;
103
103
  type CheckoutAppearanceElements = AppearanceElements<CheckoutSlotName>;
@@ -185,6 +185,22 @@ type CheckoutTexts = {
185
185
  loadFailed: string;
186
186
  /** Button that loads the cart again. */
187
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;
188
204
  };
189
205
 
190
206
  type BitsnapCartProps = {
@@ -398,6 +414,27 @@ type Err = {
398
414
  };
399
415
  declare function Err(message: string, type?: ErrTypes, data?: unknown): Err;
400
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
+
401
438
  declare function setLocale(locale?: string): void;
402
439
  declare function getLocale(): string;
403
440
 
@@ -482,6 +519,10 @@ declare const linkRequestSchema: z__default.ZodObject<{
482
519
  answer: z__default.ZodOptional<z__default.ZodBoolean>;
483
520
  }, z__default.core.$strip>>>;
484
521
  blikCode: z__default.ZodOptional<z__default.ZodString>;
522
+ paymentMethod: z__default.ZodOptional<z__default.ZodEnum<{
523
+ online: "online";
524
+ manual: "manual";
525
+ }>>;
485
526
  couponCode: z__default.ZodOptional<z__default.ZodString>;
486
527
  redirect: z__default.ZodOptional<z__default.ZodObject<{
487
528
  successURL: z__default.ZodOptional<z__default.ZodString>;
@@ -511,6 +552,12 @@ declare namespace Bitsnap {
511
552
  function showCart(): void;
512
553
  function hideCart(): void;
513
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>;
514
561
  declare function createPaymentURL(request: LinkRequest): Promise<Err | {
515
562
  projectId?: string | undefined;
516
563
  orderId?: string | undefined;
@@ -596,4 +643,4 @@ declare function persistReturnURL(returnURL: string | null): void;
596
643
  declare function readPersistedReturnURL(): string | null;
597
644
  declare function buildAccessTokenRedirect(returnURL: string, accessToken: string): string;
598
645
 
599
- 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 };