pay-sdk-react 1.1.8 → 1.1.10

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 (52) hide show
  1. package/dist/css/index.css +2 -0
  2. package/dist/css/index.min.css +1 -1
  3. package/dist/es/Airwallex/index.d.ts +1 -0
  4. package/dist/es/Airwallex/index.js +2 -1
  5. package/dist/es/Airwallex/style/index.css +2 -0
  6. package/dist/es/Airwallex/style/index.min.css +1 -1
  7. package/dist/es/Alipay/index.d.ts +1 -0
  8. package/dist/es/Alipay/index.js +2 -1
  9. package/dist/es/MAlipay/index.d.ts +1 -0
  10. package/dist/es/MAlipay/index.js +2 -1
  11. package/dist/es/MAlipay/m-alipay-auto-submit.d.ts +1 -1
  12. package/dist/es/MAlipay/style/index.css +2 -0
  13. package/dist/es/MAlipay/style/index.min.css +1 -1
  14. package/dist/es/MWeChat/style/index.css +2 -0
  15. package/dist/es/MWeChat/style/index.min.css +1 -1
  16. package/dist/es/PayButton/index.js +10 -11
  17. package/dist/es/Paypal/paypal-button.js +0 -2
  18. package/dist/es/Stripe/index.d.ts +1 -0
  19. package/dist/es/Stripe/index.js +2 -1
  20. package/dist/es/Stripe/style/index.css +2 -0
  21. package/dist/es/Stripe/style/index.min.css +1 -1
  22. package/dist/es/Wechat/index.d.ts +1 -0
  23. package/dist/es/Wechat/index.js +2 -1
  24. package/dist/es/confirm-modal/style/index.css +2 -0
  25. package/dist/es/confirm-modal/style/index.min.css +1 -1
  26. package/dist/es/index.d.ts +91 -6
  27. package/dist/es/index.js +38 -6
  28. package/dist/es/pay-modal/style/index.css +2 -0
  29. package/dist/es/pay-modal/style/index.min.css +1 -1
  30. package/dist/lib/Airwallex/index.js +23 -1
  31. package/dist/lib/Airwallex/style/index.css +2 -0
  32. package/dist/lib/Airwallex/style/index.min.css +1 -1
  33. package/dist/lib/Alipay/index.js +16 -1
  34. package/dist/lib/MAlipay/index.js +9 -1
  35. package/dist/lib/MAlipay/style/index.css +2 -0
  36. package/dist/lib/MAlipay/style/index.min.css +1 -1
  37. package/dist/lib/MWeChat/style/index.css +2 -0
  38. package/dist/lib/MWeChat/style/index.min.css +1 -1
  39. package/dist/lib/PayButton/index.js +10 -12
  40. package/dist/lib/Paypal/paypal-button.js +0 -2
  41. package/dist/lib/Stripe/index.js +23 -1
  42. package/dist/lib/Stripe/style/index.css +2 -0
  43. package/dist/lib/Stripe/style/index.min.css +1 -1
  44. package/dist/lib/Wechat/index.js +16 -1
  45. package/dist/lib/confirm-modal/style/index.css +2 -0
  46. package/dist/lib/confirm-modal/style/index.min.css +1 -1
  47. package/dist/lib/index.js +88 -19
  48. package/dist/lib/pay-modal/style/index.css +2 -0
  49. package/dist/lib/pay-modal/style/index.min.css +1 -1
  50. package/dist/umd/pay-sdk-react.umd.js +58 -32
  51. package/dist/umd/pay-sdk-react.umd.js.map +1 -1
  52. package/package.json +9 -1
@@ -5529,7 +5529,6 @@
5529
5529
  const paypalButtonRef = React.useRef(null);
5530
5530
  const [showMask, setShowMask] = React.useState(false);
5531
5531
  const [paypalUrl, setPaypalUrl] = React.useState();
5532
- // 监听 isPayment 状态变化,当支付完成时隐藏蒙层
5533
5532
  React.useEffect(() => {
5534
5533
  if (createOrder && isPayment) {
5535
5534
  setShowMask(false);
@@ -7824,7 +7823,7 @@
7824
7823
  });
7825
7824
  };
7826
7825
 
7827
- const Stripe = React.forwardRef((props, ref) => {
7826
+ const Stripe$1 = React.forwardRef((props, ref) => {
7828
7827
  const { stripeKey, clientSecret, className = '', ...others } = props;
7829
7828
  const stripeRef = React.useRef(null);
7830
7829
  React.useImperativeHandle(ref, () => stripeRef.current);
@@ -7837,8 +7836,8 @@
7837
7836
  const classNames = cs(getPrefixCls('pay-stripe'), className);
7838
7837
  return (jsxRuntimeExports.jsx("div", { ref: stripeRef, ...others, className: classNames, children: clientSecret && stripePromise && (jsxRuntimeExports.jsx(EmbeddedCheckoutProvider, { stripe: stripePromise, options: { clientSecret }, children: jsxRuntimeExports.jsx(EmbeddedCheckout, {}) })) }));
7839
7838
  });
7840
- Stripe.displayName = 'Stripe';
7841
- var Stripe$1 = React.memo(Stripe);
7839
+ Stripe$1.displayName = 'Stripe';
7840
+ var Stripe$2 = React.memo(Stripe$1);
7842
7841
 
7843
7842
  function clamp(v, min, max) {
7844
7843
  return Math.max(min, Math.min(v, max));
@@ -9404,7 +9403,7 @@
9404
9403
  setUncontrolledVisible(false);
9405
9404
  }
9406
9405
  onClose?.();
9407
- }, footer: null, ...rest, children: _stripeProps && jsxRuntimeExports.jsx(Stripe$1, { ..._stripeProps }) }));
9406
+ }, footer: null, ...rest, children: _stripeProps && jsxRuntimeExports.jsx(Stripe$2, { ..._stripeProps }) }));
9408
9407
  });
9409
9408
  StripeModal.displayName = 'StripeModal';
9410
9409
  var StripeModal$1 = React.memo(StripeModal);
@@ -9481,7 +9480,7 @@
9481
9480
  StripeButton.displayName = 'StripeButton';
9482
9481
  var StripeButton$1 = React.memo(StripeButton);
9483
9482
 
9484
- const StripeComponent = Stripe$1;
9483
+ const StripeComponent = Stripe$2;
9485
9484
  StripeComponent.Button = StripeButton$1;
9486
9485
  StripeComponent.Popup = StripePopup$1;
9487
9486
  StripeComponent.Modal = StripeModal$1;
@@ -9489,7 +9488,7 @@
9489
9488
  /* Airwallex Checkout Component Version [1.122.0] */
9490
9489
  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};
9491
9490
 
9492
- const Airwallex = React.forwardRef((props, ref) => {
9491
+ const Airwallex$1 = React.forwardRef((props, ref) => {
9493
9492
  const { type = 'fullFeaturedCard', options, initOptions, style, onReady: propsOnReady, onSuccess: propsOnSuccess, onError: propsOnError, ...others } = props;
9494
9493
  const airwallexRef = React.useRef(null);
9495
9494
  React.useImperativeHandle(ref, () => airwallexRef.current);
@@ -9532,8 +9531,8 @@
9532
9531
  }, [type, propsOnReady, propsOnSuccess, propsOnError]);
9533
9532
  return (jsxRuntimeExports.jsx("div", { ref: airwallexRef, id: String(type), style: { width: '100%', ...style }, ...others }));
9534
9533
  });
9535
- Airwallex.displayName = 'Airwallex';
9536
- var Airwallex$1 = React.memo(Airwallex);
9534
+ Airwallex$1.displayName = 'Airwallex';
9535
+ var Airwallex$2 = React.memo(Airwallex$1);
9537
9536
 
9538
9537
  const AirwallexPopup = React.forwardRef((props, ref) => {
9539
9538
  const { visible: controlledVisible, onClose, closeOnMaskClick = true, bodyStyle, airwallexProps: propsAirwallexProps, ...others } = props;
@@ -9566,7 +9565,7 @@
9566
9565
  height: '40vh',
9567
9566
  overflowY: 'scroll',
9568
9567
  ...bodyStyle,
9569
- }, ...others, children: _airwallexProps && (jsxRuntimeExports.jsx(Airwallex$1, { onSuccess: (event) => {
9568
+ }, ...others, children: _airwallexProps && (jsxRuntimeExports.jsx(Airwallex$2, { onSuccess: (event) => {
9570
9569
  if (!isControlled) {
9571
9570
  setUncontrolledVisible(false);
9572
9571
  }
@@ -9606,7 +9605,7 @@
9606
9605
  setUncontrolledVisible(false);
9607
9606
  }
9608
9607
  onClose?.();
9609
- }, footer: footer, ...rest, children: _airwallexProps && (jsxRuntimeExports.jsx(Airwallex$1, { onSuccess: (event) => {
9608
+ }, footer: footer, ...rest, children: _airwallexProps && (jsxRuntimeExports.jsx(Airwallex$2, { onSuccess: (event) => {
9610
9609
  if (!isControlled) {
9611
9610
  setUncontrolledVisible(false);
9612
9611
  }
@@ -9714,7 +9713,7 @@
9714
9713
  AirwallexButton.displayName = 'AirwallexButton';
9715
9714
  var AirwallexButton$1 = React.memo(AirwallexButton);
9716
9715
 
9717
- const AirwallexComponent = Airwallex$1;
9716
+ const AirwallexComponent = Airwallex$2;
9718
9717
  AirwallexComponent.Button = AirwallexButton$1;
9719
9718
  AirwallexComponent.Popup = AirwallexPopup;
9720
9719
  AirwallexComponent.Modal = AirwallexModal;
@@ -9903,7 +9902,7 @@
9903
9902
  }, [formHtml]);
9904
9903
  return null; // 这个组件不渲染任何内容
9905
9904
  };
9906
- var MAlipay = React.memo(MAlipayAutoSubmit);
9905
+ var MAlipay$1 = React.memo(MAlipayAutoSubmit);
9907
9906
 
9908
9907
  const MAlipayButton = React.forwardRef((props, ref) => {
9909
9908
  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;
@@ -9970,7 +9969,7 @@
9970
9969
  }
9971
9970
  return showMask;
9972
9971
  }, [displayType, showModal, showMask]);
9973
- 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: {
9972
+ 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$1, { formHtml: formHtmlString })), displayType === 'modal' && formHtmlString && (jsxRuntimeExports.jsx(ConfirmModal, { visible: showModal, retryButtonProps: {
9974
9973
  onClick: handleRetry,
9975
9974
  ...omit(retryButtonProps || {}, ['onClick']),
9976
9975
  }, finishButtonProps: {
@@ -9984,7 +9983,7 @@
9984
9983
  MAlipayButton.displayName = 'MAlipayButton';
9985
9984
  var MAlipayButton$1 = React.memo(MAlipayButton);
9986
9985
 
9987
- const MAlipayComponent = MAlipay;
9986
+ const MAlipayComponent = MAlipay$1;
9988
9987
  MAlipayComponent.Button = MAlipayButton$1;
9989
9988
 
9990
9989
  const classPrefix$2 = getPrefixCls('fullscreen-loading');
@@ -10060,7 +10059,7 @@
10060
10059
  const [loading, setLoading] = React.useState(true);
10061
10060
  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 })] }) }));
10062
10061
  };
10063
- var Alipay = React.memo(AlipayQrIframe);
10062
+ var Alipay$1 = React.memo(AlipayQrIframe);
10064
10063
 
10065
10064
  const AlipayModal = React.forwardRef((props, ref) => {
10066
10065
  const { alipayProps: propsAlipayProps, visible, onClose, ...others } = props;
@@ -10088,7 +10087,7 @@
10088
10087
  setUncontrolledVisible(false);
10089
10088
  }
10090
10089
  onClose?.();
10091
- }, ...others, children: _alipayProps && jsxRuntimeExports.jsx(Alipay, { ..._alipayProps }) }));
10090
+ }, ...others, children: _alipayProps && jsxRuntimeExports.jsx(Alipay$1, { ..._alipayProps }) }));
10092
10091
  });
10093
10092
  AlipayModal.displayName = 'AlipayModal';
10094
10093
  var AlipayModal$1 = React.memo(AlipayModal);
@@ -10131,7 +10130,7 @@
10131
10130
  AlipayButton.displayName = 'AlipayButton';
10132
10131
  var AlipayButton$1 = React.memo(AlipayButton);
10133
10132
 
10134
- const AlipayComponent = Alipay;
10133
+ const AlipayComponent = Alipay$1;
10135
10134
  AlipayComponent.Button = AlipayButton$1;
10136
10135
  AlipayComponent.Modal = AlipayModal$1;
10137
10136
 
@@ -16478,7 +16477,7 @@
16478
16477
  }
16479
16478
  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 })] }));
16480
16479
  };
16481
- var Wechat = React.memo(WechatQrCode);
16480
+ var Wechat$1 = React.memo(WechatQrCode);
16482
16481
 
16483
16482
  const WechatModal = React.forwardRef((props, ref) => {
16484
16483
  const { wechatProps: propsWechatProps, visible, onClose, ...others } = props;
@@ -16506,7 +16505,7 @@
16506
16505
  setUncontrolledVisible(false);
16507
16506
  }
16508
16507
  onClose?.();
16509
- }, ...others, children: _wechatProps?.wechatUrl && jsxRuntimeExports.jsx(Wechat, { ..._wechatProps }) }));
16508
+ }, ...others, children: _wechatProps?.wechatUrl && jsxRuntimeExports.jsx(Wechat$1, { ..._wechatProps }) }));
16510
16509
  });
16511
16510
  WechatModal.displayName = 'WechatModal';
16512
16511
  var WechatModal$1 = React.memo(WechatModal);
@@ -16547,12 +16546,11 @@
16547
16546
  WechatButton.displayName = 'WechatButton';
16548
16547
  var WechatButton$1 = React.memo(WechatButton);
16549
16548
 
16550
- const WechatComponent = Wechat;
16549
+ const WechatComponent = Wechat$1;
16551
16550
  WechatComponent.Button = WechatButton$1;
16552
16551
  WechatComponent.Modal = WechatModal$1;
16553
16552
 
16554
16553
  const PayButton = React.forwardRef((props, ref) => {
16555
- // 使用类型断言来确保 ref 类型正确
16556
16554
  const typedRef = ref;
16557
16555
  if (props.payMethod === exports.PaymentMethod.PaypalH5 ||
16558
16556
  props.payMethod === exports.PaymentMethod.PaypalPc) {
@@ -16560,10 +16558,10 @@
16560
16558
  }
16561
16559
  if (props.payMethod === exports.PaymentMethod.StripeH5 ||
16562
16560
  props.payMethod === exports.PaymentMethod.StripePc) {
16563
- return (jsxRuntimeExports.jsx(StripeComponent.Button, { ref: typedRef, ...props }));
16561
+ return (jsxRuntimeExports.jsx(StripeButton$1, { ref: typedRef, ...props }));
16564
16562
  }
16565
16563
  if (props.payMethod === exports.PaymentMethod.Airwallex) {
16566
- return (jsxRuntimeExports.jsx(AirwallexComponent.Button, { ref: typedRef, ...props }));
16564
+ return (jsxRuntimeExports.jsx(AirwallexButton$1, { ref: typedRef, ...props }));
16567
16565
  }
16568
16566
  if (props.payMethod === exports.PaymentMethod.Payssion) {
16569
16567
  return (jsxRuntimeExports.jsx(PayssionButton$1, { ref: typedRef, ...props }));
@@ -16572,28 +16570,56 @@
16572
16570
  return (jsxRuntimeExports.jsx(MWechatButton$1, { ref: typedRef, ...props }));
16573
16571
  }
16574
16572
  if (props.payMethod === exports.PaymentMethod.AlipayH5) {
16575
- return (jsxRuntimeExports.jsx(MAlipayComponent.Button, { ref: typedRef, ...props }));
16573
+ return (jsxRuntimeExports.jsx(MAlipayButton$1, { ref: typedRef, ...props }));
16576
16574
  }
16577
16575
  if (props.payMethod === exports.PaymentMethod.AlipayPc) {
16578
- return (jsxRuntimeExports.jsx(AlipayComponent.Button, { ref: typedRef, ...props }));
16576
+ return (jsxRuntimeExports.jsx(AlipayButton$1, { ref: typedRef, ...props }));
16579
16577
  }
16580
16578
  if (props.payMethod === exports.PaymentMethod.WechatPc) {
16581
- return (jsxRuntimeExports.jsx(WechatComponent.Button, { ref: typedRef, ...props }));
16579
+ return (jsxRuntimeExports.jsx(WechatButton$1, { ref: typedRef, ...props }));
16582
16580
  }
16583
16581
  return null;
16584
16582
  });
16585
16583
  PayButton.displayName = 'PayButton';
16586
16584
  var index = React.memo(PayButton);
16587
16585
 
16588
- exports.Airwallex = AirwallexComponent;
16589
- exports.Alipay = AlipayComponent;
16590
- exports.MAlipay = MAlipayComponent;
16586
+ const Stripe = StripeComponent;
16587
+ Stripe.Button = StripeButton$1;
16588
+ Stripe.Popup = StripePopup$1;
16589
+ Stripe.Modal = StripeModal$1;
16590
+ const Airwallex = AirwallexComponent;
16591
+ Airwallex.Button = AirwallexButton$1;
16592
+ Airwallex.Popup = AirwallexPopup;
16593
+ Airwallex.Modal = AirwallexModal;
16594
+ const MAlipay = MAlipayComponent;
16595
+ MAlipay.Button = MAlipayButton$1;
16596
+ const Alipay = AlipayComponent;
16597
+ Alipay.Button = AlipayButton$1;
16598
+ Alipay.Modal = AlipayModal$1;
16599
+ const Wechat = WechatComponent;
16600
+ Wechat.Button = WechatButton$1;
16601
+ Wechat.Modal = WechatModal$1;
16602
+
16603
+ exports.Airwallex = Airwallex;
16604
+ exports.AirwallexButton = AirwallexButton$1;
16605
+ exports.AirwallexModal = AirwallexModal;
16606
+ exports.AirwallexPopup = AirwallexPopup;
16607
+ exports.Alipay = Alipay;
16608
+ exports.AlipayButton = AlipayButton$1;
16609
+ exports.AlipayModal = AlipayModal$1;
16610
+ exports.MAlipay = MAlipay;
16611
+ exports.MAlipayButton = MAlipayButton$1;
16591
16612
  exports.MWechatButton = MWechatButton$1;
16592
16613
  exports.PayButton = index;
16593
16614
  exports.PaypalButton = PaypalButton$1;
16594
16615
  exports.PayssionButton = PayssionButton$1;
16595
- exports.Stripe = StripeComponent;
16596
- exports.Wechat = WechatComponent;
16616
+ exports.Stripe = Stripe;
16617
+ exports.StripeButton = StripeButton$1;
16618
+ exports.StripeModal = StripeModal$1;
16619
+ exports.StripePopup = StripePopup$1;
16620
+ exports.Wechat = Wechat;
16621
+ exports.WechatButton = WechatButton$1;
16622
+ exports.WechatModal = WechatModal$1;
16597
16623
 
16598
16624
  }));
16599
16625
  //# sourceMappingURL=pay-sdk-react.umd.js.map