bitsnap-react 1.11.0 → 1.12.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.
Files changed (77) hide show
  1. package/README.md +10 -4
  2. package/dist/CartProvider-XNFSUOCB.js +2 -0
  3. package/dist/CartProvider-XNFSUOCB.js.map +1 -0
  4. package/dist/CartProvider-YMJ7RFO4.mjs +2 -0
  5. package/dist/analytics.js +1 -1
  6. package/dist/analytics.mjs +1 -1
  7. package/dist/catalog.js +1 -1
  8. package/dist/catalog.mjs +1 -1
  9. package/dist/{chunk-C5RMHUOG.mjs → chunk-3QG7H2AI.mjs} +2 -2
  10. package/dist/chunk-4BW6J7FP.js +4 -0
  11. package/dist/{chunk-CUQ2PNCJ.js.map → chunk-4BW6J7FP.js.map} +1 -1
  12. package/dist/{chunk-H3YP2QPV.mjs → chunk-5R3WR22A.mjs} +2 -2
  13. package/dist/{chunk-ASNUY3EU.js → chunk-6IACFTJR.js} +2 -2
  14. package/dist/{chunk-ASNUY3EU.js.map → chunk-6IACFTJR.js.map} +1 -1
  15. package/dist/{chunk-GT3OH55Y.js → chunk-DF2IK2GN.js} +2 -2
  16. package/dist/{chunk-GT3OH55Y.js.map → chunk-DF2IK2GN.js.map} +1 -1
  17. package/dist/{chunk-VQQBBSK2.js → chunk-DGUIG334.js} +2 -2
  18. package/dist/{chunk-VQQBBSK2.js.map → chunk-DGUIG334.js.map} +1 -1
  19. package/dist/{chunk-XQ43IC4M.mjs → chunk-E5DCEFI2.mjs} +2 -2
  20. package/dist/chunk-ERL4Z7M7.js +2 -0
  21. package/dist/{chunk-7RGH57QG.js.map → chunk-ERL4Z7M7.js.map} +1 -1
  22. package/dist/{chunk-T57337WD.mjs → chunk-FF2ICGFQ.mjs} +2 -2
  23. package/dist/{chunk-T57337WD.mjs.map → chunk-FF2ICGFQ.mjs.map} +1 -1
  24. package/dist/{chunk-ELGNOAH4.js → chunk-ICFYSZTV.js} +2 -2
  25. package/dist/{chunk-ELGNOAH4.js.map → chunk-ICFYSZTV.js.map} +1 -1
  26. package/dist/{chunk-YFETPEI6.js → chunk-MLSKHOA3.js} +2 -2
  27. package/dist/{chunk-YFETPEI6.js.map → chunk-MLSKHOA3.js.map} +1 -1
  28. package/dist/chunk-P4Q5KXKS.mjs +2 -0
  29. package/dist/{chunk-EZWH6BB2.mjs.map → chunk-P4Q5KXKS.mjs.map} +1 -1
  30. package/dist/chunk-PNTO3L2C.mjs +4 -0
  31. package/dist/chunk-PNTO3L2C.mjs.map +1 -0
  32. package/dist/chunk-QSIKRVZL.mjs +2 -0
  33. package/dist/chunk-QSIKRVZL.mjs.map +1 -0
  34. package/dist/{chunk-C5Q7DGCD.mjs → chunk-UCESDAEC.mjs} +2 -2
  35. package/dist/chunk-XTIY6PXH.js +2 -0
  36. package/dist/{chunk-PUYK4YHE.js.map → chunk-XTIY6PXH.js.map} +1 -1
  37. package/dist/consent.js +15 -14
  38. package/dist/consent.js.map +1 -1
  39. package/dist/consent.mjs +15 -14
  40. package/dist/consent.mjs.map +1 -1
  41. package/dist/course.js +1 -1
  42. package/dist/course.mjs +1 -1
  43. package/dist/embed/analytics.js +1 -1
  44. package/dist/embed/consent.js +11 -10
  45. package/dist/index.css +1 -1
  46. package/dist/index.css.map +1 -1
  47. package/dist/index.d.mts +49 -1
  48. package/dist/index.d.ts +49 -1
  49. package/dist/index.js +1 -1
  50. package/dist/index.js.map +1 -1
  51. package/dist/index.mjs +1 -1
  52. package/dist/index.mjs.map +1 -1
  53. package/dist/methods-DDGOXLP6.mjs +2 -0
  54. package/dist/methods-RQPDIUUN.js +2 -0
  55. package/dist/{methods-CHNMFVFV.js.map → methods-RQPDIUUN.js.map} +1 -1
  56. package/dist/returns.js +1 -1
  57. package/dist/returns.mjs +1 -1
  58. package/package.json +51 -26
  59. package/dist/CartProvider-ONIOELW5.mjs +0 -2
  60. package/dist/CartProvider-Q3CIVK5K.js +0 -2
  61. package/dist/CartProvider-Q3CIVK5K.js.map +0 -1
  62. package/dist/chunk-7RGH57QG.js +0 -2
  63. package/dist/chunk-CUQ2PNCJ.js +0 -4
  64. package/dist/chunk-EZWH6BB2.mjs +0 -2
  65. package/dist/chunk-GPNALARZ.mjs +0 -2
  66. package/dist/chunk-GPNALARZ.mjs.map +0 -1
  67. package/dist/chunk-HG4YOJWE.mjs +0 -4
  68. package/dist/chunk-HG4YOJWE.mjs.map +0 -1
  69. package/dist/chunk-PUYK4YHE.js +0 -2
  70. package/dist/methods-C5HWYPPN.mjs +0 -2
  71. package/dist/methods-CHNMFVFV.js +0 -2
  72. /package/dist/{CartProvider-ONIOELW5.mjs.map → CartProvider-YMJ7RFO4.mjs.map} +0 -0
  73. /package/dist/{chunk-C5RMHUOG.mjs.map → chunk-3QG7H2AI.mjs.map} +0 -0
  74. /package/dist/{chunk-H3YP2QPV.mjs.map → chunk-5R3WR22A.mjs.map} +0 -0
  75. /package/dist/{chunk-XQ43IC4M.mjs.map → chunk-E5DCEFI2.mjs.map} +0 -0
  76. /package/dist/{chunk-C5Q7DGCD.mjs.map → chunk-UCESDAEC.mjs.map} +0 -0
  77. /package/dist/{methods-C5HWYPPN.mjs.map → methods-DDGOXLP6.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", "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,44 @@ 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;
148
188
  };
149
189
 
150
190
  type BitsnapCartProps = {
@@ -454,8 +494,14 @@ declare namespace Bitsnap {
454
494
  * Adds a product or variant to the cart. Returns an `Err` instead of adding
455
495
  * anything when the backend does not know the id
456
496
  * (`item-ids-not-found`, with the unknown ids in `data`).
497
+ *
498
+ * `args.url` is the product page: the cart links the item's image and name
499
+ * to it. A relative URL is resolved against the current page; only `http`
500
+ * and `https` links are kept.
457
501
  */
458
502
  function addProductToCart(id: string, quantity?: number, metadata?: Record<string, string | undefined>, args?: {
503
+ /** Product page the cart item links to. */
504
+ url?: string;
459
505
  name?: string;
460
506
  price?: number;
461
507
  currency?: string;
@@ -466,6 +512,8 @@ declare namespace Bitsnap {
466
512
  function hideCart(): void;
467
513
  }
468
514
  declare function createPaymentURL(request: LinkRequest): Promise<Err | {
515
+ projectId?: string | undefined;
516
+ orderId?: string | undefined;
469
517
  url: string;
470
518
  }>;
471
519
  /**
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", "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,44 @@ 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;
148
188
  };
149
189
 
150
190
  type BitsnapCartProps = {
@@ -454,8 +494,14 @@ declare namespace Bitsnap {
454
494
  * Adds a product or variant to the cart. Returns an `Err` instead of adding
455
495
  * anything when the backend does not know the id
456
496
  * (`item-ids-not-found`, with the unknown ids in `data`).
497
+ *
498
+ * `args.url` is the product page: the cart links the item's image and name
499
+ * to it. A relative URL is resolved against the current page; only `http`
500
+ * and `https` links are kept.
457
501
  */
458
502
  function addProductToCart(id: string, quantity?: number, metadata?: Record<string, string | undefined>, args?: {
503
+ /** Product page the cart item links to. */
504
+ url?: string;
459
505
  name?: string;
460
506
  price?: number;
461
507
  currency?: string;
@@ -466,6 +512,8 @@ declare namespace Bitsnap {
466
512
  function hideCart(): void;
467
513
  }
468
514
  declare function createPaymentURL(request: LinkRequest): Promise<Err | {
515
+ projectId?: string | undefined;
516
+ orderId?: string | undefined;
469
517
  url: string;
470
518
  }>;
471
519
  /**