pay-sdk-react 1.1.0 → 1.1.2
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 +1 -1
- package/README.zh-CN.md +1 -1
- package/dist/es/Airwallex/airwallex-modal.d.ts +4 -4
- package/dist/es/Airwallex/airwallex-modal.js +6 -6
- package/dist/es/Airwallex/airwallex-popup.d.ts +5 -5
- package/dist/es/Airwallex/airwallex-popup.js +13 -13
- package/dist/es/Airwallex/airwallex.d.ts +5 -5
- package/dist/es/Airwallex/airwallex.js +18 -24
- package/dist/es/Airwallex/interface.d.ts +59 -10
- package/dist/es/Alipay/alipay-button.d.ts +3 -3
- package/dist/es/Alipay/alipay-button.js +2 -2
- package/dist/es/Alipay/alipay-modal.d.ts +5 -5
- package/dist/es/Alipay/alipay-modal.js +6 -6
- package/dist/es/Alipay/alipay.d.ts +2 -2
- package/dist/es/Alipay/alipay.js +11 -9
- package/dist/es/Alipay/interface.d.ts +33 -14
- package/dist/es/Button/button.d.ts +1 -1
- package/dist/es/Button/interface.d.ts +65 -10
- package/dist/es/MAlipay/interface.d.ts +1 -6
- package/dist/es/MAlipay/m-alipay-auto-submit.d.ts +2 -2
- package/dist/es/MAlipay/m-alipay-auto-submit.js +2 -2
- package/dist/es/MAlipay/m-alipay-button.d.ts +3 -3
- package/dist/es/MAlipay/m-alipay-button.js +24 -13
- package/dist/es/MWeChat/interface.d.ts +1 -1
- package/dist/es/MWeChat/m-wechat-button.d.ts +3 -3
- package/dist/es/MWeChat/m-wechat-button.js +25 -13
- package/dist/es/Mask/interface.d.ts +6 -6
- package/dist/es/PayButton/index.d.ts +2 -2
- package/dist/es/PayButton/index.js +2 -2
- package/dist/es/Paypal/interface.d.ts +1 -1
- package/dist/es/Paypal/paypal-button.d.ts +3 -3
- package/dist/es/Paypal/paypal-button.js +2 -2
- package/dist/es/Payssion/interface.d.ts +1 -1
- package/dist/es/Payssion/payssion-button.d.ts +3 -3
- package/dist/es/Payssion/payssion-button.js +2 -2
- package/dist/es/Stripe/interface.d.ts +3 -3
- package/dist/es/Stripe/stripe-modal.d.ts +5 -5
- package/dist/es/Stripe/stripe-modal.js +3 -3
- package/dist/es/Stripe/stripe-popup.d.ts +4 -4
- package/dist/es/Stripe/stripe-popup.js +2 -2
- package/dist/es/Wechat/wechat-button.d.ts +3 -3
- package/dist/es/Wechat/wechat-button.js +2 -2
- package/dist/es/Wechat/wechat-modal.d.ts +6 -6
- package/dist/es/Wechat/wechat-modal.js +6 -6
- package/dist/es/Wechat/wechat.d.ts +2 -2
- package/dist/es/Wechat/wechat.js +2 -2
- package/dist/es/confirm-modal/index.d.ts +3 -3
- package/dist/es/confirm-modal/index.js +34 -15
- package/dist/es/dot-loading/interface.d.ts +6 -2
- package/dist/es/index.d.ts +2 -2
- package/dist/es/pay-modal/interface.d.ts +8 -18
- package/dist/es/pay-modal/pay-modal.js +26 -12
- package/dist/lib/Airwallex/airwallex-modal.js +9 -8
- package/dist/lib/Airwallex/airwallex-popup.js +13 -12
- package/dist/lib/Airwallex/airwallex.js +18 -23
- package/dist/lib/Alipay/alipay-button.js +1 -1
- package/dist/lib/Alipay/alipay-modal.js +3 -3
- package/dist/lib/Alipay/alipay.js +10 -8
- package/dist/lib/MAlipay/m-alipay-auto-submit.js +1 -1
- package/dist/lib/MAlipay/m-alipay-button.js +23 -12
- package/dist/lib/MWeChat/m-wechat-button.js +24 -12
- package/dist/lib/PayButton/index.js +3 -2
- package/dist/lib/Paypal/paypal-button.js +1 -1
- package/dist/lib/Payssion/payssion-button.js +1 -1
- package/dist/lib/Stripe/stripe-modal.js +6 -5
- package/dist/lib/Stripe/stripe-popup.js +5 -4
- package/dist/lib/Wechat/wechat-button.js +1 -1
- package/dist/lib/Wechat/wechat-modal.js +7 -6
- package/dist/lib/Wechat/wechat.js +1 -1
- package/dist/lib/confirm-modal/index.js +30 -11
- package/dist/lib/pay-modal/pay-modal.js +26 -12
- package/dist/umd/pay-sdk-react.umd.js +108 -79
- package/dist/umd/pay-sdk-react.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -5412,6 +5412,7 @@
|
|
|
5412
5412
|
}, payUrl: paypalUrl, title: jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(IconPaypalWhite, {}), "PayPal"] }), ...restMaskProps }))] }));
|
|
5413
5413
|
});
|
|
5414
5414
|
PaypalButton.displayName = 'PaypalButton';
|
|
5415
|
+
var PaypalButton$1 = React.memo(PaypalButton);
|
|
5415
5416
|
|
|
5416
5417
|
var propTypes = {exports: {}};
|
|
5417
5418
|
|
|
@@ -9165,7 +9166,9 @@
|
|
|
9165
9166
|
|
|
9166
9167
|
const classPrefix$3 = getPrefixCls('modal');
|
|
9167
9168
|
const PayModal = (props) => {
|
|
9168
|
-
const { visible, title, desc,
|
|
9169
|
+
const { visible, title, desc, retryButtonProps, finishButtonProps, icon, showClose = true, maskClosable = false, onClose, children, footer, className, style, contentClassName, contentStyle, container, } = props;
|
|
9170
|
+
const { className: retryButtonClassName, children: retryButtonChildren = '重新支付', ...retryButtonPropsRest } = retryButtonProps || {};
|
|
9171
|
+
const { className: finishButtonClassName, children: finishButtonChildren = '支付完成', ...finishButtonPropsRest } = finishButtonProps || {};
|
|
9169
9172
|
const el = React.useRef(clientDocument?.createElement('div'));
|
|
9170
9173
|
const ref = React.useRef(null);
|
|
9171
9174
|
useLockScroll(ref, !!visible);
|
|
@@ -9192,8 +9195,8 @@
|
|
|
9192
9195
|
const renderFooter = () => {
|
|
9193
9196
|
if (footer === null)
|
|
9194
9197
|
return;
|
|
9195
|
-
const retryButtonNode = (jsxRuntimeExports.jsx(
|
|
9196
|
-
const finishButtonNode = (jsxRuntimeExports.jsx(
|
|
9198
|
+
const retryButtonNode = (jsxRuntimeExports.jsx(Button, { className: cs(`${classPrefix$3}__btn`, `${classPrefix$3}__btn--retry`, retryButtonClassName), ...retryButtonPropsRest, children: retryButtonChildren }));
|
|
9199
|
+
const finishButtonNode = (jsxRuntimeExports.jsx(Button, { className: cs(`${classPrefix$3}__btn`, `${classPrefix$3}__btn--finish`, finishButtonClassName), ...finishButtonPropsRest, children: finishButtonChildren }));
|
|
9197
9200
|
const footerContent = isFunction(footer)
|
|
9198
9201
|
? footer(retryButtonNode, finishButtonNode)
|
|
9199
9202
|
: footer || (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [retryButtonNode, finishButtonNode] }));
|
|
@@ -9234,6 +9237,7 @@
|
|
|
9234
9237
|
}, footer: null, ...rest, children: _stripeProps && jsxRuntimeExports.jsx(Stripe$1, { ..._stripeProps }) }));
|
|
9235
9238
|
});
|
|
9236
9239
|
StripeModal.displayName = 'StripeModal';
|
|
9240
|
+
var StripeModal$1 = React.memo(StripeModal);
|
|
9237
9241
|
|
|
9238
9242
|
const StripeButton = React.forwardRef((props, ref) => {
|
|
9239
9243
|
const { children = 'Stripe', onClick, displayType = 'popup', stripePopupProps, stripeModalProps, createOrder, ...others } = props;
|
|
@@ -9270,7 +9274,7 @@
|
|
|
9270
9274
|
}
|
|
9271
9275
|
onClick?.(e);
|
|
9272
9276
|
}, [onClick, createOrder, handlePayCreateOrder, displayType]);
|
|
9273
|
-
return (jsxRuntimeExports.jsxs(React.Fragment, { children: [jsxRuntimeExports.jsx(Button, { ref: stripeButtonRef, onClick: handleClick, ...others, children: children }), displayType === 'popup' && (jsxRuntimeExports.jsx(StripePopup$1, { ref: stripePopupRef, ...stripePopupProps })), displayType === 'modal' && (jsxRuntimeExports.jsx(StripeModal, { ref: stripeModalRef, ...stripeModalProps }))] }));
|
|
9277
|
+
return (jsxRuntimeExports.jsxs(React.Fragment, { children: [jsxRuntimeExports.jsx(Button, { ref: stripeButtonRef, onClick: handleClick, ...others, children: children }), displayType === 'popup' && (jsxRuntimeExports.jsx(StripePopup$1, { ref: stripePopupRef, ...stripePopupProps })), displayType === 'modal' && (jsxRuntimeExports.jsx(StripeModal$1, { ref: stripeModalRef, ...stripeModalProps }))] }));
|
|
9274
9278
|
});
|
|
9275
9279
|
StripeButton.displayName = 'StripeButton';
|
|
9276
9280
|
var StripeButton$1 = React.memo(StripeButton);
|
|
@@ -9278,24 +9282,24 @@
|
|
|
9278
9282
|
const StripeComponent = Stripe$1;
|
|
9279
9283
|
StripeComponent.Button = StripeButton$1;
|
|
9280
9284
|
StripeComponent.Popup = StripePopup$1;
|
|
9281
|
-
StripeComponent.Modal = StripeModal;
|
|
9285
|
+
StripeComponent.Modal = StripeModal$1;
|
|
9282
9286
|
|
|
9283
9287
|
/* Airwallex Checkout Component Version [1.122.0] */
|
|
9284
9288
|
const e={prod:"checkout.airwallex.com",demo:"checkout-demo.airwallex.com",staging:"checkout-staging.airwallex.com",dev:"checkout-dev.airwallex.com",local:"localhost:3000"},r=r=>`https://${e[r]||e.prod}`,o="/assets/elements.bundle.min.js?version=1.122.0",n=e=>{const r=document.createElement("script");r.src=`${e}${o}`,r.crossOrigin="anonymous";const n=document.head||document.body;if(!n)throw new Error("Airwallex payment scripts requires a <head> or <body> html element in order to be loaded.");return n.appendChild(r),r},l=async e=>{if("undefined"==typeof window)return null;if(window.Airwallex)return window.Airwallex;let l=0;const t=async()=>{const l=document.querySelector(`script[src="${o}"], script[src="${o}/"]`)||n(r((null==e?void 0:e.env)||"prod"));return new Promise(((r,o)=>{l.addEventListener("load",(()=>{window.Airwallex?(window.Airwallex.init(e),r(window.Airwallex)):o(new Error("Failed to load Airwallex on load event"));})),l.addEventListener("error",(()=>{o(new Error("Failed to load Airwallex scripts")),l.remove&&l.remove();}));}))};for(;l<3;)try{return await t()}catch(e){l++,await new Promise((e=>window.setTimeout(e,500)));}return null};
|
|
9285
9289
|
|
|
9286
9290
|
const Airwallex = React.forwardRef((props, ref) => {
|
|
9287
|
-
const { type =
|
|
9291
|
+
const { type = 'fullFeaturedCard', options, initOptions, style, onReady: propsOnReady, onSuccess: propsOnSuccess, onError: propsOnError, ...others } = props;
|
|
9288
9292
|
const airwallexRef = React.useRef(null);
|
|
9289
9293
|
React.useImperativeHandle(ref, () => airwallexRef.current);
|
|
9290
9294
|
React.useEffect(() => {
|
|
9291
9295
|
l({
|
|
9292
|
-
env:
|
|
9296
|
+
env: 'demo',
|
|
9293
9297
|
...initOptions,
|
|
9294
9298
|
}).then((airwallex) => {
|
|
9295
9299
|
if (airwallex) {
|
|
9296
9300
|
const cardElement = airwallex.createElement(type, options);
|
|
9297
9301
|
if (cardElement) {
|
|
9298
|
-
cardElement.mount(type);
|
|
9302
|
+
cardElement.mount(type);
|
|
9299
9303
|
}
|
|
9300
9304
|
}
|
|
9301
9305
|
});
|
|
@@ -9303,36 +9307,30 @@
|
|
|
9303
9307
|
React.useEffect(() => {
|
|
9304
9308
|
const el = clientDocument?.getElementById(type);
|
|
9305
9309
|
const onReady = (event) => {
|
|
9306
|
-
|
|
9307
|
-
console.log("onReady", event);
|
|
9308
|
-
propsOnReady?.();
|
|
9310
|
+
propsOnReady?.(event);
|
|
9309
9311
|
};
|
|
9310
9312
|
const onSuccess = (event) => {
|
|
9311
|
-
|
|
9312
|
-
console.log("onSuccess", event);
|
|
9313
|
-
propsOnSuccess?.();
|
|
9313
|
+
propsOnSuccess?.(event);
|
|
9314
9314
|
};
|
|
9315
9315
|
const onError = (event) => {
|
|
9316
|
-
|
|
9317
|
-
console.log("onError", event);
|
|
9318
|
-
propsOnError?.();
|
|
9316
|
+
propsOnError?.(event);
|
|
9319
9317
|
};
|
|
9320
9318
|
if (el) {
|
|
9321
|
-
on(el,
|
|
9322
|
-
on(el,
|
|
9323
|
-
on(el,
|
|
9319
|
+
on(el, 'onReady', onReady);
|
|
9320
|
+
on(el, 'onSuccess', onSuccess);
|
|
9321
|
+
on(el, 'onError', onError);
|
|
9324
9322
|
}
|
|
9325
9323
|
return () => {
|
|
9326
9324
|
if (el) {
|
|
9327
|
-
off(el,
|
|
9328
|
-
off(el,
|
|
9329
|
-
off(el,
|
|
9325
|
+
off(el, 'onReady', onReady);
|
|
9326
|
+
off(el, 'onSuccess', onSuccess);
|
|
9327
|
+
off(el, 'onError', onError);
|
|
9330
9328
|
}
|
|
9331
9329
|
};
|
|
9332
9330
|
}, [type, propsOnReady, propsOnSuccess, propsOnError]);
|
|
9333
|
-
return (jsxRuntimeExports.jsx("div", { ref: airwallexRef, id: String(type), style: { width:
|
|
9331
|
+
return (jsxRuntimeExports.jsx("div", { ref: airwallexRef, id: String(type), style: { width: '100%', ...style }, ...others }));
|
|
9334
9332
|
});
|
|
9335
|
-
Airwallex.displayName =
|
|
9333
|
+
Airwallex.displayName = 'Airwallex';
|
|
9336
9334
|
var Airwallex$1 = React.memo(Airwallex);
|
|
9337
9335
|
|
|
9338
9336
|
const AirwallexPopup = React.forwardRef((props, ref) => {
|
|
@@ -9363,22 +9361,22 @@
|
|
|
9363
9361
|
onClose?.();
|
|
9364
9362
|
}, bodyStyle: {
|
|
9365
9363
|
padding: 12,
|
|
9366
|
-
height:
|
|
9367
|
-
overflowY:
|
|
9364
|
+
height: '40vh',
|
|
9365
|
+
overflowY: 'scroll',
|
|
9368
9366
|
...bodyStyle,
|
|
9369
|
-
}, ...others, children: _airwallexProps && (jsxRuntimeExports.jsx(Airwallex$1, { onSuccess: () => {
|
|
9367
|
+
}, ...others, children: _airwallexProps && (jsxRuntimeExports.jsx(Airwallex$1, { onSuccess: (event) => {
|
|
9370
9368
|
if (!isControlled) {
|
|
9371
9369
|
setUncontrolledVisible(false);
|
|
9372
9370
|
}
|
|
9373
|
-
_airwallexProps?.onSuccess?.();
|
|
9374
|
-
}, onError: () => {
|
|
9371
|
+
_airwallexProps?.onSuccess?.(event);
|
|
9372
|
+
}, onError: (event) => {
|
|
9375
9373
|
if (!isControlled) {
|
|
9376
9374
|
setUncontrolledVisible(false);
|
|
9377
9375
|
}
|
|
9378
|
-
_airwallexProps?.onError?.();
|
|
9379
|
-
}, ...omit(_airwallexProps, [
|
|
9376
|
+
_airwallexProps?.onError?.(event);
|
|
9377
|
+
}, ...omit(_airwallexProps, ['onSuccess', 'onError']) })) }));
|
|
9380
9378
|
});
|
|
9381
|
-
AirwallexPopup.displayName =
|
|
9379
|
+
AirwallexPopup.displayName = 'AirwallexPopup';
|
|
9382
9380
|
|
|
9383
9381
|
const AirwallexModal = React.forwardRef((props, ref) => {
|
|
9384
9382
|
const { airwallexProps: propsAirwallexProps, visible, onClose, footer = null, ...rest } = props;
|
|
@@ -9406,16 +9404,16 @@
|
|
|
9406
9404
|
setUncontrolledVisible(false);
|
|
9407
9405
|
}
|
|
9408
9406
|
onClose?.();
|
|
9409
|
-
}, footer: footer, ...rest, children: _airwallexProps && (jsxRuntimeExports.jsx(Airwallex$1, { onSuccess: () => {
|
|
9407
|
+
}, footer: footer, ...rest, children: _airwallexProps && (jsxRuntimeExports.jsx(Airwallex$1, { onSuccess: (event) => {
|
|
9410
9408
|
if (!isControlled) {
|
|
9411
9409
|
setUncontrolledVisible(false);
|
|
9412
9410
|
}
|
|
9413
|
-
_airwallexProps?.onSuccess?.();
|
|
9414
|
-
}, onError: () => {
|
|
9411
|
+
_airwallexProps?.onSuccess?.(event);
|
|
9412
|
+
}, onError: (event) => {
|
|
9415
9413
|
if (!isControlled) {
|
|
9416
9414
|
setUncontrolledVisible(false);
|
|
9417
9415
|
}
|
|
9418
|
-
_airwallexProps?.onError?.();
|
|
9416
|
+
_airwallexProps?.onError?.(event);
|
|
9419
9417
|
}, ...omit(_airwallexProps, ['onSuccess', 'onError']) })) }));
|
|
9420
9418
|
});
|
|
9421
9419
|
AirwallexModal.displayName = 'AirwallexModal';
|
|
@@ -9530,11 +9528,14 @@
|
|
|
9530
9528
|
}, payUrl: payssionUrl, title: 'Payssion', ...restMaskProps }))] }));
|
|
9531
9529
|
});
|
|
9532
9530
|
PayssionButton.displayName = 'PayssionButton';
|
|
9531
|
+
var PayssionButton$1 = React.memo(PayssionButton);
|
|
9533
9532
|
|
|
9534
9533
|
const ConfirmModal = (props) => {
|
|
9535
|
-
const { visible,
|
|
9534
|
+
const { visible, title = '支付确认', desc = (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("div", { children: "1. \u5982\u679C\u60A8\u5DF2\u5B8C\u6210\u652F\u4ED8\uFF0C\u8BF7\u70B9\u51FB[\u652F\u4ED8\u5B8C\u6210]" }), jsxRuntimeExports.jsx("div", { children: "2. \u5982\u679C\u672A\u652F\u4ED8\u6210\u529F\uFF0C\u53EF\u70B9\u51FB[\u91CD\u65B0\u652F\u4ED8]" })] })), retryButtonProps, finishButtonProps, icon = (jsxRuntimeExports.jsx("span", { role: "img", "aria-label": "success", children: "\u2714\uFE0F" })), showClose = true, maskClosable = false, onClose, payUrl, autoOpenWindow = false, openMode = 'window', } = props;
|
|
9535
|
+
const { children: retryButtonChildren = '重新支付', ...retryButtonPropsRest } = retryButtonProps || {};
|
|
9536
|
+
const { children: finishButtonChildren = '支付完成', ...finishButtonPropsRest } = finishButtonProps || {};
|
|
9536
9537
|
const { closeWindow } = usePayWindowOpen({
|
|
9537
|
-
payUrl: payUrl ||
|
|
9538
|
+
payUrl: payUrl || '',
|
|
9538
9539
|
onClose,
|
|
9539
9540
|
autoOpen: autoOpenWindow,
|
|
9540
9541
|
openMode: openMode,
|
|
@@ -9546,30 +9547,36 @@
|
|
|
9546
9547
|
}, [onClose, autoOpenWindow, closeWindow]);
|
|
9547
9548
|
if (!visible)
|
|
9548
9549
|
return null;
|
|
9549
|
-
return (jsxRuntimeExports.jsx(PayModal, { visible: visible, icon: icon, title: title, desc: desc, showClose: showClose, maskClosable: maskClosable, onClose: handleClose,
|
|
9550
|
+
return (jsxRuntimeExports.jsx(PayModal, { visible: visible, icon: icon, title: title, desc: desc, showClose: showClose, maskClosable: maskClosable, onClose: handleClose, retryButtonProps: {
|
|
9551
|
+
children: retryButtonChildren,
|
|
9552
|
+
...retryButtonPropsRest,
|
|
9553
|
+
}, finishButtonProps: {
|
|
9554
|
+
children: finishButtonChildren,
|
|
9555
|
+
...finishButtonPropsRest,
|
|
9556
|
+
} }));
|
|
9550
9557
|
};
|
|
9551
9558
|
|
|
9552
9559
|
const MWechatButton = React.forwardRef((props, ref) => {
|
|
9553
9560
|
const { className, children = (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(IconWechatPay, {}), "\u5FAE\u4FE1\u652F\u4ED8"] })), onClick, wechatUrl: propsWechatUrl, createOrder, displayType = 'modal', modalProps, maskProps, ...others } = props;
|
|
9554
|
-
const {
|
|
9561
|
+
const { retryButtonProps, finishButtonProps, onClose, ...modalPropsOthers } = modalProps || {};
|
|
9555
9562
|
const { onClose: onMaskClose, ...restMaskProps } = maskProps || {};
|
|
9556
9563
|
const mWeChatButtonRef = React.useRef({ nativeElement: null });
|
|
9557
9564
|
const [showMask, setShowMask] = React.useState(false);
|
|
9558
9565
|
const [showModal, setShowModal] = React.useState(false);
|
|
9559
9566
|
const [wechatUrl, setWechatUrl] = React.useState();
|
|
9560
9567
|
React.useImperativeHandle(ref, () => mWeChatButtonRef.current);
|
|
9561
|
-
const handleRetry = React.useCallback(() => {
|
|
9568
|
+
const handleRetry = React.useCallback((event) => {
|
|
9562
9569
|
if (displayType === 'modal') {
|
|
9563
|
-
|
|
9570
|
+
retryButtonProps?.onClick?.(event);
|
|
9564
9571
|
setShowModal(false);
|
|
9565
9572
|
}
|
|
9566
|
-
}, [
|
|
9567
|
-
const handleFinish = React.useCallback(() => {
|
|
9573
|
+
}, [retryButtonProps, displayType]);
|
|
9574
|
+
const handleFinish = React.useCallback((event) => {
|
|
9568
9575
|
if (displayType === 'modal') {
|
|
9569
|
-
|
|
9576
|
+
finishButtonProps?.onClick?.(event);
|
|
9570
9577
|
setShowModal(false);
|
|
9571
9578
|
}
|
|
9572
|
-
}, [
|
|
9579
|
+
}, [finishButtonProps, displayType]);
|
|
9573
9580
|
const handleDisplay = React.useCallback(() => {
|
|
9574
9581
|
if (displayType === 'modal') {
|
|
9575
9582
|
setShowModal(true);
|
|
@@ -9611,9 +9618,16 @@
|
|
|
9611
9618
|
return (jsxRuntimeExports.jsxs(React.Fragment, { children: [jsxRuntimeExports.jsx(Button, { ref: mWeChatButtonRef, className: cs(getPrefixCls('m-wechat-btn'), className), onClick: handleClick, ...others, children: children }), displayType === 'mask' && showMask && wechatUrl && (jsxRuntimeExports.jsx(PayMask, { visible: showMask, onClose: () => {
|
|
9612
9619
|
setShowMask(false);
|
|
9613
9620
|
onMaskClose?.();
|
|
9614
|
-
}, payUrl: wechatUrl, title: 'WeChat', ...restMaskProps })), displayType === 'modal' && showModal && wechatUrl && (jsxRuntimeExports.jsx(ConfirmModal, { visible: showModal, onClose: handleOnCloseModal,
|
|
9621
|
+
}, payUrl: wechatUrl, title: 'WeChat', ...restMaskProps })), displayType === 'modal' && showModal && wechatUrl && (jsxRuntimeExports.jsx(ConfirmModal, { visible: showModal, onClose: handleOnCloseModal, retryButtonProps: {
|
|
9622
|
+
onClick: handleRetry,
|
|
9623
|
+
...omit(retryButtonProps || {}, ['onClick']),
|
|
9624
|
+
}, finishButtonProps: {
|
|
9625
|
+
onClick: handleFinish,
|
|
9626
|
+
...omit(finishButtonProps || {}, ['onClick']),
|
|
9627
|
+
}, payUrl: wechatUrl, autoOpenWindow: true, ...modalPropsOthers }))] }));
|
|
9615
9628
|
});
|
|
9616
9629
|
MWechatButton.displayName = 'MWechatButton';
|
|
9630
|
+
var MWechatButton$1 = React.memo(MWechatButton);
|
|
9617
9631
|
|
|
9618
9632
|
const MAlipayAutoSubmit = ({ formHtml }) => {
|
|
9619
9633
|
React.useEffect(() => {
|
|
@@ -9644,28 +9658,29 @@
|
|
|
9644
9658
|
}, [formHtml]);
|
|
9645
9659
|
return null; // 这个组件不渲染任何内容
|
|
9646
9660
|
};
|
|
9661
|
+
var MAlipay = React.memo(MAlipayAutoSubmit);
|
|
9647
9662
|
|
|
9648
9663
|
const MAlipayButton = React.forwardRef((props, ref) => {
|
|
9649
9664
|
const { className, children = (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(IconAlipay, {}), "\u652F\u4ED8\u5B9D\u652F\u4ED8"] })), onClick, formHtml: propsFormHtml, createOrder, displayType = 'modal', modalProps, maskProps, ...others } = props;
|
|
9650
|
-
const {
|
|
9665
|
+
const { retryButtonProps, finishButtonProps, onClose, ...modalPropsOthers } = modalProps || {};
|
|
9651
9666
|
const { onClose: onMaskClose, ...restMaskProps } = maskProps || {};
|
|
9652
9667
|
const mAlipayButtonRef = React.useRef({ nativeElement: null });
|
|
9653
9668
|
const [formHtmlString, setFormHtmlString] = React.useState();
|
|
9654
9669
|
const [showMask, setShowMask] = React.useState(false);
|
|
9655
9670
|
const [showModal, setShowModal] = React.useState(false);
|
|
9656
9671
|
React.useImperativeHandle(ref, () => mAlipayButtonRef.current);
|
|
9657
|
-
const handleRetry = React.useCallback(() => {
|
|
9672
|
+
const handleRetry = React.useCallback((event) => {
|
|
9658
9673
|
if (displayType === 'modal') {
|
|
9659
|
-
|
|
9674
|
+
retryButtonProps?.onClick?.(event);
|
|
9660
9675
|
setShowModal(false);
|
|
9661
9676
|
}
|
|
9662
|
-
}, [
|
|
9663
|
-
const handleFinish = React.useCallback(() => {
|
|
9677
|
+
}, [retryButtonProps, displayType]);
|
|
9678
|
+
const handleFinish = React.useCallback((event) => {
|
|
9664
9679
|
if (displayType === 'modal') {
|
|
9665
|
-
|
|
9680
|
+
finishButtonProps?.onClick?.(event);
|
|
9666
9681
|
setShowModal(false);
|
|
9667
9682
|
}
|
|
9668
|
-
}, [
|
|
9683
|
+
}, [finishButtonProps, displayType]);
|
|
9669
9684
|
const handleDisplay = React.useCallback(() => {
|
|
9670
9685
|
if (displayType === 'modal') {
|
|
9671
9686
|
setShowModal(true);
|
|
@@ -9710,15 +9725,22 @@
|
|
|
9710
9725
|
}
|
|
9711
9726
|
return showMask;
|
|
9712
9727
|
}, [displayType, showModal, showMask]);
|
|
9713
|
-
return (jsxRuntimeExports.jsxs(React.Fragment, { children: [jsxRuntimeExports.jsx(Button, { ref: mAlipayButtonRef, className: cs(getPrefixCls('m-alipay-btn'), className), onClick: handleClick, ...omit(others, ['displayType', 'displayProps']), children: children }), isShowAutoSubmit && formHtmlString && (jsxRuntimeExports.jsx(
|
|
9728
|
+
return (jsxRuntimeExports.jsxs(React.Fragment, { children: [jsxRuntimeExports.jsx(Button, { ref: mAlipayButtonRef, className: cs(getPrefixCls('m-alipay-btn'), className), onClick: handleClick, ...omit(others, ['displayType', 'displayProps']), children: children }), isShowAutoSubmit && formHtmlString && (jsxRuntimeExports.jsx(MAlipay, { formHtml: formHtmlString })), displayType === 'modal' && formHtmlString && (jsxRuntimeExports.jsx(ConfirmModal, { visible: showModal, retryButtonProps: {
|
|
9729
|
+
onClick: handleRetry,
|
|
9730
|
+
...omit(retryButtonProps || {}, ['onClick']),
|
|
9731
|
+
}, finishButtonProps: {
|
|
9732
|
+
onClick: handleFinish,
|
|
9733
|
+
...omit(finishButtonProps || {}, ['onClick']),
|
|
9734
|
+
}, onClose: handleOnCloseModal, autoOpenWindow: false, ...modalPropsOthers })), showMask && formHtmlString && (jsxRuntimeExports.jsx(PayMask, { visible: showMask, onClose: () => {
|
|
9714
9735
|
setShowMask(false);
|
|
9715
9736
|
onMaskClose?.();
|
|
9716
9737
|
}, payUrl: formHtmlString, title: '支付宝', autoOpenWindow: false, ...restMaskProps }))] }));
|
|
9717
9738
|
});
|
|
9718
9739
|
MAlipayButton.displayName = 'MAlipayButton';
|
|
9740
|
+
var MAlipayButton$1 = React.memo(MAlipayButton);
|
|
9719
9741
|
|
|
9720
|
-
const MAlipayComponent =
|
|
9721
|
-
MAlipayComponent.Button = MAlipayButton;
|
|
9742
|
+
const MAlipayComponent = MAlipay;
|
|
9743
|
+
MAlipayComponent.Button = MAlipayButton$1;
|
|
9722
9744
|
|
|
9723
9745
|
const classPrefix$2 = getPrefixCls('fullscreen-loading');
|
|
9724
9746
|
const FullScreenLoading = ({ loading = false, text = 'Loading...', children, fullscreen = true, className = '', size = 'default', type = 'circle', }) => {
|
|
@@ -9789,10 +9811,11 @@
|
|
|
9789
9811
|
};
|
|
9790
9812
|
|
|
9791
9813
|
const classPrefix$1 = getPrefixCls('alipay-qr-iframe');
|
|
9792
|
-
const AlipayQrIframe = ({ formHtml, tipText = '请使用支付宝APP扫码支付',
|
|
9814
|
+
const AlipayQrIframe = ({ formHtml, tipText = '请使用支付宝APP扫码支付', wrapperClassName = '', wrapperStyle = {}, iframeClassName = '', iframeStyle = {}, }) => {
|
|
9793
9815
|
const [loading, setLoading] = React.useState(true);
|
|
9794
|
-
return (jsxRuntimeExports.jsx(FullScreenLoading, { loading: loading, type: 'spin-dots', text: null, fullscreen: false, children: jsxRuntimeExports.jsxs("div", { className: classPrefix$1, style: { position: 'relative', ...
|
|
9816
|
+
return (jsxRuntimeExports.jsx(FullScreenLoading, { loading: loading, type: 'spin-dots', text: null, fullscreen: false, children: jsxRuntimeExports.jsxs("div", { className: cs(classPrefix$1, wrapperClassName), style: { position: 'relative', ...wrapperStyle }, children: [jsxRuntimeExports.jsx("iframe", { srcDoc: formHtml, className: cs(`${classPrefix$1}__iframe`, iframeClassName), style: { width: 210, height: 210, border: 'none', ...iframeStyle }, title: "alipay-qrcode", scrolling: "no", onLoad: () => setLoading(false) }), !!tipText && jsxRuntimeExports.jsx("span", { className: `${classPrefix$1}__tip`, children: tipText })] }) }));
|
|
9795
9817
|
};
|
|
9818
|
+
var Alipay = React.memo(AlipayQrIframe);
|
|
9796
9819
|
|
|
9797
9820
|
const AlipayModal = React.forwardRef((props, ref) => {
|
|
9798
9821
|
const { alipayProps: propsAlipayProps, visible, onClose, ...others } = props;
|
|
@@ -9820,9 +9843,10 @@
|
|
|
9820
9843
|
setUncontrolledVisible(false);
|
|
9821
9844
|
}
|
|
9822
9845
|
onClose?.();
|
|
9823
|
-
}, ...others, children: _alipayProps
|
|
9846
|
+
}, ...others, children: _alipayProps && jsxRuntimeExports.jsx(Alipay, { ..._alipayProps }) }));
|
|
9824
9847
|
});
|
|
9825
|
-
AlipayModal.displayName =
|
|
9848
|
+
AlipayModal.displayName = 'AlipayModal';
|
|
9849
|
+
var AlipayModal$1 = React.memo(AlipayModal);
|
|
9826
9850
|
|
|
9827
9851
|
const AlipayButton = React.forwardRef((props, ref) => {
|
|
9828
9852
|
const { className, children = (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(IconAlipay, {}), "\u652F\u4ED8\u5B9D\u652F\u4ED8"] })), onClick, createOrder, modalProps, ...others } = props;
|
|
@@ -9846,13 +9870,14 @@
|
|
|
9846
9870
|
}
|
|
9847
9871
|
onClick?.(e);
|
|
9848
9872
|
}, [onClick, createOrder, handlePayCreateOrder]);
|
|
9849
|
-
return (jsxRuntimeExports.jsxs(React.Fragment, { children: [jsxRuntimeExports.jsx(Button, { ref: alipayButtonRef, className: cs(getPrefixCls('alipay-btn'), className), onClick: handleClick, ...others, children: children }), jsxRuntimeExports.jsx(AlipayModal, { ref: alipayModalRef, ...modalProps })] }));
|
|
9873
|
+
return (jsxRuntimeExports.jsxs(React.Fragment, { children: [jsxRuntimeExports.jsx(Button, { ref: alipayButtonRef, className: cs(getPrefixCls('alipay-btn'), className), onClick: handleClick, ...others, children: children }), jsxRuntimeExports.jsx(AlipayModal$1, { ref: alipayModalRef, ...modalProps })] }));
|
|
9850
9874
|
});
|
|
9851
9875
|
AlipayButton.displayName = 'AlipayButton';
|
|
9876
|
+
var AlipayButton$1 = React.memo(AlipayButton);
|
|
9852
9877
|
|
|
9853
|
-
const AlipayComponent =
|
|
9854
|
-
AlipayComponent.Button = AlipayButton;
|
|
9855
|
-
AlipayComponent.Modal = AlipayModal;
|
|
9878
|
+
const AlipayComponent = Alipay;
|
|
9879
|
+
AlipayComponent.Button = AlipayButton$1;
|
|
9880
|
+
AlipayComponent.Modal = AlipayModal$1;
|
|
9856
9881
|
|
|
9857
9882
|
var server = {};
|
|
9858
9883
|
|
|
@@ -16197,6 +16222,7 @@
|
|
|
16197
16222
|
}
|
|
16198
16223
|
return (jsxRuntimeExports.jsxs("div", { className: cs(classPrefix, className), style: style, children: [jsxRuntimeExports.jsx("div", { className: `${classPrefix}__container`, children: jsxRuntimeExports.jsx("img", { className: `${classPrefix}__image`, src: imageUrl, alt: '微信支付二维码' }) }), tipText && jsxRuntimeExports.jsx("span", { className: `${classPrefix}__tip`, children: tipText })] }));
|
|
16199
16224
|
};
|
|
16225
|
+
var Wechat = React.memo(WechatQrCode);
|
|
16200
16226
|
|
|
16201
16227
|
const WechatModal = React.forwardRef((props, ref) => {
|
|
16202
16228
|
const { wechatProps: propsWechatProps, visible, onClose, ...others } = props;
|
|
@@ -16224,9 +16250,10 @@
|
|
|
16224
16250
|
setUncontrolledVisible(false);
|
|
16225
16251
|
}
|
|
16226
16252
|
onClose?.();
|
|
16227
|
-
}, ...others, children: _wechatProps?.wechatUrl && jsxRuntimeExports.jsx(
|
|
16253
|
+
}, ...others, children: _wechatProps?.wechatUrl && jsxRuntimeExports.jsx(Wechat, { ..._wechatProps }) }));
|
|
16228
16254
|
});
|
|
16229
|
-
WechatModal.displayName =
|
|
16255
|
+
WechatModal.displayName = 'WechatModal';
|
|
16256
|
+
var WechatModal$1 = React.memo(WechatModal);
|
|
16230
16257
|
|
|
16231
16258
|
const WechatButton = React.forwardRef((props, ref) => {
|
|
16232
16259
|
const { className, children = (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(IconWechatPay, {}), "\u5FAE\u4FE1\u652F\u4ED8"] })), onClick, createOrder, modalProps, ...others } = props;
|
|
@@ -16248,13 +16275,14 @@
|
|
|
16248
16275
|
}
|
|
16249
16276
|
onClick?.(e);
|
|
16250
16277
|
}, [onClick, createOrder, handlePayCreateOrder]);
|
|
16251
|
-
return (jsxRuntimeExports.jsxs(React.Fragment, { children: [jsxRuntimeExports.jsx(Button, { ref: wechatButtonRef, className: cs(getPrefixCls('wechat-btn'), className), onClick: handleClick, ...others, children: children }), jsxRuntimeExports.jsx(WechatModal, { ref: wechatModalRef, ...modalProps })] }));
|
|
16278
|
+
return (jsxRuntimeExports.jsxs(React.Fragment, { children: [jsxRuntimeExports.jsx(Button, { ref: wechatButtonRef, className: cs(getPrefixCls('wechat-btn'), className), onClick: handleClick, ...others, children: children }), jsxRuntimeExports.jsx(WechatModal$1, { ref: wechatModalRef, ...modalProps })] }));
|
|
16252
16279
|
});
|
|
16253
16280
|
WechatButton.displayName = 'WechatButton';
|
|
16281
|
+
var WechatButton$1 = React.memo(WechatButton);
|
|
16254
16282
|
|
|
16255
|
-
const WechatComponent =
|
|
16256
|
-
WechatComponent.Button = WechatButton;
|
|
16257
|
-
WechatComponent.Modal = WechatModal;
|
|
16283
|
+
const WechatComponent = Wechat;
|
|
16284
|
+
WechatComponent.Button = WechatButton$1;
|
|
16285
|
+
WechatComponent.Modal = WechatModal$1;
|
|
16258
16286
|
|
|
16259
16287
|
exports.PaymentMethod = void 0;
|
|
16260
16288
|
(function (PaymentMethod) {
|
|
@@ -16318,7 +16346,7 @@
|
|
|
16318
16346
|
const PayButton = React.forwardRef((props, ref) => {
|
|
16319
16347
|
if (props.payMethod === exports.PaymentMethod.PaypalH5 ||
|
|
16320
16348
|
props.payMethod === exports.PaymentMethod.PaypalPc) {
|
|
16321
|
-
return jsxRuntimeExports.jsx(PaypalButton, { ref: ref, ...props });
|
|
16349
|
+
return jsxRuntimeExports.jsx(PaypalButton$1, { ref: ref, ...props });
|
|
16322
16350
|
}
|
|
16323
16351
|
if (props.payMethod === exports.PaymentMethod.StripeH5 ||
|
|
16324
16352
|
props.payMethod === exports.PaymentMethod.StripePc) {
|
|
@@ -16328,10 +16356,10 @@
|
|
|
16328
16356
|
return jsxRuntimeExports.jsx(AirwallexComponent.Button, { ref: ref, ...props });
|
|
16329
16357
|
}
|
|
16330
16358
|
if (props.payMethod === exports.PaymentMethod.Payssion) {
|
|
16331
|
-
return jsxRuntimeExports.jsx(PayssionButton, { ref: ref, ...props });
|
|
16359
|
+
return jsxRuntimeExports.jsx(PayssionButton$1, { ref: ref, ...props });
|
|
16332
16360
|
}
|
|
16333
16361
|
if (props.payMethod === exports.PaymentMethod.WechatH5) {
|
|
16334
|
-
return jsxRuntimeExports.jsx(MWechatButton, { ref: ref, ...props });
|
|
16362
|
+
return jsxRuntimeExports.jsx(MWechatButton$1, { ref: ref, ...props });
|
|
16335
16363
|
}
|
|
16336
16364
|
if (props.payMethod === exports.PaymentMethod.AlipayH5) {
|
|
16337
16365
|
return jsxRuntimeExports.jsx(MAlipayComponent.Button, { ref: ref, ...props });
|
|
@@ -16345,14 +16373,15 @@
|
|
|
16345
16373
|
return null;
|
|
16346
16374
|
});
|
|
16347
16375
|
PayButton.displayName = 'PayButton';
|
|
16376
|
+
var index = React.memo(PayButton);
|
|
16348
16377
|
|
|
16349
16378
|
exports.Airwallex = AirwallexComponent;
|
|
16350
16379
|
exports.Alipay = AlipayComponent;
|
|
16351
16380
|
exports.MAlipay = MAlipayComponent;
|
|
16352
|
-
exports.MWechatButton = MWechatButton;
|
|
16353
|
-
exports.PayButton =
|
|
16354
|
-
exports.PaypalButton = PaypalButton;
|
|
16355
|
-
exports.PayssionButton = PayssionButton;
|
|
16381
|
+
exports.MWechatButton = MWechatButton$1;
|
|
16382
|
+
exports.PayButton = index;
|
|
16383
|
+
exports.PaypalButton = PaypalButton$1;
|
|
16384
|
+
exports.PayssionButton = PayssionButton$1;
|
|
16356
16385
|
exports.Stripe = StripeComponent;
|
|
16357
16386
|
exports.Wechat = WechatComponent;
|
|
16358
16387
|
|