@xpayeg/react 2.4.0 → 3.0.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/{dist → .types}/index.d.cts +71 -80
- package/{dist → .types}/index.d.mts +71 -80
- package/CHANGELOG.md +36 -30
- package/README.md +139 -137
- package/dist/index.cjs +19 -47
- package/dist/index.mjs +19 -47
- package/package.json +11 -28
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import * as _xpayeg_sdk from '@xpayeg/sdk';
|
|
4
|
-
import { CheckoutSession, CheckoutActions, XPayInstance, ElementsOptions, Elements, PaymentElementOptions, PaymentElementChangeEvent, CheckoutOptions } from '@xpayeg/sdk';
|
|
5
|
-
export { ActionResult, Appearance, CheckoutActions, CheckoutSession, ConfirmPaymentOptions, ElementsOptions, PaymentElementChangeEvent, PaymentMethodInfo, XPayError } from '@xpayeg/sdk';
|
|
6
|
-
|
|
1
|
+
import { FC, ReactNode } from "react";
|
|
2
|
+
import { ActionResult, Appearance, CheckoutActions, CheckoutActions as CheckoutActions$1, CheckoutOptions, CheckoutSession, CheckoutSession as CheckoutSession$1, ConfirmPaymentOptions, Elements, ElementsOptions, ElementsOptions as ElementsOptions$1, PaymentElementChangeEvent, PaymentElementChangeEvent as PaymentElementChangeEvent$1, PaymentElementOptions, PaymentMethodInfo, XPayError, XPayInstance } from "@xpayeg/sdk";
|
|
7
3
|
/**
|
|
8
4
|
* The checkout object returned by `useCheckout()` on success.
|
|
9
5
|
* Merges session data with action methods for a single unified API.
|
|
@@ -18,33 +14,33 @@ export { ActionResult, Appearance, CheckoutActions, CheckoutSession, ConfirmPaym
|
|
|
18
14
|
* }
|
|
19
15
|
* ```
|
|
20
16
|
*/
|
|
21
|
-
type Checkout = CheckoutSession & CheckoutActions;
|
|
17
|
+
type Checkout = CheckoutSession$1 & CheckoutActions$1;
|
|
22
18
|
type UseCheckoutResult = {
|
|
23
|
-
|
|
19
|
+
type: "loading";
|
|
24
20
|
} | {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
type: "error";
|
|
22
|
+
error: {
|
|
23
|
+
message: string;
|
|
24
|
+
};
|
|
29
25
|
} | {
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
type: "success";
|
|
27
|
+
checkout: Checkout;
|
|
32
28
|
};
|
|
33
29
|
interface XPayProviderProps {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
30
|
+
/**
|
|
31
|
+
* XPay instance or a Promise resolving to one.
|
|
32
|
+
* Use `loadXPay()` from `@xpayeg/sdk` — call it at module level, not inside a component.
|
|
33
|
+
*/
|
|
34
|
+
xpay: XPayInstance | Promise<XPayInstance | null> | null;
|
|
35
|
+
/**
|
|
36
|
+
* Elements options — either `{ clientSecret }` (session-first) or
|
|
37
|
+
* `{ mode: "payment", amount, currency }` (deferred — the session is created
|
|
38
|
+
* by your server at confirm time). In deferred mode use `useElements()` +
|
|
39
|
+
* `<PaymentElement>`; `useCheckout()` session data reflects the display
|
|
40
|
+
* amount until a session is bound at confirm.
|
|
41
|
+
*/
|
|
42
|
+
options?: ElementsOptions$1;
|
|
43
|
+
children: ReactNode;
|
|
48
44
|
}
|
|
49
45
|
/**
|
|
50
46
|
* Provides XPay context to all child components.
|
|
@@ -70,7 +66,7 @@ interface XPayProviderProps {
|
|
|
70
66
|
* }
|
|
71
67
|
* ```
|
|
72
68
|
*/
|
|
73
|
-
declare function XPayProvider({ xpay: xpayProp, options, children }: XPayProviderProps):
|
|
69
|
+
export declare function XPayProvider({ xpay: xpayProp, options, children }: XPayProviderProps): import("react").JSX.Element;
|
|
74
70
|
/**
|
|
75
71
|
* Access the checkout state — a tagged union of `loading`, `error`, or `success`.
|
|
76
72
|
*
|
|
@@ -95,22 +91,21 @@ declare function XPayProvider({ xpay: xpayProp, options, children }: XPayProvide
|
|
|
95
91
|
* }
|
|
96
92
|
* ```
|
|
97
93
|
*/
|
|
98
|
-
declare function useCheckout(): UseCheckoutResult;
|
|
94
|
+
export declare function useCheckout(): UseCheckoutResult;
|
|
99
95
|
/**
|
|
100
96
|
* Access the raw XPay SDK instance. Returns `null` while the SDK is loading.
|
|
101
97
|
*
|
|
102
98
|
* Most merchants should use `useCheckout()` instead. Use `useXPay()` only when
|
|
103
99
|
* you need direct access to `xpay.confirmPayment()` or `xpay.checkout()`.
|
|
104
100
|
*/
|
|
105
|
-
declare function useXPay(): XPayInstance | null;
|
|
101
|
+
export declare function useXPay(): XPayInstance | null;
|
|
106
102
|
/**
|
|
107
103
|
* Access the Elements instance. Returns `null` while the session is loading.
|
|
108
104
|
*
|
|
109
105
|
* Use this for direct element management. In most cases, use `useCheckout()` instead
|
|
110
106
|
* which provides both session data and action methods.
|
|
111
107
|
*/
|
|
112
|
-
declare function useElements(): Elements | null;
|
|
113
|
-
|
|
108
|
+
export declare function useElements(): Elements | null;
|
|
114
109
|
/**
|
|
115
110
|
* Convenience hook for payment confirmation.
|
|
116
111
|
*
|
|
@@ -119,42 +114,41 @@ declare function useElements(): Elements | null;
|
|
|
119
114
|
* const { confirmPayment, isConfirming } = useConfirmPayment();
|
|
120
115
|
* ```
|
|
121
116
|
*/
|
|
122
|
-
declare function useConfirmPayment(): {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
117
|
+
export declare function useConfirmPayment(): {
|
|
118
|
+
confirmPayment: () => Promise<{
|
|
119
|
+
type: "error";
|
|
120
|
+
error: {
|
|
121
|
+
message: string;
|
|
122
|
+
code: null;
|
|
123
|
+
};
|
|
124
|
+
}>;
|
|
125
|
+
isConfirming: boolean;
|
|
131
126
|
} | {
|
|
132
|
-
|
|
133
|
-
|
|
127
|
+
confirmPayment: (options?: Omit<import("@xpayeg/sdk").ConfirmPaymentOptions, "elements">) => Promise<import("@xpayeg/sdk").ActionResult>;
|
|
128
|
+
isConfirming: boolean;
|
|
134
129
|
};
|
|
135
|
-
|
|
136
130
|
interface PaymentElementProps {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
131
|
+
/** Element configuration options (layout, default payment method, ordering) */
|
|
132
|
+
options?: PaymentElementOptions;
|
|
133
|
+
/** Fired when the element is mounted and the iframe content is ready */
|
|
134
|
+
onReady?: () => void;
|
|
135
|
+
/**
|
|
136
|
+
* Fired on every state change — payment method selection, card field input, completion.
|
|
137
|
+
* Use `event.complete` to enable/disable your pay button.
|
|
138
|
+
*/
|
|
139
|
+
onChange?: (event: PaymentElementChangeEvent$1) => void;
|
|
140
|
+
/** Fired when the element's iframe starts loading — show a custom loading skeleton */
|
|
141
|
+
onLoaderStart?: () => void;
|
|
142
|
+
/** Fired when the element fails to load (network error, invalid client secret) */
|
|
143
|
+
onLoadError?: (event: {
|
|
144
|
+
type: string;
|
|
145
|
+
message: string;
|
|
146
|
+
code?: string;
|
|
147
|
+
}) => void;
|
|
148
|
+
/** CSS class name for the container `<div>` */
|
|
149
|
+
className?: string;
|
|
150
|
+
/** HTML id for the container `<div>` */
|
|
151
|
+
id?: string;
|
|
158
152
|
}
|
|
159
153
|
/**
|
|
160
154
|
* Renders the XPay Payment Element — a full payment method selector with card form.
|
|
@@ -172,17 +166,16 @@ interface PaymentElementProps {
|
|
|
172
166
|
* </XPayProvider>
|
|
173
167
|
* ```
|
|
174
168
|
*/
|
|
175
|
-
declare const PaymentElement: FC<PaymentElementProps>;
|
|
176
|
-
|
|
169
|
+
export declare const PaymentElement: FC<PaymentElementProps>;
|
|
177
170
|
interface CheckoutButtonProps {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
171
|
+
/** Checkout session client secret */
|
|
172
|
+
clientSecret: string;
|
|
173
|
+
/** Button content */
|
|
174
|
+
children?: ReactNode;
|
|
175
|
+
/** Checkout options (callbacks, appearance, locale) */
|
|
176
|
+
checkoutOptions?: Omit<CheckoutOptions, "clientSecret" | "mode">;
|
|
177
|
+
className?: string;
|
|
178
|
+
disabled?: boolean;
|
|
186
179
|
}
|
|
187
180
|
/**
|
|
188
181
|
* Button that opens the drop-in checkout modal on click.
|
|
@@ -204,7 +197,5 @@ interface CheckoutButtonProps {
|
|
|
204
197
|
* </XPayProvider>
|
|
205
198
|
* ```
|
|
206
199
|
*/
|
|
207
|
-
declare const CheckoutButton: FC<CheckoutButtonProps>;
|
|
208
|
-
|
|
209
|
-
export { CheckoutButton, PaymentElement, XPayProvider, useCheckout, useConfirmPayment, useElements, useXPay };
|
|
210
|
-
export type { Checkout, CheckoutButtonProps, PaymentElementProps, UseCheckoutResult };
|
|
200
|
+
export declare const CheckoutButton: FC<CheckoutButtonProps>;
|
|
201
|
+
export type { ActionResult, Appearance, Checkout, CheckoutActions, CheckoutButtonProps, CheckoutSession, ConfirmPaymentOptions, ElementsOptions, PaymentElementChangeEvent, PaymentElementProps, PaymentMethodInfo, UseCheckoutResult, XPayError };
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import * as _xpayeg_sdk from '@xpayeg/sdk';
|
|
4
|
-
import { CheckoutSession, CheckoutActions, XPayInstance, ElementsOptions, Elements, PaymentElementOptions, PaymentElementChangeEvent, CheckoutOptions } from '@xpayeg/sdk';
|
|
5
|
-
export { ActionResult, Appearance, CheckoutActions, CheckoutSession, ConfirmPaymentOptions, ElementsOptions, PaymentElementChangeEvent, PaymentMethodInfo, XPayError } from '@xpayeg/sdk';
|
|
6
|
-
|
|
1
|
+
import { FC, ReactNode } from "react";
|
|
2
|
+
import { ActionResult, Appearance, CheckoutActions, CheckoutActions as CheckoutActions$1, CheckoutOptions, CheckoutSession, CheckoutSession as CheckoutSession$1, ConfirmPaymentOptions, Elements, ElementsOptions, ElementsOptions as ElementsOptions$1, PaymentElementChangeEvent, PaymentElementChangeEvent as PaymentElementChangeEvent$1, PaymentElementOptions, PaymentMethodInfo, XPayError, XPayInstance } from "@xpayeg/sdk";
|
|
7
3
|
/**
|
|
8
4
|
* The checkout object returned by `useCheckout()` on success.
|
|
9
5
|
* Merges session data with action methods for a single unified API.
|
|
@@ -18,33 +14,33 @@ export { ActionResult, Appearance, CheckoutActions, CheckoutSession, ConfirmPaym
|
|
|
18
14
|
* }
|
|
19
15
|
* ```
|
|
20
16
|
*/
|
|
21
|
-
type Checkout = CheckoutSession & CheckoutActions;
|
|
17
|
+
type Checkout = CheckoutSession$1 & CheckoutActions$1;
|
|
22
18
|
type UseCheckoutResult = {
|
|
23
|
-
|
|
19
|
+
type: "loading";
|
|
24
20
|
} | {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
type: "error";
|
|
22
|
+
error: {
|
|
23
|
+
message: string;
|
|
24
|
+
};
|
|
29
25
|
} | {
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
type: "success";
|
|
27
|
+
checkout: Checkout;
|
|
32
28
|
};
|
|
33
29
|
interface XPayProviderProps {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
30
|
+
/**
|
|
31
|
+
* XPay instance or a Promise resolving to one.
|
|
32
|
+
* Use `loadXPay()` from `@xpayeg/sdk` — call it at module level, not inside a component.
|
|
33
|
+
*/
|
|
34
|
+
xpay: XPayInstance | Promise<XPayInstance | null> | null;
|
|
35
|
+
/**
|
|
36
|
+
* Elements options — either `{ clientSecret }` (session-first) or
|
|
37
|
+
* `{ mode: "payment", amount, currency }` (deferred — the session is created
|
|
38
|
+
* by your server at confirm time). In deferred mode use `useElements()` +
|
|
39
|
+
* `<PaymentElement>`; `useCheckout()` session data reflects the display
|
|
40
|
+
* amount until a session is bound at confirm.
|
|
41
|
+
*/
|
|
42
|
+
options?: ElementsOptions$1;
|
|
43
|
+
children: ReactNode;
|
|
48
44
|
}
|
|
49
45
|
/**
|
|
50
46
|
* Provides XPay context to all child components.
|
|
@@ -70,7 +66,7 @@ interface XPayProviderProps {
|
|
|
70
66
|
* }
|
|
71
67
|
* ```
|
|
72
68
|
*/
|
|
73
|
-
declare function XPayProvider({ xpay: xpayProp, options, children }: XPayProviderProps):
|
|
69
|
+
export declare function XPayProvider({ xpay: xpayProp, options, children }: XPayProviderProps): import("react").JSX.Element;
|
|
74
70
|
/**
|
|
75
71
|
* Access the checkout state — a tagged union of `loading`, `error`, or `success`.
|
|
76
72
|
*
|
|
@@ -95,22 +91,21 @@ declare function XPayProvider({ xpay: xpayProp, options, children }: XPayProvide
|
|
|
95
91
|
* }
|
|
96
92
|
* ```
|
|
97
93
|
*/
|
|
98
|
-
declare function useCheckout(): UseCheckoutResult;
|
|
94
|
+
export declare function useCheckout(): UseCheckoutResult;
|
|
99
95
|
/**
|
|
100
96
|
* Access the raw XPay SDK instance. Returns `null` while the SDK is loading.
|
|
101
97
|
*
|
|
102
98
|
* Most merchants should use `useCheckout()` instead. Use `useXPay()` only when
|
|
103
99
|
* you need direct access to `xpay.confirmPayment()` or `xpay.checkout()`.
|
|
104
100
|
*/
|
|
105
|
-
declare function useXPay(): XPayInstance | null;
|
|
101
|
+
export declare function useXPay(): XPayInstance | null;
|
|
106
102
|
/**
|
|
107
103
|
* Access the Elements instance. Returns `null` while the session is loading.
|
|
108
104
|
*
|
|
109
105
|
* Use this for direct element management. In most cases, use `useCheckout()` instead
|
|
110
106
|
* which provides both session data and action methods.
|
|
111
107
|
*/
|
|
112
|
-
declare function useElements(): Elements | null;
|
|
113
|
-
|
|
108
|
+
export declare function useElements(): Elements | null;
|
|
114
109
|
/**
|
|
115
110
|
* Convenience hook for payment confirmation.
|
|
116
111
|
*
|
|
@@ -119,42 +114,41 @@ declare function useElements(): Elements | null;
|
|
|
119
114
|
* const { confirmPayment, isConfirming } = useConfirmPayment();
|
|
120
115
|
* ```
|
|
121
116
|
*/
|
|
122
|
-
declare function useConfirmPayment(): {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
117
|
+
export declare function useConfirmPayment(): {
|
|
118
|
+
confirmPayment: () => Promise<{
|
|
119
|
+
type: "error";
|
|
120
|
+
error: {
|
|
121
|
+
message: string;
|
|
122
|
+
code: null;
|
|
123
|
+
};
|
|
124
|
+
}>;
|
|
125
|
+
isConfirming: boolean;
|
|
131
126
|
} | {
|
|
132
|
-
|
|
133
|
-
|
|
127
|
+
confirmPayment: (options?: Omit<import("@xpayeg/sdk").ConfirmPaymentOptions, "elements">) => Promise<import("@xpayeg/sdk").ActionResult>;
|
|
128
|
+
isConfirming: boolean;
|
|
134
129
|
};
|
|
135
|
-
|
|
136
130
|
interface PaymentElementProps {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
131
|
+
/** Element configuration options (layout, default payment method, ordering) */
|
|
132
|
+
options?: PaymentElementOptions;
|
|
133
|
+
/** Fired when the element is mounted and the iframe content is ready */
|
|
134
|
+
onReady?: () => void;
|
|
135
|
+
/**
|
|
136
|
+
* Fired on every state change — payment method selection, card field input, completion.
|
|
137
|
+
* Use `event.complete` to enable/disable your pay button.
|
|
138
|
+
*/
|
|
139
|
+
onChange?: (event: PaymentElementChangeEvent$1) => void;
|
|
140
|
+
/** Fired when the element's iframe starts loading — show a custom loading skeleton */
|
|
141
|
+
onLoaderStart?: () => void;
|
|
142
|
+
/** Fired when the element fails to load (network error, invalid client secret) */
|
|
143
|
+
onLoadError?: (event: {
|
|
144
|
+
type: string;
|
|
145
|
+
message: string;
|
|
146
|
+
code?: string;
|
|
147
|
+
}) => void;
|
|
148
|
+
/** CSS class name for the container `<div>` */
|
|
149
|
+
className?: string;
|
|
150
|
+
/** HTML id for the container `<div>` */
|
|
151
|
+
id?: string;
|
|
158
152
|
}
|
|
159
153
|
/**
|
|
160
154
|
* Renders the XPay Payment Element — a full payment method selector with card form.
|
|
@@ -172,17 +166,16 @@ interface PaymentElementProps {
|
|
|
172
166
|
* </XPayProvider>
|
|
173
167
|
* ```
|
|
174
168
|
*/
|
|
175
|
-
declare const PaymentElement: FC<PaymentElementProps>;
|
|
176
|
-
|
|
169
|
+
export declare const PaymentElement: FC<PaymentElementProps>;
|
|
177
170
|
interface CheckoutButtonProps {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
171
|
+
/** Checkout session client secret */
|
|
172
|
+
clientSecret: string;
|
|
173
|
+
/** Button content */
|
|
174
|
+
children?: ReactNode;
|
|
175
|
+
/** Checkout options (callbacks, appearance, locale) */
|
|
176
|
+
checkoutOptions?: Omit<CheckoutOptions, "clientSecret" | "mode">;
|
|
177
|
+
className?: string;
|
|
178
|
+
disabled?: boolean;
|
|
186
179
|
}
|
|
187
180
|
/**
|
|
188
181
|
* Button that opens the drop-in checkout modal on click.
|
|
@@ -204,7 +197,5 @@ interface CheckoutButtonProps {
|
|
|
204
197
|
* </XPayProvider>
|
|
205
198
|
* ```
|
|
206
199
|
*/
|
|
207
|
-
declare const CheckoutButton: FC<CheckoutButtonProps>;
|
|
208
|
-
|
|
209
|
-
export { CheckoutButton, PaymentElement, XPayProvider, useCheckout, useConfirmPayment, useElements, useXPay };
|
|
210
|
-
export type { Checkout, CheckoutButtonProps, PaymentElementProps, UseCheckoutResult };
|
|
200
|
+
export declare const CheckoutButton: FC<CheckoutButtonProps>;
|
|
201
|
+
export type { ActionResult, Appearance, Checkout, CheckoutActions, CheckoutButtonProps, CheckoutSession, ConfirmPaymentOptions, ElementsOptions, PaymentElementChangeEvent, PaymentElementProps, PaymentMethodInfo, UseCheckoutResult, XPayError };
|
package/CHANGELOG.md
CHANGED
|
@@ -1,99 +1,105 @@
|
|
|
1
1
|
# @xpayeg/react
|
|
2
2
|
|
|
3
|
-
##
|
|
4
|
-
### Minor Changes
|
|
3
|
+
## 3.0.0
|
|
5
4
|
|
|
5
|
+
### Major Changes
|
|
6
6
|
|
|
7
|
+
- [#513](https://github.com/xpayeg/xpay/pull/513) [`4cfeec3`](https://github.com/xpayeg/xpay/commit/4cfeec3a67f43623fb1ab024f86d0f40d9c0b36c) Thanks [@Elmosh](https://github.com/Elmosh)! - Modernize the SDK build and bundled TypeScript declarations while preserving both ESM and CommonJS entrypoints. The browser loader and React component APIs are unchanged.
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
The public checkout types now describe nullable API fields and pending discounts. TypeScript consumers may need null checks and must narrow pending versus applied discounts before accessing fields specific to either variant. This public type change, rather than module-format support, requires the major release.
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#541](https://github.com/xpayeg/xpay/pull/541) [`c6f29c9`](https://github.com/xpayeg/xpay/commit/c6f29c9b9bd73decb4c3f250ce1d55f317d7a81a) Thanks [@Elmosh](https://github.com/Elmosh)! - Preserve CommonJS support alongside ESM in the modernized SDK build. Generate both JavaScript formats and their matching TypeScript declarations from the same source, and verify both entrypoints and the packed publication boundary before release.
|
|
14
|
+
|
|
15
|
+
- [#528](https://github.com/xpayeg/xpay/pull/528) [`574ef13`](https://github.com/xpayeg/xpay/commit/574ef135692dac3a33a2c42acac4543eb80a4c91) Thanks [@Elmosh](https://github.com/Elmosh)! - Remove private workspace metadata and source-path comments from the published packages. Keep SDK declarations limited to the public checkout types, with compile-time checks against generated API responses to prevent drift. Runtime behavior is unchanged.
|
|
16
|
+
- Updated dependencies [[`4cfeec3`](https://github.com/xpayeg/xpay/commit/4cfeec3a67f43623fb1ab024f86d0f40d9c0b36c), [`c6f29c9`](https://github.com/xpayeg/xpay/commit/c6f29c9b9bd73decb4c3f250ce1d55f317d7a81a), [`574ef13`](https://github.com/xpayeg/xpay/commit/574ef135692dac3a33a2c42acac4543eb80a4c91)]:
|
|
17
|
+
- @xpayeg/sdk@3.0.0
|
|
18
|
+
|
|
19
|
+
## 2.4.0
|
|
9
20
|
|
|
10
|
-
## 2.3.0
|
|
11
21
|
### Minor Changes
|
|
12
22
|
|
|
23
|
+
- [#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.
|
|
24
|
+
|
|
25
|
+
## 2.3.0
|
|
13
26
|
|
|
27
|
+
### Minor Changes
|
|
14
28
|
|
|
15
29
|
- [#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
30
|
|
|
17
31
|
## 2.2.0
|
|
18
|
-
### Minor Changes
|
|
19
|
-
|
|
20
32
|
|
|
33
|
+
### Minor Changes
|
|
21
34
|
|
|
22
35
|
- [#462](https://github.com/xpayeg/xpay/pull/462) [`f083704`](https://github.com/xpayeg/xpay/commit/f08370434ff93c52450cfaee17f249c11b5cd46c) Thanks [@Elmosh](https://github.com/Elmosh)! - Deferred-mount Payment Element: `xpay.elements({ mode: "payment", amount, currency })` renders the payment form with no checkout session — your server creates the session with the final total when the customer clicks Pay, and its clientSecret is passed to `confirmPayment({ elements, clientSecret })` (a plain string). The session's total must equal the amount the element displays, or the confirmation fails with `amount_reconfirmation_required` and nothing is charged. Adds `elements.update({ amount, currency })` for deferred display updates. `XPayProvider` accepts the new options form; deferred amount/currency prop changes flow through `elements.update()` without recreating the instance. The existing `{ clientSecret }` path is unchanged.
|
|
23
|
-
|
|
36
|
+
|
|
24
37
|
Also in this release: the overlay scroll lock (3DS/action overlay and drop-in modal, now one shared implementation) pins the page at its measured geometry and preserves the scrollbar gutter, so centered boxed themes no longer shift when an overlay opens; `elements.fetchUpdates()` now genuinely re-fetches the session from the server (it previously answered from the iframe's local state; failures now resolve the error arm instead of returning stale data), and `CheckoutSession` gains optional `presentmentDetails` — the customer-facing amounts, present only when the merchant prices in a currency other than the processing currency. Read amounts presentment-first.
|
|
25
38
|
|
|
26
39
|
## 2.1.0
|
|
27
|
-
### Minor Changes
|
|
28
|
-
|
|
29
40
|
|
|
41
|
+
### Minor Changes
|
|
30
42
|
|
|
31
43
|
- [#224](https://github.com/xpayeg/xpay/pull/224) [`40beff5`](https://github.com/xpayeg/xpay/commit/40beff5ee4660914dff5c0f7c43480083bf331c4) Thanks [@mariamkamel](https://github.com/mariamkamel)! - `CheckoutCompleteResult` (drop-in `onComplete`) and the `session` in `confirmPayment()`'s success result now carry `paymentStatus`. Methods the customer pays afterwards, such as Fawry, complete checkout as `unpaid` and are paid later. Fulfil on `paymentStatus: "paid"`, never on completion alone.
|
|
32
|
-
|
|
44
|
+
|
|
33
45
|
Drop-in `onError` now fires when an attempt fails (declined, canceled, processing error) and when the session is expired or already complete on load. The modal unlocks after a failed attempt so the customer can close it; previously it stayed locked until a successful payment.
|
|
34
46
|
|
|
35
47
|
### Patch Changes
|
|
36
48
|
|
|
37
|
-
|
|
38
|
-
|
|
39
49
|
- [#453](https://github.com/xpayeg/xpay/pull/453) [`5445718`](https://github.com/xpayeg/xpay/commit/5445718b5027cba56f1d645cba6f42904d2c2f2c) Thanks [@Elmosh](https://github.com/Elmosh)! - `@xpayeg/react` now declares its `@xpayeg/sdk` peer dependency as `^2.0.0` instead of an exact pinned version, so the two packages no longer have to be upgraded in lockstep within a major.
|
|
40
50
|
|
|
41
51
|
## 2.0.0
|
|
42
|
-
### Major Changes
|
|
43
|
-
|
|
44
52
|
|
|
53
|
+
### Major Changes
|
|
45
54
|
|
|
46
55
|
- [#331](https://github.com/xpayeg/xpay/pull/331) [`bdc6a48`](https://github.com/xpayeg/xpay/commit/bdc6a4865f8c0326a4c0eb3dd20808e1207d682a) Thanks [@Elmosh](https://github.com/Elmosh)! - **Breaking:** `returnUrl` is removed from `confirmPayment()` options. The return destination is always the checkout session's `afterCompletion.redirect.url`, set server-side at session creation.
|
|
47
|
-
|
|
56
|
+
|
|
48
57
|
The URL is sent to the bank during authentication, before the browser leaves your page, so a value passed at confirm time could only ever conflict with what the bank already received. Delete `returnUrl` from `confirmPayment()` and set `afterCompletion.redirect.url` on `createSession`. `redirect: "always"` now follows that destination.
|
|
49
|
-
|
|
58
|
+
|
|
50
59
|
**Breaking:** `afterCompletion` is now required for `uiMode: "embedded"` and `uiMode: "custom"`, and must be `type: "redirect"`. That URL is where the bank returns when authentication takes over the full page, which happens in in-app browsers where an embedded challenge cannot run. `hosted_confirmation` is rejected for these modes since those integrations run on your own site and there is no XPay page to return to.
|
|
51
|
-
|
|
60
|
+
|
|
52
61
|
Also fixed: the 3DS challenge now renders at the size declared to the issuer (previously cropped or oversized), the overlay waits for the issuer's page to paint instead of showing an empty frame, and a challenge that cannot run in an iframe takes over the full tab instead of failing silently.
|
|
53
62
|
|
|
54
63
|
### Patch Changes
|
|
55
64
|
|
|
56
|
-
|
|
57
|
-
|
|
58
65
|
- [#333](https://github.com/xpayeg/xpay/pull/333) [`3dcea81`](https://github.com/xpayeg/xpay/commit/3dcea81b3e3f67267624105560c38f2615c35d96) Thanks [@Elmosh](https://github.com/Elmosh)! - Documentation: the `redirect: "always"` tables and examples now state that the destination is the checkout session's `afterCompletion.redirect.url`, set server-side at session creation.
|
|
59
66
|
|
|
60
67
|
- Updated dependencies [[`3dcea81`](https://github.com/xpayeg/xpay/commit/3dcea81b3e3f67267624105560c38f2615c35d96), [`bdc6a48`](https://github.com/xpayeg/xpay/commit/bdc6a4865f8c0326a4c0eb3dd20808e1207d682a)]:
|
|
61
68
|
- @xpayeg/sdk@2.0.0
|
|
62
69
|
|
|
63
70
|
## 1.0.1
|
|
64
|
-
### Patch Changes
|
|
65
|
-
|
|
66
71
|
|
|
72
|
+
### Patch Changes
|
|
67
73
|
|
|
68
74
|
- [#103](https://github.com/xpayeg/xpay/pull/103) [`7402e27`](https://github.com/xpayeg/xpay/commit/7402e27cde482148f126b2073694ef38386ea87a) Thanks [@Elmosh](https://github.com/Elmosh)! - Remove `CardElement` from both SDKs — `PaymentElement` is the only supported element going forward. It handles every payment method (Card, ValU, Fawry, etc.) through one unified UI and renders the appropriate fields based on the customer's choice.
|
|
69
|
-
|
|
75
|
+
|
|
70
76
|
This release also republishes both packages through the proper `pnpm publish` flow, which fixes the `workspace:*` protocol leak in 1.0.0's `devDependencies` and `peerDependencies`. `npm install @xpayeg/sdk` and `npm install @xpayeg/react` now work cleanly.
|
|
71
|
-
|
|
77
|
+
|
|
72
78
|
**Migration:** replace `elements.create("card")` with `elements.create("payment")`. If you previously rendered `<CardElement>` only when the user selected "Card" from your own picker, switch to `<PaymentElement>` which provides both the picker and the card form together.
|
|
73
|
-
|
|
79
|
+
|
|
74
80
|
```ts
|
|
75
81
|
// Before
|
|
76
82
|
const cardElement = elements.create("card");
|
|
77
83
|
cardElement.mount("#card");
|
|
78
|
-
|
|
84
|
+
|
|
79
85
|
// After
|
|
80
86
|
const paymentElement = elements.create("payment");
|
|
81
87
|
paymentElement.mount("#payment");
|
|
82
88
|
```
|
|
89
|
+
|
|
83
90
|
- Updated dependencies [[`7402e27`](https://github.com/xpayeg/xpay/commit/7402e27cde482148f126b2073694ef38386ea87a)]:
|
|
84
91
|
- @xpayeg/sdk@1.0.1
|
|
85
92
|
|
|
86
93
|
## 1.0.0
|
|
87
|
-
### Major Changes
|
|
88
|
-
|
|
89
94
|
|
|
95
|
+
### Major Changes
|
|
90
96
|
|
|
91
97
|
- [#100](https://github.com/xpayeg/xpay/pull/100) [`76481af`](https://github.com/xpayeg/xpay/commit/76481af7da2fab85f3557666315374c09cc5dddf) Thanks [@Elmosh](https://github.com/Elmosh)! - Initial 1.0.0 release.
|
|
92
|
-
|
|
98
|
+
|
|
93
99
|
`@xpayeg/sdk` ships the `loadXPay()` loader plus the full public TypeScript surface for embedding XPay payments — `Elements`, `PaymentElement`, `CardElement`, drop-in `checkout()`, `initCheckout()`, action methods (`confirm`, `applyPromotionCode`, `removePromotionCode`, `updateLineItemQuantity`, `submit`, `fetchUpdates`, `changeAppearance`), and the tagged-union `ActionResult` / `XPayError` shapes.
|
|
94
|
-
|
|
100
|
+
|
|
95
101
|
`@xpayeg/react` ships the React bindings: `XPayProvider`, `useCheckout`, `useXPay`, `useElements`, `useConfirmPayment`, `<PaymentElement>`, `<CardElement>`, and `<CheckoutButton>` — all SSR-safe, with stable event listeners and smart option diffing.
|
|
96
|
-
|
|
102
|
+
|
|
97
103
|
The runtime is served from `https://checkout.xpay.app/v1/sdk.js` and auto-loaded by `loadXPay()`. Both packages publish with npm provenance.
|
|
98
104
|
|
|
99
105
|
### Patch Changes
|