@xpayeg/react 2.2.0 → 2.4.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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @xpayeg/react
2
2
 
3
+ ## 2.4.0
4
+ ### Minor Changes
5
+
6
+
7
+
8
+ - [#474](https://github.com/xpayeg/xpay/pull/474) [`c45243c`](https://github.com/xpayeg/xpay/commit/c45243c970b71944482352baea8e8047ba746d8b) Thanks [@Elmosh](https://github.com/Elmosh)! - The Payment Element's `layout` option now works: `elements.create("payment", { layout })`, or the `options` prop on `<PaymentElement />`. `"accordion"` (default) is the vertical list; `"tabs"` is a wrapping tile grid with the selected method's form below it. With exactly one payment method the chooser chrome collapses: the accordion shows a static logo-and-name header above the content (card keeps its bare form), and tabs render the content alone with no logo or title, for pages whose own UI already shows the method's identity, such as a per-gateway row paired with `paymentMethodTypes: ["<type>"]`. Layout is updatable after creation via `element.update({ layout })`, and every method's form stays mounted across switches so typed card details survive.
9
+
10
+ ## 2.3.0
11
+ ### Minor Changes
12
+
13
+
14
+
15
+ - [#471](https://github.com/xpayeg/xpay/pull/471) [`e76a6c3`](https://github.com/xpayeg/xpay/commit/e76a6c3e5f73f4dcf1f108b6be0e1a63dce5d1b9) Thanks [@Elmosh](https://github.com/Elmosh)! - Deferred Elements accept `paymentMethodTypes` (e.g. `["card"]`) to restrict which payment methods the element renders. Narrow-only: the list is intersected with the methods enabled for your account, so a type you have not enabled is never rendered, and an empty intersection fails with `loaderror` instead of rendering an empty frame. Fixed for the element's lifetime; pass the same values when your server creates the session so display and acceptance match. One method per element is the pattern for per-method rows in your own selector.
16
+
3
17
  ## 2.2.0
4
18
  ### Minor Changes
5
19
 
package/dist/index.cjs CHANGED
@@ -84,9 +84,11 @@ function XPayProvider({ xpay: xpayProp, options, children }) {
84
84
  const prev = lastDeferredRef.current;
85
85
  lastDeferredRef.current = {
86
86
  amount: options.amount,
87
- currency: options.currency
87
+ currency: options.currency,
88
+ paymentMethodTypes: options.paymentMethodTypes
88
89
  };
89
90
  if (!prev) return;
91
+ if (JSON.stringify(prev.paymentMethodTypes ?? null) !== JSON.stringify(options.paymentMethodTypes ?? null)) console.warn("Unsupported prop change: options.paymentMethodTypes is fixed for the element's lifetime. Remount <XPayProvider> (e.g. with a React key) to change it.");
90
92
  const updates = {};
91
93
  if (options.amount !== prev.amount) updates.amount = options.amount;
92
94
  if (options.currency !== prev.currency) updates.currency = options.currency;
package/dist/index.mjs CHANGED
@@ -83,9 +83,11 @@ function XPayProvider({ xpay: xpayProp, options, children }) {
83
83
  const prev = lastDeferredRef.current;
84
84
  lastDeferredRef.current = {
85
85
  amount: options.amount,
86
- currency: options.currency
86
+ currency: options.currency,
87
+ paymentMethodTypes: options.paymentMethodTypes
87
88
  };
88
89
  if (!prev) return;
90
+ if (JSON.stringify(prev.paymentMethodTypes ?? null) !== JSON.stringify(options.paymentMethodTypes ?? null)) console.warn("Unsupported prop change: options.paymentMethodTypes is fixed for the element's lifetime. Remount <XPayProvider> (e.g. with a React key) to change it.");
89
91
  const updates = {};
90
92
  if (options.amount !== prev.amount) updates.amount = options.amount;
91
93
  if (options.currency !== prev.currency) updates.currency = options.currency;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xpayeg/react",
3
- "version": "2.2.0",
3
+ "version": "2.4.0",
4
4
  "description": "XPay React components — PaymentElement, CheckoutButton, and hooks",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -50,7 +50,7 @@
50
50
  "tsdown": "^0.22.0",
51
51
  "typescript": "5.9.3",
52
52
  "@xpay/tsconfig": "0.0.0",
53
- "@xpayeg/sdk": "2.2.0"
53
+ "@xpayeg/sdk": "2.4.0"
54
54
  },
55
55
  "repository": {
56
56
  "type": "git",