pay-sdk-react 1.1.0 → 1.1.1

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 (66) hide show
  1. package/dist/es/Airwallex/airwallex-modal.d.ts +4 -4
  2. package/dist/es/Airwallex/airwallex-modal.js +6 -6
  3. package/dist/es/Airwallex/airwallex-popup.d.ts +5 -5
  4. package/dist/es/Airwallex/airwallex-popup.js +13 -13
  5. package/dist/es/Airwallex/airwallex.d.ts +5 -5
  6. package/dist/es/Airwallex/airwallex.js +18 -24
  7. package/dist/es/Airwallex/interface.d.ts +59 -10
  8. package/dist/es/Alipay/alipay-button.d.ts +3 -3
  9. package/dist/es/Alipay/alipay-button.js +2 -2
  10. package/dist/es/Alipay/alipay-modal.d.ts +5 -5
  11. package/dist/es/Alipay/alipay-modal.js +5 -5
  12. package/dist/es/Alipay/alipay.d.ts +2 -2
  13. package/dist/es/Alipay/alipay.js +11 -9
  14. package/dist/es/Alipay/interface.d.ts +31 -10
  15. package/dist/es/Button/button.d.ts +1 -1
  16. package/dist/es/Button/interface.d.ts +61 -10
  17. package/dist/es/MAlipay/interface.d.ts +1 -6
  18. package/dist/es/MAlipay/m-alipay-auto-submit.d.ts +2 -2
  19. package/dist/es/MAlipay/m-alipay-auto-submit.js +2 -2
  20. package/dist/es/MAlipay/m-alipay-button.d.ts +3 -3
  21. package/dist/es/MAlipay/m-alipay-button.js +2 -2
  22. package/dist/es/MWeChat/interface.d.ts +1 -1
  23. package/dist/es/MWeChat/m-wechat-button.d.ts +3 -3
  24. package/dist/es/MWeChat/m-wechat-button.js +2 -2
  25. package/dist/es/Mask/interface.d.ts +6 -6
  26. package/dist/es/PayButton/index.d.ts +2 -2
  27. package/dist/es/PayButton/index.js +2 -2
  28. package/dist/es/Paypal/interface.d.ts +1 -1
  29. package/dist/es/Paypal/paypal-button.d.ts +3 -3
  30. package/dist/es/Paypal/paypal-button.js +2 -2
  31. package/dist/es/Payssion/interface.d.ts +1 -1
  32. package/dist/es/Payssion/payssion-button.d.ts +3 -3
  33. package/dist/es/Payssion/payssion-button.js +2 -2
  34. package/dist/es/Stripe/interface.d.ts +3 -3
  35. package/dist/es/Stripe/stripe-modal.d.ts +5 -5
  36. package/dist/es/Stripe/stripe-modal.js +3 -3
  37. package/dist/es/Stripe/stripe-popup.d.ts +4 -4
  38. package/dist/es/Stripe/stripe-popup.js +2 -2
  39. package/dist/es/Wechat/wechat-button.d.ts +3 -3
  40. package/dist/es/Wechat/wechat-button.js +2 -2
  41. package/dist/es/Wechat/wechat-modal.d.ts +6 -6
  42. package/dist/es/Wechat/wechat-modal.js +6 -6
  43. package/dist/es/Wechat/wechat.d.ts +2 -2
  44. package/dist/es/Wechat/wechat.js +2 -2
  45. package/dist/es/dot-loading/interface.d.ts +6 -2
  46. package/dist/es/index.d.ts +1 -1
  47. package/dist/lib/Airwallex/airwallex-modal.js +9 -8
  48. package/dist/lib/Airwallex/airwallex-popup.js +13 -12
  49. package/dist/lib/Airwallex/airwallex.js +18 -23
  50. package/dist/lib/Alipay/alipay-button.js +1 -1
  51. package/dist/lib/Alipay/alipay-modal.js +2 -2
  52. package/dist/lib/Alipay/alipay.js +10 -8
  53. package/dist/lib/MAlipay/m-alipay-auto-submit.js +1 -1
  54. package/dist/lib/MAlipay/m-alipay-button.js +1 -1
  55. package/dist/lib/MWeChat/m-wechat-button.js +1 -1
  56. package/dist/lib/PayButton/index.js +3 -2
  57. package/dist/lib/Paypal/paypal-button.js +1 -1
  58. package/dist/lib/Payssion/payssion-button.js +1 -1
  59. package/dist/lib/Stripe/stripe-modal.js +6 -5
  60. package/dist/lib/Stripe/stripe-popup.js +5 -4
  61. package/dist/lib/Wechat/wechat-button.js +1 -1
  62. package/dist/lib/Wechat/wechat-modal.js +7 -6
  63. package/dist/lib/Wechat/wechat.js +1 -1
  64. package/dist/umd/pay-sdk-react.umd.js +65 -58
  65. package/dist/umd/pay-sdk-react.umd.js.map +1 -1
  66. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { AirwallexModalProps } from './interface';
3
- declare const AirwallexModal: import("react").ForwardRefExoticComponent<AirwallexModalProps & {
4
- children?: import("react").ReactNode;
5
- } & import("react").RefAttributes<import("./interface").AirwallexPopupRef>>;
3
+ declare const AirwallexModal: React.ForwardRefExoticComponent<AirwallexModalProps & {
4
+ children?: React.ReactNode;
5
+ } & React.RefAttributes<import("./interface").AirwallexPopupRef>>;
6
6
  export default AirwallexModal;
@@ -2,11 +2,11 @@ const _excluded = ["airwallexProps", "visible", "onClose", "footer"];
2
2
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
3
3
  function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
4
4
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
5
- import { forwardRef, useImperativeHandle, useRef, useState } from 'react';
5
+ import React, { useImperativeHandle, useRef, useState } from 'react';
6
6
  import PayModal from '../pay-modal';
7
7
  import Airwallex from './airwallex';
8
8
  import omit from '../utils/omit';
9
- const AirwallexModal = /*#__PURE__*/forwardRef((props, ref) => {
9
+ const AirwallexModal = /*#__PURE__*/React.forwardRef((props, ref) => {
10
10
  const {
11
11
  airwallexProps: propsAirwallexProps,
12
12
  visible,
@@ -43,19 +43,19 @@ const AirwallexModal = /*#__PURE__*/forwardRef((props, ref) => {
43
43
  },
44
44
  footer: footer
45
45
  }, rest), _airwallexProps && /*#__PURE__*/React.createElement(Airwallex, _extends({
46
- onSuccess: () => {
46
+ onSuccess: event => {
47
47
  var _airwallexProps$onSuc;
48
48
  if (!isControlled) {
49
49
  setUncontrolledVisible(false);
50
50
  }
51
- _airwallexProps === null || _airwallexProps === void 0 || (_airwallexProps$onSuc = _airwallexProps.onSuccess) === null || _airwallexProps$onSuc === void 0 || _airwallexProps$onSuc.call(_airwallexProps);
51
+ _airwallexProps === null || _airwallexProps === void 0 || (_airwallexProps$onSuc = _airwallexProps.onSuccess) === null || _airwallexProps$onSuc === void 0 || _airwallexProps$onSuc.call(_airwallexProps, event);
52
52
  },
53
- onError: () => {
53
+ onError: event => {
54
54
  var _airwallexProps$onErr;
55
55
  if (!isControlled) {
56
56
  setUncontrolledVisible(false);
57
57
  }
58
- _airwallexProps === null || _airwallexProps === void 0 || (_airwallexProps$onErr = _airwallexProps.onError) === null || _airwallexProps$onErr === void 0 || _airwallexProps$onErr.call(_airwallexProps);
58
+ _airwallexProps === null || _airwallexProps === void 0 || (_airwallexProps$onErr = _airwallexProps.onError) === null || _airwallexProps$onErr === void 0 || _airwallexProps$onErr.call(_airwallexProps, event);
59
59
  }
60
60
  }, omit(_airwallexProps, ['onSuccess', 'onError']))));
61
61
  });
@@ -1,6 +1,6 @@
1
- /// <reference types="react" />
2
- import { AirwallexPopupProps, AirwallexPopupRef } from "./interface";
3
- declare const AirwallexPopup: import("react").ForwardRefExoticComponent<AirwallexPopupProps & {
4
- children?: import("react").ReactNode;
5
- } & import("react").RefAttributes<AirwallexPopupRef>>;
1
+ import React from 'react';
2
+ import { AirwallexPopupProps, AirwallexPopupRef } from './interface';
3
+ declare const AirwallexPopup: React.ForwardRefExoticComponent<AirwallexPopupProps & {
4
+ children?: React.ReactNode;
5
+ } & React.RefAttributes<AirwallexPopupRef>>;
6
6
  export default AirwallexPopup;
@@ -7,11 +7,11 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
7
7
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
8
  function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
9
9
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
10
- import { forwardRef, useImperativeHandle, useRef, useState } from "react";
11
- import Airwallex from "./airwallex";
12
- import PayPopup from "../pay-popup";
13
- import omit from "../utils/omit";
14
- const AirwallexPopup = /*#__PURE__*/forwardRef((props, ref) => {
10
+ import React, { useImperativeHandle, useRef, useState } from 'react';
11
+ import Airwallex from './airwallex';
12
+ import PayPopup from '../pay-popup';
13
+ import omit from '../utils/omit';
14
+ const AirwallexPopup = /*#__PURE__*/React.forwardRef((props, ref) => {
15
15
  const {
16
16
  visible: controlledVisible,
17
17
  onClose,
@@ -50,25 +50,25 @@ const AirwallexPopup = /*#__PURE__*/forwardRef((props, ref) => {
50
50
  },
51
51
  bodyStyle: _objectSpread({
52
52
  padding: 12,
53
- height: "40vh",
54
- overflowY: "scroll"
53
+ height: '40vh',
54
+ overflowY: 'scroll'
55
55
  }, bodyStyle)
56
56
  }, others), _airwallexProps && /*#__PURE__*/React.createElement(Airwallex, _extends({
57
- onSuccess: () => {
57
+ onSuccess: event => {
58
58
  var _airwallexProps$onSuc;
59
59
  if (!isControlled) {
60
60
  setUncontrolledVisible(false);
61
61
  }
62
- _airwallexProps === null || _airwallexProps === void 0 || (_airwallexProps$onSuc = _airwallexProps.onSuccess) === null || _airwallexProps$onSuc === void 0 || _airwallexProps$onSuc.call(_airwallexProps);
62
+ _airwallexProps === null || _airwallexProps === void 0 || (_airwallexProps$onSuc = _airwallexProps.onSuccess) === null || _airwallexProps$onSuc === void 0 || _airwallexProps$onSuc.call(_airwallexProps, event);
63
63
  },
64
- onError: () => {
64
+ onError: event => {
65
65
  var _airwallexProps$onErr;
66
66
  if (!isControlled) {
67
67
  setUncontrolledVisible(false);
68
68
  }
69
- _airwallexProps === null || _airwallexProps === void 0 || (_airwallexProps$onErr = _airwallexProps.onError) === null || _airwallexProps$onErr === void 0 || _airwallexProps$onErr.call(_airwallexProps);
69
+ _airwallexProps === null || _airwallexProps === void 0 || (_airwallexProps$onErr = _airwallexProps.onError) === null || _airwallexProps$onErr === void 0 || _airwallexProps$onErr.call(_airwallexProps, event);
70
70
  }
71
- }, omit(_airwallexProps, ["onSuccess", "onError"]))));
71
+ }, omit(_airwallexProps, ['onSuccess', 'onError']))));
72
72
  });
73
- AirwallexPopup.displayName = "AirwallexPopup";
73
+ AirwallexPopup.displayName = 'AirwallexPopup';
74
74
  export default AirwallexPopup;
@@ -1,6 +1,6 @@
1
- /// <reference types="react" />
2
- import { AirwallexProps } from "./interface";
3
- declare const _default: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<AirwallexProps & {
4
- children?: import("react").ReactNode;
5
- } & import("react").RefAttributes<HTMLElement>>>;
1
+ import React from 'react';
2
+ import { AirwallexProps } from './interface';
3
+ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<AirwallexProps & {
4
+ children?: React.ReactNode;
5
+ } & React.RefAttributes<HTMLElement>>>;
6
6
  export default _default;
@@ -7,12 +7,12 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
7
7
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
8
  function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
9
9
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
10
- import { forwardRef, memo, useEffect, useImperativeHandle, useRef } from "react";
11
- import { loadAirwallex } from "airwallex-payment-elements";
12
- import { clientDocument, off, on } from "../utils/dom";
10
+ import React, { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
11
+ import { loadAirwallex } from 'airwallex-payment-elements';
12
+ import { clientDocument, off, on } from '../utils/dom';
13
13
  const Airwallex = /*#__PURE__*/forwardRef((props, ref) => {
14
14
  const {
15
- type = "fullFeaturedCard",
15
+ type = 'fullFeaturedCard',
16
16
  options,
17
17
  initOptions,
18
18
  style,
@@ -25,12 +25,12 @@ const Airwallex = /*#__PURE__*/forwardRef((props, ref) => {
25
25
  useImperativeHandle(ref, () => airwallexRef.current);
26
26
  useEffect(() => {
27
27
  loadAirwallex(_objectSpread({
28
- env: "demo"
28
+ env: 'demo'
29
29
  }, initOptions)).then(airwallex => {
30
30
  if (airwallex) {
31
31
  const cardElement = airwallex.createElement(type, options);
32
32
  if (cardElement) {
33
- cardElement.mount(type); // Injects iFrame into element container
33
+ cardElement.mount(type);
34
34
  }
35
35
  }
36
36
  });
@@ -38,30 +38,24 @@ const Airwallex = /*#__PURE__*/forwardRef((props, ref) => {
38
38
  useEffect(() => {
39
39
  const el = clientDocument === null || clientDocument === void 0 ? void 0 : clientDocument.getElementById(type);
40
40
  const onReady = event => {
41
- // eslint-disable-next-line no-console
42
- console.log("onReady", event);
43
- propsOnReady === null || propsOnReady === void 0 || propsOnReady();
41
+ propsOnReady === null || propsOnReady === void 0 || propsOnReady(event);
44
42
  };
45
43
  const onSuccess = event => {
46
- // eslint-disable-next-line no-console
47
- console.log("onSuccess", event);
48
- propsOnSuccess === null || propsOnSuccess === void 0 || propsOnSuccess();
44
+ propsOnSuccess === null || propsOnSuccess === void 0 || propsOnSuccess(event);
49
45
  };
50
46
  const onError = event => {
51
- // eslint-disable-next-line no-console
52
- console.log("onError", event);
53
- propsOnError === null || propsOnError === void 0 || propsOnError();
47
+ propsOnError === null || propsOnError === void 0 || propsOnError(event);
54
48
  };
55
49
  if (el) {
56
- on(el, "onReady", onReady);
57
- on(el, "onSuccess", onSuccess);
58
- on(el, "onError", onError);
50
+ on(el, 'onReady', onReady);
51
+ on(el, 'onSuccess', onSuccess);
52
+ on(el, 'onError', onError);
59
53
  }
60
54
  return () => {
61
55
  if (el) {
62
- off(el, "onReady", onReady);
63
- off(el, "onSuccess", onSuccess);
64
- off(el, "onError", onError);
56
+ off(el, 'onReady', onReady);
57
+ off(el, 'onSuccess', onSuccess);
58
+ off(el, 'onError', onError);
65
59
  }
66
60
  };
67
61
  }, [type, propsOnReady, propsOnSuccess, propsOnError]);
@@ -69,9 +63,9 @@ const Airwallex = /*#__PURE__*/forwardRef((props, ref) => {
69
63
  ref: airwallexRef,
70
64
  id: String(type),
71
65
  style: _objectSpread({
72
- width: "100%"
66
+ width: '100%'
73
67
  }, style)
74
68
  }, others));
75
69
  });
76
- Airwallex.displayName = "Airwallex";
77
- export default /*#__PURE__*/memo(Airwallex);
70
+ Airwallex.displayName = 'Airwallex';
71
+ export default /*#__PURE__*/React.memo(Airwallex);
@@ -14,9 +14,28 @@ export interface AirwallexProps extends AirwallexElementOption, HTMLAttributes<H
14
14
  * @en Initialization options
15
15
  */
16
16
  initOptions?: InitOptions;
17
- onReady?: () => void;
18
- onSuccess?: () => void;
19
- onError?: () => void;
17
+ /**
18
+ * @zh 准备就绪回调
19
+ * @en Ready callback
20
+ */
21
+ onReady?: (event: any) => void;
22
+ /**
23
+ * @zh 成功回调
24
+ * @en Success callback
25
+ */
26
+ onSuccess?: (event: any) => void;
27
+ /**
28
+ * @zh 错误回调
29
+ * @en Error callback
30
+ */
31
+ onError?: (event: any) => void;
32
+ }
33
+ export interface AirwallexRedirectProps {
34
+ /**
35
+ * @zh 支付页面链接
36
+ * @en Payment page URL
37
+ */
38
+ airwallexUrl: string;
20
39
  }
21
40
  export interface AirwallexPopupProps extends PayPopupBaseProps {
22
41
  /**
@@ -41,26 +60,56 @@ export interface AirwallexPopupRef {
41
60
  * @zh 创建订单函数,返回 Stripe 所需参数
42
61
  * @en Function to create order, returns Stripe required params
43
62
  */
44
- export type CreateOrderAirwallexFn = () => Promise<AirwallexProps>;
45
- export interface AirwallexRedirectProps {
46
- airwallexUrl: string;
47
- }
63
+ export type CreateOrderAirwallexEmbeddedFn = () => Promise<AirwallexProps>;
64
+ export type CreateOrderAirwallexRedirectFn = () => Promise<AirwallexRedirectProps>;
48
65
  export interface AirwallexButtonRedirectProps extends ButtonProps {
66
+ /**
67
+ * @zh 支付模式,redirect 会打开 Airwallex 支付页面
68
+ * @en Payment mode, redirect will open the Airwallex payment page
69
+ */
49
70
  payMode: 'redirect';
50
- maskProps?: Omit<PayMaskProps, 'visible' | 'payUrl'>;
71
+ /**
72
+ * @zh 蒙层属性
73
+ * @en Mask props
74
+ */
75
+ maskProps?: PayMaskProps;
76
+ /**
77
+ * @zh Airwallex 支付页面链接
78
+ * @en Airwallex payment page URL
79
+ */
51
80
  airwallexUrl?: string;
52
- createOrder?: () => Promise<AirwallexRedirectProps>;
81
+ /**
82
+ * @zh 创建订单函数,返回 Airwallex 所需参数
83
+ * @en Function to create order, returns Airwallex required params
84
+ */
85
+ createOrder?: CreateOrderAirwallexRedirectFn;
53
86
  }
54
87
  export interface AirwallexButtonEmbeddedBaseProps extends ButtonProps {
88
+ /**
89
+ * @zh 支付模式,embedded 会打开 Airwallex 支付页面
90
+ * @en Payment mode, embedded will open the Airwallex payment page
91
+ */
55
92
  payMode: 'embedded';
56
- createOrder?: CreateOrderAirwallexFn;
93
+ /**
94
+ * @zh 创建订单函数,返回 Airwallex 所需参数
95
+ * @en Function to create order, returns Airwallex required params
96
+ */
97
+ createOrder?: CreateOrderAirwallexEmbeddedFn;
57
98
  }
58
99
  export interface AirwallexButtonEmbeddedModalProps extends AirwallexButtonEmbeddedBaseProps {
59
100
  displayType: 'modal';
101
+ /**
102
+ * @zh 弹窗属性
103
+ * @en Modal props
104
+ */
60
105
  modalProps?: AirwallexModalProps;
61
106
  }
62
107
  export interface AirwallexButtonEmbeddedPopupProps extends AirwallexButtonEmbeddedBaseProps {
63
108
  displayType: 'popup';
109
+ /**
110
+ * @zh 弹出层 属性
111
+ * @en Popup props
112
+ */
64
113
  popupProps?: AirwallexPopupProps;
65
114
  }
66
115
  export type AirwallexButtonProps = AirwallexButtonRedirectProps | AirwallexButtonEmbeddedModalProps | AirwallexButtonEmbeddedPopupProps;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { AlipayButtonProps } from './interface';
3
- declare const AlipayButton: React.ForwardRefExoticComponent<AlipayButtonProps & {
3
+ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<AlipayButtonProps & {
4
4
  children?: React.ReactNode;
5
- } & React.RefAttributes<import("../Button").ButtonRef>>;
6
- export default AlipayButton;
5
+ } & React.RefAttributes<import("../Button").ButtonRef>>>;
6
+ export default _default;
@@ -2,7 +2,7 @@ const _excluded = ["className", "children", "onClick", "createOrder", "modalProp
2
2
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
3
3
  function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
4
4
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
5
- import React, { forwardRef, useCallback, useImperativeHandle, useRef } from 'react';
5
+ import React, { forwardRef, memo, useCallback, useImperativeHandle, useRef } from 'react';
6
6
  import cs from '../utils/classNames';
7
7
  import AlipayModal from './alipay-modal';
8
8
  import Button from '../Button';
@@ -49,4 +49,4 @@ const AlipayButton = /*#__PURE__*/forwardRef((props, ref) => {
49
49
  }, modalProps)));
50
50
  });
51
51
  AlipayButton.displayName = 'AlipayButton';
52
- export default AlipayButton;
52
+ export default /*#__PURE__*/memo(AlipayButton);
@@ -1,6 +1,6 @@
1
- import React from "react";
2
- import { AlipayModalProps, AlipayModalRef } from "./interface";
3
- declare const AlipayModal: React.ForwardRefExoticComponent<AlipayModalProps & {
1
+ import React from 'react';
2
+ import { AlipayModalProps, AlipayModalRef } from './interface';
3
+ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<AlipayModalProps & {
4
4
  children?: React.ReactNode;
5
- } & React.RefAttributes<AlipayModalRef>>;
6
- export default AlipayModal;
5
+ } & React.RefAttributes<AlipayModalRef>>>;
6
+ export default _default;
@@ -2,9 +2,9 @@ const _excluded = ["alipayProps", "visible", "onClose"];
2
2
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
3
3
  function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
4
4
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
5
- import React, { useImperativeHandle, useRef, useState } from "react";
6
- import PayModal from "../pay-modal";
7
- import Alipay from "./alipay";
5
+ import React, { memo, useImperativeHandle, useRef, useState } from 'react';
6
+ import PayModal from '../pay-modal';
7
+ import Alipay from './alipay';
8
8
  const AlipayModal = /*#__PURE__*/React.forwardRef((props, ref) => {
9
9
  const {
10
10
  alipayProps: propsAlipayProps,
@@ -41,5 +41,5 @@ const AlipayModal = /*#__PURE__*/React.forwardRef((props, ref) => {
41
41
  }
42
42
  }, others), (_alipayProps === null || _alipayProps === void 0 ? void 0 : _alipayProps.formHtml) && /*#__PURE__*/React.createElement(Alipay, _alipayProps));
43
43
  });
44
- AlipayModal.displayName = "AlipayModal";
45
- export default AlipayModal;
44
+ AlipayModal.displayName = 'AlipayModal';
45
+ export default /*#__PURE__*/memo(AlipayModal);
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import { AlipayProps } from './interface';
3
- declare const AlipayQrIframe: React.FC<AlipayProps>;
4
- export default AlipayQrIframe;
3
+ declare const _default: React.NamedExoticComponent<AlipayProps>;
4
+ export default _default;
@@ -3,7 +3,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
3
3
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
4
4
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
5
5
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
6
- import React, { useState } from 'react';
6
+ import React, { memo, useState } from 'react';
7
7
  import FullScreenLoading from '../FullScreenLoading';
8
8
  import { getPrefixCls } from '../utils/getPrefixCls';
9
9
  import cs from '../utils/classNames';
@@ -12,8 +12,10 @@ const AlipayQrIframe = _ref => {
12
12
  let {
13
13
  formHtml,
14
14
  tipText = '请使用支付宝APP扫码支付',
15
- className = '',
16
- style = {}
15
+ wrapperClassName = '',
16
+ wrapperStyle = {},
17
+ iframeClassName = '',
18
+ iframeStyle = {}
17
19
  } = _ref;
18
20
  const [loading, setLoading] = useState(true);
19
21
  return /*#__PURE__*/React.createElement(FullScreenLoading, {
@@ -22,18 +24,18 @@ const AlipayQrIframe = _ref => {
22
24
  text: null,
23
25
  fullscreen: false
24
26
  }, /*#__PURE__*/React.createElement("div", {
25
- className: classPrefix,
27
+ className: cs(classPrefix, wrapperClassName),
26
28
  style: _objectSpread({
27
29
  position: 'relative'
28
- }, style)
30
+ }, wrapperStyle)
29
31
  }, /*#__PURE__*/React.createElement("iframe", {
30
32
  srcDoc: formHtml,
31
- className: cs("".concat(classPrefix, "__iframe"), className),
32
- style: {
33
+ className: cs("".concat(classPrefix, "__iframe"), iframeClassName),
34
+ style: _objectSpread({
33
35
  width: 210,
34
36
  height: 210,
35
37
  border: 'none'
36
- },
38
+ }, iframeStyle),
37
39
  title: "alipay-qrcode",
38
40
  scrolling: "no",
39
41
  onLoad: () => setLoading(false)
@@ -41,4 +43,4 @@ const AlipayQrIframe = _ref => {
41
43
  className: "".concat(classPrefix, "__tip")
42
44
  }, tipText)));
43
45
  };
44
- export default AlipayQrIframe;
46
+ export default /*#__PURE__*/memo(AlipayQrIframe);
@@ -1,17 +1,38 @@
1
1
  import React from 'react';
2
2
  import { PayModalProps } from '../pay-modal';
3
3
  import { ButtonProps, ButtonRef } from '../Button';
4
- export interface AlipayProps {
5
- /** 后端返回的 form 字符串,必须包含自动提交脚本 */
6
- formHtml: string;
7
- /** 下方提示文字,可选,传 null/undefined/空字符串则不显示 */
4
+ export interface AlipayProps extends AlipayFormData {
5
+ /**
6
+ * @zh 下方提示文字,可选,传 null/undefined/空字符串则不显示
7
+ * @en Below prompt text, optional, if null/undefined/empty string, it will not be displayed
8
+ */
8
9
  tipText?: string | null;
9
- /** iframe 样式,可选 */
10
- className?: string;
11
- /** iframe 容器样式,可选 */
12
- style?: React.CSSProperties;
10
+ /**
11
+ * @zh 容器 className
12
+ * @en Wrapper div className
13
+ */
14
+ wrapperClassName?: string;
15
+ /**
16
+ * @zh 容器 style
17
+ * @en Wrapper div style
18
+ */
19
+ wrapperStyle?: React.CSSProperties;
20
+ /**
21
+ * @zh iframe 的 className
22
+ * @en Iframe className
23
+ */
24
+ iframeClassName?: string;
25
+ /**
26
+ * @zh iframe 的 style
27
+ * @en Iframe style
28
+ */
29
+ iframeStyle?: React.CSSProperties;
13
30
  }
14
31
  export interface AlipayModalProps extends PayModalProps {
32
+ /**
33
+ * @zh 支付宝支付属性
34
+ * @en Alipay payment props
35
+ */
15
36
  alipayProps?: AlipayProps;
16
37
  }
17
38
  export interface AlipayButtonProps extends ButtonProps {
@@ -29,8 +50,8 @@ export interface AlipayButtonProps extends ButtonProps {
29
50
  export type AlipayButtonRef = ButtonRef;
30
51
  export interface AlipayFormData {
31
52
  /**
32
- * @zh 支付宝支付 html 字符串
33
- * @en Alipay payment html string
53
+ * @zh 支付宝支付 html 字符串,必须包含自动提交脚本
54
+ * @en Alipay payment html string, must contain auto submit script
34
55
  */
35
56
  formHtml: string;
36
57
  }
@@ -5,10 +5,10 @@ export declare const Button: React.ForwardRefExoticComponent<{
5
5
  fill?: "none" | "solid" | "outline" | undefined;
6
6
  size?: "small" | "mini" | "middle" | "large" | undefined;
7
7
  block?: boolean | undefined;
8
+ disabled?: boolean | undefined;
8
9
  loading?: boolean | "auto" | undefined;
9
10
  loadingText?: string | undefined;
10
11
  loadingIcon?: React.ReactNode;
11
- disabled?: boolean | undefined;
12
12
  onClick?: ((event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void | Promise<void>) | undefined;
13
13
  type?: "button" | "submit" | "reset" | undefined;
14
14
  shape?: "default" | "rounded" | "rectangular" | undefined;
@@ -1,20 +1,71 @@
1
- import type { NativeProps } from "../utils/native-props";
2
- import type { ButtonHTMLAttributes, DetailedHTMLProps, ReactNode } from "react";
1
+ import type { NativeProps } from '../utils/native-props';
2
+ import type { ButtonHTMLAttributes, DetailedHTMLProps, ReactNode } from 'react';
3
3
  type NativeButtonProps = DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;
4
4
  export type ButtonProps = {
5
- color?: "default" | "primary" | "success" | "warning" | "danger";
6
- fill?: "solid" | "outline" | "none";
7
- size?: "mini" | "small" | "middle" | "large";
5
+ /**
6
+ * @zh 按钮颜色
7
+ * @en Button color
8
+ * @default 'default'
9
+ */
10
+ color?: 'default' | 'primary' | 'success' | 'warning' | 'danger';
11
+ /**
12
+ * @zh 按钮填充类型
13
+ * @en Button fill type
14
+ */
15
+ fill?: 'solid' | 'outline' | 'none';
16
+ /**
17
+ * @zh 按钮大小
18
+ * @en Button size
19
+ * @default 'middle'
20
+ */
21
+ size?: 'mini' | 'small' | 'middle' | 'large';
22
+ /**
23
+ * @zh 按钮是否块级
24
+ * @en Button block
25
+ * @default false
26
+ */
8
27
  block?: boolean;
9
- loading?: boolean | "auto";
28
+ /**
29
+ * @zh 按钮是否禁用
30
+ * @en Button disabled
31
+ * @default false
32
+ */
33
+ disabled?: boolean;
34
+ /**
35
+ * @zh 按钮是否加载中
36
+ * @en Button loading
37
+ * @default false
38
+ */
39
+ loading?: boolean | 'auto';
40
+ /**
41
+ * @zh 加载中文字
42
+ * @en Loading text
43
+ */
10
44
  loadingText?: string;
45
+ /**
46
+ * @zh 加载中图标
47
+ * @en Loading icon
48
+ */
11
49
  loadingIcon?: ReactNode;
12
- disabled?: boolean;
50
+ /**
51
+ * @zh 点击事件
52
+ * @en Click event
53
+ */
13
54
  onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void | Promise<void>;
14
- type?: "submit" | "reset" | "button";
15
- shape?: "default" | "rounded" | "rectangular";
55
+ /**
56
+ * @zh 按钮类型
57
+ * @en Button type
58
+ * @default 'button'
59
+ */
60
+ type?: 'submit' | 'reset' | 'button';
61
+ /**
62
+ * @zh 按钮形状
63
+ * @en Button shape
64
+ * @default 'default'
65
+ */
66
+ shape?: 'default' | 'rounded' | 'rectangular';
16
67
  children?: ReactNode;
17
- } & Pick<NativeButtonProps, "onMouseDown" | "onMouseUp" | "onTouchStart" | "onTouchEnd" | "id" | "form"> & NativeProps;
68
+ } & Pick<NativeButtonProps, 'onMouseDown' | 'onMouseUp' | 'onTouchStart' | 'onTouchEnd' | 'id' | 'form'> & NativeProps;
18
69
  export type ButtonRef = {
19
70
  nativeElement: HTMLButtonElement | null;
20
71
  };
@@ -1,12 +1,7 @@
1
1
  import { ButtonProps, ButtonRef } from '../Button';
2
2
  import { ConfirmModalProps } from '../confirm-modal';
3
3
  import { PayMaskProps } from '../PayMask';
4
- export interface MAlipayButtonProps extends ButtonProps {
5
- /**
6
- * @zh 支付宝支付 html 字符串
7
- * @en Alipay payment html string
8
- */
9
- formHtml?: string;
4
+ export interface MAlipayButtonProps extends ButtonProps, Partial<MAlipayFormData> {
10
5
  /**
11
6
  * @zh 创建订单函数,返回 Paypal 所需参数
12
7
  * @en Function to create order, returns Paypal required params
@@ -2,5 +2,5 @@ import React from 'react';
2
2
  interface MAlipayAutoSubmitProps {
3
3
  formHtml: string;
4
4
  }
5
- declare const MAlipayAutoSubmit: React.FC<MAlipayAutoSubmitProps>;
6
- export default MAlipayAutoSubmit;
5
+ declare const _default: React.NamedExoticComponent<MAlipayAutoSubmitProps>;
6
+ export default _default;
@@ -1,4 +1,4 @@
1
- import { useEffect } from 'react';
1
+ import { memo, useEffect } from 'react';
2
2
  const MAlipayAutoSubmit = _ref => {
3
3
  let {
4
4
  formHtml
@@ -34,4 +34,4 @@ const MAlipayAutoSubmit = _ref => {
34
34
  }, [formHtml]);
35
35
  return null; // 这个组件不渲染任何内容
36
36
  };
37
- export default MAlipayAutoSubmit;
37
+ export default /*#__PURE__*/memo(MAlipayAutoSubmit);
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { MAlipayButtonProps } from './interface';
3
- declare const MAlipayButton: React.ForwardRefExoticComponent<MAlipayButtonProps & {
3
+ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<MAlipayButtonProps & {
4
4
  children?: React.ReactNode;
5
- } & React.RefAttributes<import("../Button").ButtonRef>>;
6
- export default MAlipayButton;
5
+ } & React.RefAttributes<import("../Button").ButtonRef>>>;
6
+ export default _default;