pay-sdk-react 1.1.2 → 1.1.4

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 (242) hide show
  1. package/README.md +37 -19
  2. package/README.zh-CN.md +37 -19
  3. package/dist/css/index.css +703 -1
  4. package/dist/css/index.min.css +1 -0
  5. package/dist/es/Airwallex/airwallex-button.js +56 -36
  6. package/dist/es/Airwallex/airwallex-modal.js +41 -34
  7. package/dist/es/Airwallex/airwallex-popup.js +43 -38
  8. package/dist/es/Airwallex/airwallex.js +26 -28
  9. package/dist/es/Airwallex/index.js +1 -1
  10. package/dist/es/Airwallex/style/index.css +335 -1
  11. package/dist/es/Airwallex/style/index.min.css +1 -0
  12. package/dist/es/Alipay/alipay-button.js +39 -24
  13. package/dist/es/Alipay/alipay-modal.js +37 -31
  14. package/dist/es/Alipay/alipay.js +22 -15
  15. package/dist/es/Alipay/index.d.ts +4 -4
  16. package/dist/es/Alipay/index.js +5 -5
  17. package/dist/es/Alipay/style/index.css +18 -1
  18. package/dist/es/Alipay/style/index.min.css +1 -0
  19. package/dist/es/Button/button.js +62 -37
  20. package/dist/es/Button/index.d.ts +2 -2
  21. package/dist/es/Button/index.js +2 -2
  22. package/dist/es/Button/style/index.css +95 -1
  23. package/dist/es/Button/style/index.min.css +1 -0
  24. package/dist/es/FullScreenLoading/index.js +40 -40
  25. package/dist/es/FullScreenLoading/interface.d.ts +2 -2
  26. package/dist/es/FullScreenLoading/style/index.css +239 -1
  27. package/dist/es/FullScreenLoading/style/index.min.css +1 -0
  28. package/dist/es/MAlipay/index.js +1 -1
  29. package/dist/es/MAlipay/m-alipay-auto-submit.js +9 -11
  30. package/dist/es/MAlipay/m-alipay-button.js +71 -51
  31. package/dist/es/MAlipay/style/index.css +252 -1
  32. package/dist/es/MAlipay/style/index.min.css +1 -0
  33. package/dist/es/MWeChat/index.d.ts +2 -2
  34. package/dist/es/MWeChat/index.js +2 -2
  35. package/dist/es/MWeChat/m-wechat-button.js +70 -50
  36. package/dist/es/MWeChat/style/index.css +252 -1
  37. package/dist/es/MWeChat/style/index.min.css +1 -0
  38. package/dist/es/Mask/index.d.ts +2 -2
  39. package/dist/es/Mask/index.js +2 -2
  40. package/dist/es/Mask/mask.js +48 -45
  41. package/dist/es/Mask/style/index.css +11 -1
  42. package/dist/es/Mask/style/index.min.css +1 -0
  43. package/dist/es/PayButton/index.js +2 -2
  44. package/dist/es/PayButton/interface.d.ts +9 -9
  45. package/dist/es/PayButton/interface.js +1 -1
  46. package/dist/es/PayMask/index.d.ts +2 -2
  47. package/dist/es/PayMask/index.js +2 -2
  48. package/dist/es/PayMask/interface.d.ts +8 -2
  49. package/dist/es/PayMask/pay-mask.js +48 -40
  50. package/dist/es/PayMask/style/index.css +62 -1
  51. package/dist/es/PayMask/style/index.min.css +1 -0
  52. package/dist/es/Paypal/index.d.ts +2 -2
  53. package/dist/es/Paypal/index.js +2 -2
  54. package/dist/es/Paypal/paypal-button.js +55 -36
  55. package/dist/es/Paypal/style/index.css +207 -1
  56. package/dist/es/Paypal/style/index.min.css +1 -0
  57. package/dist/es/Payssion/index.d.ts +2 -2
  58. package/dist/es/Payssion/index.js +2 -2
  59. package/dist/es/Payssion/payssion-button.js +56 -37
  60. package/dist/es/Payssion/style/index.css +157 -1
  61. package/dist/es/Payssion/style/index.min.css +1 -0
  62. package/dist/es/Stripe/index.d.ts +5 -5
  63. package/dist/es/Stripe/index.js +6 -6
  64. package/dist/es/Stripe/stripe-button.js +47 -33
  65. package/dist/es/Stripe/stripe-modal.js +38 -32
  66. package/dist/es/Stripe/stripe-popup.js +42 -37
  67. package/dist/es/Stripe/stripe.js +15 -15
  68. package/dist/es/Stripe/style/index.css +365 -1
  69. package/dist/es/Stripe/style/index.min.css +1 -0
  70. package/dist/es/Wechat/index.d.ts +4 -4
  71. package/dist/es/Wechat/index.js +5 -5
  72. package/dist/es/Wechat/style/index.css +25 -1
  73. package/dist/es/Wechat/style/index.min.css +1 -0
  74. package/dist/es/Wechat/wechat-button.js +38 -23
  75. package/dist/es/Wechat/wechat-modal.js +37 -31
  76. package/dist/es/Wechat/wechat.js +16 -12
  77. package/dist/es/confirm-modal/index.js +42 -39
  78. package/dist/es/confirm-modal/interface.d.ts +8 -2
  79. package/dist/es/confirm-modal/style/index.css +95 -1
  80. package/dist/es/confirm-modal/style/index.min.css +1 -0
  81. package/dist/es/dot-loading/dot-loading.js +25 -23
  82. package/dist/es/dot-loading/index.d.ts +2 -2
  83. package/dist/es/dot-loading/index.js +2 -2
  84. package/dist/es/dot-loading/style/index.css +3 -1
  85. package/dist/es/dot-loading/style/index.min.css +1 -0
  86. package/dist/es/hooks/use-initialized.js +2 -2
  87. package/dist/es/hooks/use-inner-visible.js +8 -4
  88. package/dist/es/hooks/use-lock-scroll.d.ts +2 -2
  89. package/dist/es/hooks/use-lock-scroll.js +30 -34
  90. package/dist/es/hooks/use-touch.d.ts +1 -1
  91. package/dist/es/hooks/use-touch.js +35 -31
  92. package/dist/es/hooks/usePayWindowOpen.d.ts +16 -10
  93. package/dist/es/hooks/usePayWindowOpen.js +81 -37
  94. package/dist/es/icons/IconAlipay/index.js +18 -16
  95. package/dist/es/icons/IconClose/index.js +24 -22
  96. package/dist/es/icons/IconPaypalText/index.js +24 -22
  97. package/dist/es/icons/IconPaypalWhite/index.js +19 -17
  98. package/dist/es/icons/IconPayssionPay/index.js +47 -45
  99. package/dist/es/icons/IconStripe/index.js +19 -17
  100. package/dist/es/icons/IconStripeText/index.js +19 -17
  101. package/dist/es/icons/IconWechatPay/index.js +18 -16
  102. package/dist/es/icons/interface.d.ts +1 -1
  103. package/dist/es/icons/style/index.css +45 -1
  104. package/dist/es/icons/style/index.min.css +1 -0
  105. package/dist/es/pay-modal/index.d.ts +2 -2
  106. package/dist/es/pay-modal/index.js +2 -2
  107. package/dist/es/pay-modal/pay-modal.js +45 -48
  108. package/dist/es/pay-modal/style/index.css +95 -1
  109. package/dist/es/pay-modal/style/index.min.css +1 -0
  110. package/dist/es/pay-popup/index.js +51 -53
  111. package/dist/es/pay-popup/interface.d.ts +6 -6
  112. package/dist/es/pay-popup/style/index.css +145 -1
  113. package/dist/es/pay-popup/style/index.min.css +1 -0
  114. package/dist/es/shared/enums/index.d.ts +21 -0
  115. package/dist/es/shared/enums/index.js +24 -1
  116. package/dist/es/shared/index.d.ts +1 -1
  117. package/dist/es/shared/index.js +1 -1
  118. package/dist/es/utils/can-use-dom.js +1 -1
  119. package/dist/es/utils/classNames.js +15 -11
  120. package/dist/es/utils/dom.js +18 -18
  121. package/dist/es/utils/get-container.js +2 -2
  122. package/dist/es/utils/get-scroll-parent.js +8 -9
  123. package/dist/es/utils/is.d.ts +10 -1
  124. package/dist/es/utils/is.js +68 -34
  125. package/dist/es/utils/native-props.d.ts +2 -2
  126. package/dist/es/utils/native-props.js +7 -9
  127. package/dist/es/utils/omit.js +3 -5
  128. package/dist/es/utils/qrcode.js +5 -5
  129. package/dist/es/utils/render-to-container.d.ts +1 -1
  130. package/dist/es/utils/render-to-container.js +4 -4
  131. package/dist/es/utils/should-render.d.ts +1 -1
  132. package/dist/es/utils/should-render.js +4 -4
  133. package/dist/es/utils/supports-passive.js +8 -7
  134. package/dist/es/utils/warning.js +0 -1
  135. package/dist/es/utils/with-default-props.js +6 -4
  136. package/dist/es/utils/with-stop-propagation.d.ts +3 -3
  137. package/dist/es/utils/with-stop-propagation.js +27 -14
  138. package/dist/lib/Airwallex/airwallex-button.js +12 -15
  139. package/dist/lib/Airwallex/airwallex-modal.js +11 -14
  140. package/dist/lib/Airwallex/airwallex-popup.js +16 -23
  141. package/dist/lib/Airwallex/airwallex.js +20 -25
  142. package/dist/lib/Airwallex/index.js +1 -1
  143. package/dist/lib/Airwallex/style/index.css +335 -1
  144. package/dist/lib/Airwallex/style/index.min.css +1 -0
  145. package/dist/lib/Alipay/alipay-button.js +12 -15
  146. package/dist/lib/Alipay/alipay-modal.js +9 -12
  147. package/dist/lib/Alipay/alipay.js +19 -23
  148. package/dist/lib/Alipay/index.js +1 -1
  149. package/dist/lib/Alipay/style/index.css +18 -1
  150. package/dist/lib/Alipay/style/index.min.css +1 -0
  151. package/dist/lib/Button/button.js +13 -13
  152. package/dist/lib/Button/index.js +1 -1
  153. package/dist/lib/Button/style/index.css +95 -1
  154. package/dist/lib/Button/style/index.min.css +1 -0
  155. package/dist/lib/FullScreenLoading/index.js +28 -29
  156. package/dist/lib/FullScreenLoading/style/index.css +239 -1
  157. package/dist/lib/FullScreenLoading/style/index.min.css +1 -0
  158. package/dist/lib/MAlipay/index.js +1 -1
  159. package/dist/lib/MAlipay/m-alipay-auto-submit.js +3 -4
  160. package/dist/lib/MAlipay/m-alipay-button.js +34 -44
  161. package/dist/lib/MAlipay/style/index.css +252 -1
  162. package/dist/lib/MAlipay/style/index.min.css +1 -0
  163. package/dist/lib/MWeChat/index.js +2 -2
  164. package/dist/lib/MWeChat/m-wechat-button.js +34 -44
  165. package/dist/lib/MWeChat/style/index.css +252 -1
  166. package/dist/lib/MWeChat/style/index.min.css +1 -0
  167. package/dist/lib/Mask/index.js +1 -1
  168. package/dist/lib/Mask/mask.js +6 -11
  169. package/dist/lib/Mask/style/index.css +11 -1
  170. package/dist/lib/Mask/style/index.min.css +1 -0
  171. package/dist/lib/PayButton/index.js +10 -10
  172. package/dist/lib/PayMask/index.js +1 -1
  173. package/dist/lib/PayMask/pay-mask.js +26 -24
  174. package/dist/lib/PayMask/style/index.css +62 -1
  175. package/dist/lib/PayMask/style/index.min.css +1 -0
  176. package/dist/lib/Paypal/index.js +2 -2
  177. package/dist/lib/Paypal/paypal-button.js +17 -22
  178. package/dist/lib/Paypal/style/index.css +207 -1
  179. package/dist/lib/Paypal/style/index.min.css +1 -0
  180. package/dist/lib/Payssion/index.js +2 -2
  181. package/dist/lib/Payssion/payssion-button.js +17 -22
  182. package/dist/lib/Payssion/style/index.css +157 -1
  183. package/dist/lib/Payssion/style/index.min.css +1 -0
  184. package/dist/lib/Stripe/index.js +1 -1
  185. package/dist/lib/Stripe/stripe-button.js +14 -17
  186. package/dist/lib/Stripe/stripe-modal.js +10 -13
  187. package/dist/lib/Stripe/stripe-popup.js +16 -23
  188. package/dist/lib/Stripe/stripe.js +8 -11
  189. package/dist/lib/Stripe/style/index.css +365 -1
  190. package/dist/lib/Stripe/style/index.min.css +1 -0
  191. package/dist/lib/Wechat/index.js +1 -1
  192. package/dist/lib/Wechat/style/index.css +25 -1
  193. package/dist/lib/Wechat/style/index.min.css +1 -0
  194. package/dist/lib/Wechat/wechat-button.js +12 -15
  195. package/dist/lib/Wechat/wechat-modal.js +9 -12
  196. package/dist/lib/Wechat/wechat.js +11 -12
  197. package/dist/lib/confirm-modal/index.js +24 -28
  198. package/dist/lib/confirm-modal/style/index.css +95 -1
  199. package/dist/lib/confirm-modal/style/index.min.css +1 -0
  200. package/dist/lib/dot-loading/dot-loading.js +3 -4
  201. package/dist/lib/dot-loading/index.js +1 -1
  202. package/dist/lib/dot-loading/style/index.css +3 -1
  203. package/dist/lib/dot-loading/style/index.min.css +1 -0
  204. package/dist/lib/hooks/use-lock-scroll.js +11 -12
  205. package/dist/lib/hooks/use-touch.js +10 -10
  206. package/dist/lib/hooks/usePayWindowOpen.js +63 -21
  207. package/dist/lib/icons/IconAlipay/index.js +6 -6
  208. package/dist/lib/icons/IconClose/index.js +8 -8
  209. package/dist/lib/icons/IconPaypalText/index.js +7 -7
  210. package/dist/lib/icons/IconPaypalWhite/index.js +6 -6
  211. package/dist/lib/icons/IconPayssionPay/index.js +13 -13
  212. package/dist/lib/icons/IconStripe/index.js +6 -6
  213. package/dist/lib/icons/IconStripeText/index.js +6 -6
  214. package/dist/lib/icons/IconWechatPay/index.js +6 -6
  215. package/dist/lib/icons/index.js +2 -2
  216. package/dist/lib/icons/style/index.css +45 -1
  217. package/dist/lib/icons/style/index.min.css +1 -0
  218. package/dist/lib/index.js +2 -2
  219. package/dist/lib/pay-modal/index.js +1 -1
  220. package/dist/lib/pay-modal/pay-modal.js +24 -30
  221. package/dist/lib/pay-modal/style/index.css +95 -1
  222. package/dist/lib/pay-modal/style/index.min.css +1 -0
  223. package/dist/lib/pay-popup/index.js +24 -28
  224. package/dist/lib/pay-popup/style/index.css +145 -1
  225. package/dist/lib/pay-popup/style/index.min.css +1 -0
  226. package/dist/lib/shared/enums/index.js +23 -1
  227. package/dist/lib/utils/can-use-dom.js +1 -1
  228. package/dist/lib/utils/classNames.js +6 -7
  229. package/dist/lib/utils/dom.js +9 -11
  230. package/dist/lib/utils/get-scroll-parent.js +2 -3
  231. package/dist/lib/utils/getPrefixCls.js +1 -1
  232. package/dist/lib/utils/is.js +32 -17
  233. package/dist/lib/utils/native-props.js +10 -10
  234. package/dist/lib/utils/omit.js +3 -6
  235. package/dist/lib/utils/qrcode.js +1 -1
  236. package/dist/lib/utils/supports-passive.js +4 -3
  237. package/dist/lib/utils/warning.js +2 -6
  238. package/dist/lib/utils/with-default-props.js +4 -8
  239. package/dist/lib/utils/with-stop-propagation.js +6 -9
  240. package/dist/umd/pay-sdk-react.umd.js +218 -130
  241. package/dist/umd/pay-sdk-react.umd.js.map +1 -1
  242. package/package.json +6 -3
@@ -1,55 +1,74 @@
1
- const _excluded = ["className", "children", "onClick", "payssionUrl", "createOrder", "maskProps"],
1
+ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
+ import _asyncToGenerator from "@babel/runtime-corejs3/helpers/esm/asyncToGenerator";
3
+ import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
4
+ import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
5
+ var _excluded = ["className", "children", "onClick", "payssionUrl", "createOrder", "maskProps"],
2
6
  _excluded2 = ["onClose"];
3
- 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); }
4
- 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; }
5
- 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; }
7
+ import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
6
8
  import React, { forwardRef, memo, useCallback, useImperativeHandle, useRef, useState } from 'react';
7
9
  import cs from '../utils/classNames';
8
10
  import PayMask from '../PayMask';
9
11
  import Button from '../Button';
10
12
  import { IconPayssionPay } from '../icons';
11
13
  import { getPrefixCls } from '../utils/getPrefixCls';
12
- const PayssionButton = /*#__PURE__*/forwardRef((props, ref) => {
13
- const {
14
- className,
15
- children = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IconPayssionPay, null), "Payssion"),
16
- onClick,
17
- payssionUrl: propsPayssionUrl,
18
- createOrder,
19
- maskProps
20
- } = props,
14
+ var PayssionButton = /*#__PURE__*/forwardRef(function (props, ref) {
15
+ var className = props.className,
16
+ _props$children = props.children,
17
+ children = _props$children === void 0 ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IconPayssionPay, null), "Payssion") : _props$children,
18
+ onClick = props.onClick,
19
+ propsPayssionUrl = props.payssionUrl,
20
+ createOrder = props.createOrder,
21
+ maskProps = props.maskProps,
21
22
  others = _objectWithoutProperties(props, _excluded);
22
- const _ref = maskProps || {},
23
- {
24
- onClose
25
- } = _ref,
23
+ var _ref = maskProps || {},
24
+ _onClose = _ref.onClose,
26
25
  restMaskProps = _objectWithoutProperties(_ref, _excluded2);
27
- const payssionButtonRef = useRef({
26
+ var payssionButtonRef = useRef({
28
27
  nativeElement: null
29
28
  });
30
- const [showMask, setShowMask] = useState(false);
31
- const [payssionUrl, setPayssionUrl] = useState();
32
- useImperativeHandle(ref, () => payssionButtonRef.current);
33
- const handlePayCreateOrder = useCallback(async () => {
34
- if (createOrder) {
35
- // 1. 业务侧创建订单,获取参数
36
- const {
37
- payssionUrl
38
- } = await (createOrder === null || createOrder === void 0 ? void 0 : createOrder());
39
- if (payssionUrl) {
40
- // 2. 唤起蒙层
41
- setShowMask(true);
42
- setPayssionUrl(payssionUrl);
29
+ var _useState = useState(false),
30
+ _useState2 = _slicedToArray(_useState, 2),
31
+ showMask = _useState2[0],
32
+ setShowMask = _useState2[1];
33
+ var _useState3 = useState(),
34
+ _useState4 = _slicedToArray(_useState3, 2),
35
+ payssionUrl = _useState4[0],
36
+ setPayssionUrl = _useState4[1];
37
+ useImperativeHandle(ref, function () {
38
+ return payssionButtonRef.current;
39
+ });
40
+ var handlePayCreateOrder = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
41
+ var _yield$createOrder, _payssionUrl;
42
+ return _regeneratorRuntime.wrap(function (_context) {
43
+ while (1) switch (_context.prev = _context.next) {
44
+ case 0:
45
+ if (!createOrder) {
46
+ _context.next = 2;
47
+ break;
48
+ }
49
+ _context.next = 1;
50
+ return createOrder();
51
+ case 1:
52
+ _yield$createOrder = _context.sent;
53
+ _payssionUrl = _yield$createOrder.payssionUrl;
54
+ if (_payssionUrl) {
55
+ // 2. 唤起蒙层
56
+ setShowMask(true);
57
+ setPayssionUrl(_payssionUrl);
58
+ }
59
+ case 2:
60
+ case "end":
61
+ return _context.stop();
43
62
  }
44
- }
45
- }, [createOrder]);
46
- const handleOpen = useCallback(() => {
63
+ }, _callee);
64
+ })), [createOrder]);
65
+ var handleOpen = useCallback(function () {
47
66
  if (propsPayssionUrl) {
48
67
  setShowMask(true);
49
68
  setPayssionUrl(propsPayssionUrl);
50
69
  }
51
70
  }, [propsPayssionUrl]);
52
- const handleClick = useCallback(e => {
71
+ var handleClick = useCallback(function (e) {
53
72
  if (createOrder) {
54
73
  handlePayCreateOrder();
55
74
  } else {
@@ -63,9 +82,9 @@ const PayssionButton = /*#__PURE__*/forwardRef((props, ref) => {
63
82
  onClick: handleClick
64
83
  }, others), children), payssionUrl && showMask && /*#__PURE__*/React.createElement(PayMask, _extends({
65
84
  visible: showMask,
66
- onClose: () => {
85
+ onClose: function onClose() {
67
86
  setShowMask(false);
68
- onClose === null || onClose === void 0 || onClose();
87
+ _onClose === null || _onClose === void 0 || _onClose();
69
88
  },
70
89
  payUrl: payssionUrl,
71
90
  title: 'Payssion'
@@ -1 +1,157 @@
1
- .pay-dot-loading{display:inline-block}.pay-button{display:inline-block;padding:7px 12px;font-size:16px;border-radius:4px;border:1px solid #eee;background:#fff;color:#333;cursor:pointer;transition:all .2s;user-select:none;position:relative;text-align:center}.pay-button-content{display:flex;align-items:center;justify-content:center;gap:6px}.pay-button-block{display:block;width:100%}.pay-button-disabled{opacity:.4;cursor:not-allowed}.pay-button-loading{cursor:wait}.pay-button-loading-wrapper{display:flex;align-items:center;justify-content:center;gap:6px}.pay-button-primary{background:#1677ff;border-color:#1677ff;color:#fff}.pay-button-primary:hover{background:#409eff}.pay-button-success{background:#00b578;border-color:#00b578;color:#fff}.pay-button-danger{background:#ff3141;border-color:#ff3141;color:#fff}.pay-button-warning{background:#ff8f1f;border-color:#ff8f1f;color:#fff}.pay-button-default{background:#fff;border-color:#eee;color:#333}.pay-button-fill-outline{background:0 0;color:inherit}.pay-button-fill-none{background:0 0;border:none;color:inherit}.pay-button-mini{font-size:12px;padding:2px 8px}.pay-button-small{font-size:14px;padding:4px 10px}.pay-button-large{font-size:18px;padding:10px 18px}.pay-button-shape-rounded{border-radius:1000px}.pay-button-shape-rectangular{border-radius:0}.pay-mask{position:fixed;z-index:1000;left:0;top:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center}.pay-mask-content{position:relative;width:100%;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:0 88px}.pay-mask-close{position:absolute;right:12px;top:12px;background:0 0;border:none;font-size:28px;color:#fff;cursor:pointer;z-index:1}.pay-mask-title{display:flex;align-items:center;gap:4px;font-weight:700;font-size:28px;color:#fff;margin-bottom:16px;text-shadow:0 2px 8px #000}.pay-mask-title>.pay-icon-paypal-white{width:36px;height:36px}.pay-mask-desc{color:#fff;text-align:center;margin-bottom:24px;line-height:1.5;white-space:pre-line}.pay-mask-continue{color:#fff;font-weight:700;text-decoration:underline;text-underline-offset:4px;cursor:pointer;text-align:center;font-size:18px}
1
+ .pay-dot-loading {
2
+ display: inline-block;
3
+ }
4
+ .pay-button {
5
+ display: inline-block;
6
+ padding: 7px 12px;
7
+ font-size: 16px;
8
+ border-radius: 4px;
9
+ border: 1px solid #eee;
10
+ background: #fff;
11
+ color: #333;
12
+ cursor: pointer;
13
+ transition: all 0.2s;
14
+ user-select: none;
15
+ position: relative;
16
+ text-align: center;
17
+ }
18
+ .pay-button-content {
19
+ display: flex;
20
+ align-items: center;
21
+ justify-content: center;
22
+ gap: 6px;
23
+ }
24
+ .pay-button-block {
25
+ display: block;
26
+ width: 100%;
27
+ }
28
+ .pay-button-disabled {
29
+ opacity: 0.4;
30
+ cursor: not-allowed;
31
+ }
32
+ .pay-button-loading {
33
+ cursor: wait;
34
+ }
35
+ .pay-button-loading-wrapper {
36
+ display: flex;
37
+ align-items: center;
38
+ justify-content: center;
39
+ gap: 6px;
40
+ }
41
+ .pay-button-primary {
42
+ background: #1677ff;
43
+ border-color: #1677ff;
44
+ color: #fff;
45
+ }
46
+ .pay-button-primary:hover {
47
+ background: #409eff;
48
+ }
49
+ .pay-button-success {
50
+ background: #00b578;
51
+ border-color: #00b578;
52
+ color: #fff;
53
+ }
54
+ .pay-button-danger {
55
+ background: #ff3141;
56
+ border-color: #ff3141;
57
+ color: #fff;
58
+ }
59
+ .pay-button-warning {
60
+ background: #ff8f1f;
61
+ border-color: #ff8f1f;
62
+ color: #fff;
63
+ }
64
+ .pay-button-default {
65
+ background: #fff;
66
+ border-color: #eee;
67
+ color: #333;
68
+ }
69
+ .pay-button-fill-outline {
70
+ background: transparent;
71
+ color: inherit;
72
+ }
73
+ .pay-button-fill-none {
74
+ background: transparent;
75
+ border: none;
76
+ color: inherit;
77
+ }
78
+ .pay-button-mini {
79
+ font-size: 12px;
80
+ padding: 2px 8px;
81
+ }
82
+ .pay-button-small {
83
+ font-size: 14px;
84
+ padding: 4px 10px;
85
+ }
86
+ .pay-button-large {
87
+ font-size: 18px;
88
+ padding: 10px 18px;
89
+ }
90
+ .pay-button-shape-rounded {
91
+ border-radius: 1000px;
92
+ }
93
+ .pay-button-shape-rectangular {
94
+ border-radius: 0;
95
+ }
96
+ .pay-mask {
97
+ position: fixed;
98
+ z-index: 1000;
99
+ left: 0;
100
+ top: 0;
101
+ right: 0;
102
+ bottom: 0;
103
+ display: flex;
104
+ align-items: center;
105
+ justify-content: center;
106
+ }
107
+ .pay-mask-content {
108
+ position: relative;
109
+ width: 100%;
110
+ height: 100%;
111
+ display: flex;
112
+ flex-direction: column;
113
+ align-items: center;
114
+ justify-content: center;
115
+ padding: 0 88px;
116
+ }
117
+ .pay-mask-close {
118
+ position: absolute;
119
+ right: 12px;
120
+ top: 12px;
121
+ background: none;
122
+ border: none;
123
+ font-size: 28px;
124
+ color: #fff;
125
+ cursor: pointer;
126
+ z-index: 1;
127
+ }
128
+ .pay-mask-title {
129
+ display: flex;
130
+ align-items: center;
131
+ gap: 4px;
132
+ font-weight: 700;
133
+ font-size: 28px;
134
+ color: #fff;
135
+ margin-bottom: 16px;
136
+ text-shadow: 0 2px 8px #000;
137
+ }
138
+ .pay-mask-title > .pay-icon-paypal-white {
139
+ width: 36px;
140
+ height: 36px;
141
+ }
142
+ .pay-mask-desc {
143
+ color: #fff;
144
+ text-align: center;
145
+ margin-bottom: 24px;
146
+ line-height: 1.5;
147
+ white-space: pre-line;
148
+ }
149
+ .pay-mask-continue {
150
+ color: #fff;
151
+ font-weight: 700;
152
+ text-decoration: underline;
153
+ text-underline-offset: 4px;
154
+ cursor: pointer;
155
+ text-align: center;
156
+ font-size: 18px;
157
+ }
@@ -0,0 +1 @@
1
+ .pay-dot-loading{display:inline-block}.pay-button{display:inline-block;padding:7px 12px;font-size:16px;border-radius:4px;border:1px solid #eee;background:#fff;color:#333;cursor:pointer;transition:.2s;user-select:none;position:relative;text-align:center}.pay-button-content{display:flex;align-items:center;justify-content:center;gap:6px}.pay-button-block{display:block;width:100%}.pay-button-disabled{opacity:.4;cursor:not-allowed}.pay-button-loading{cursor:wait}.pay-button-loading-wrapper{display:flex;align-items:center;justify-content:center;gap:6px}.pay-button-primary{background:#1677ff;border-color:#1677ff;color:#fff}.pay-button-primary:hover{background:#409eff}.pay-button-success{background:#00b578;border-color:#00b578;color:#fff}.pay-button-danger{background:#ff3141;border-color:#ff3141;color:#fff}.pay-button-warning{background:#ff8f1f;border-color:#ff8f1f;color:#fff}.pay-button-default{background:#fff;border-color:#eee;color:#333}.pay-button-fill-outline{background:0 0;color:inherit}.pay-button-fill-none{background:0 0;border:none;color:inherit}.pay-button-mini{font-size:12px;padding:2px 8px}.pay-button-small{font-size:14px;padding:4px 10px}.pay-button-large{font-size:18px;padding:10px 18px}.pay-button-shape-rounded{border-radius:1000px}.pay-button-shape-rectangular{border-radius:0}.pay-mask{position:fixed;z-index:1000;left:0;top:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center}.pay-mask-content{position:relative;width:100%;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:0 88px}.pay-mask-close{position:absolute;right:12px;top:12px;background:0 0;border:none;font-size:28px;color:#fff;cursor:pointer;z-index:1}.pay-mask-title{display:flex;align-items:center;gap:4px;font-weight:700;font-size:28px;color:#fff;margin-bottom:16px;text-shadow:0 2px 8px #000}.pay-mask-title>.pay-icon-paypal-white{width:36px;height:36px}.pay-mask-desc{color:#fff;text-align:center;margin-bottom:24px;line-height:1.5;white-space:pre-line}.pay-mask-continue{color:#fff;font-weight:700;text-decoration:underline;text-underline-offset:4px;cursor:pointer;text-align:center;font-size:18px}
@@ -1,8 +1,8 @@
1
- import Stripe from "./stripe";
2
- import StripePopup from "./stripe-popup";
3
- import StripeButton from "./stripe-button";
4
- import StripeModal from "./stripe-modal";
5
- export * from "./interface";
1
+ import Stripe from './stripe';
2
+ import StripePopup from './stripe-popup';
3
+ import StripeButton from './stripe-button';
4
+ import StripeModal from './stripe-modal';
5
+ export * from './interface';
6
6
  type StripeComponentType = typeof Stripe & {
7
7
  Button: typeof StripeButton;
8
8
  Popup: typeof StripePopup;
@@ -1,9 +1,9 @@
1
- import Stripe from "./stripe";
2
- import StripePopup from "./stripe-popup";
3
- import StripeButton from "./stripe-button";
4
- import StripeModal from "./stripe-modal";
5
- export * from "./interface";
6
- const StripeComponent = Stripe;
1
+ import Stripe from './stripe';
2
+ import StripePopup from './stripe-popup';
3
+ import StripeButton from './stripe-button';
4
+ import StripeModal from './stripe-modal';
5
+ export * from './interface';
6
+ var StripeComponent = Stripe;
7
7
  StripeComponent.Button = StripeButton;
8
8
  StripeComponent.Popup = StripePopup;
9
9
  StripeComponent.Modal = StripeModal;
@@ -1,44 +1,58 @@
1
- const _excluded = ["children", "onClick", "displayType", "stripePopupProps", "stripeModalProps", "createOrder"];
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
- 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
- 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; }
1
+ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
+ import _asyncToGenerator from "@babel/runtime-corejs3/helpers/esm/asyncToGenerator";
3
+ import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
4
+ var _excluded = ["children", "onClick", "displayType", "stripePopupProps", "stripeModalProps", "createOrder"];
5
+ import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
5
6
  import React, { forwardRef, memo, useCallback, useImperativeHandle, useRef } from 'react';
6
7
  import StripePopup from './stripe-popup';
7
8
  import StripeModal from './stripe-modal';
8
9
  import Button from '../Button';
9
- const StripeButton = /*#__PURE__*/forwardRef((props, ref) => {
10
- const {
11
- children = 'Stripe',
12
- onClick,
13
- displayType = 'popup',
14
- stripePopupProps,
15
- stripeModalProps,
16
- createOrder
17
- } = props,
10
+ var StripeButton = /*#__PURE__*/forwardRef(function (props, ref) {
11
+ var _props$children = props.children,
12
+ children = _props$children === void 0 ? 'Stripe' : _props$children,
13
+ onClick = props.onClick,
14
+ _props$displayType = props.displayType,
15
+ displayType = _props$displayType === void 0 ? 'popup' : _props$displayType,
16
+ stripePopupProps = props.stripePopupProps,
17
+ stripeModalProps = props.stripeModalProps,
18
+ createOrder = props.createOrder,
18
19
  others = _objectWithoutProperties(props, _excluded);
19
- const stripeButtonRef = useRef({
20
+ var stripeButtonRef = useRef({
20
21
  nativeElement: null
21
22
  });
22
- const stripePopupRef = useRef(null);
23
- const stripeModalRef = useRef(null);
24
- useImperativeHandle(ref, () => stripeButtonRef.current);
25
- const handlePayCreateOrder = useCallback(async () => {
26
- if (createOrder) {
27
- // 1. 业务侧创建订单,获取参数
28
- const options = await (createOrder === null || createOrder === void 0 ? void 0 : createOrder());
29
- if (options !== null && options !== void 0 && options.clientSecret && options !== null && options !== void 0 && options.stripeKey) {
30
- // 2. 唤起弹窗
31
- if (displayType === 'modal') {
32
- var _stripeModalRef$curre;
33
- (_stripeModalRef$curre = stripeModalRef.current) === null || _stripeModalRef$curre === void 0 || _stripeModalRef$curre.open(options);
34
- } else {
35
- var _stripePopupRef$curre;
36
- (_stripePopupRef$curre = stripePopupRef.current) === null || _stripePopupRef$curre === void 0 || _stripePopupRef$curre.open(options);
37
- }
23
+ var stripePopupRef = useRef(null);
24
+ var stripeModalRef = useRef(null);
25
+ useImperativeHandle(ref, function () {
26
+ return stripeButtonRef.current;
27
+ });
28
+ var handlePayCreateOrder = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
29
+ var options, _stripeModalRef$curre, _stripePopupRef$curre;
30
+ return _regeneratorRuntime.wrap(function (_context) {
31
+ while (1) switch (_context.prev = _context.next) {
32
+ case 0:
33
+ if (!createOrder) {
34
+ _context.next = 2;
35
+ break;
36
+ }
37
+ _context.next = 1;
38
+ return createOrder();
39
+ case 1:
40
+ options = _context.sent;
41
+ if (options !== null && options !== void 0 && options.clientSecret && options !== null && options !== void 0 && options.stripeKey) {
42
+ // 2. 唤起弹窗
43
+ if (displayType === 'modal') {
44
+ (_stripeModalRef$curre = stripeModalRef.current) === null || _stripeModalRef$curre === void 0 || _stripeModalRef$curre.open(options);
45
+ } else {
46
+ (_stripePopupRef$curre = stripePopupRef.current) === null || _stripePopupRef$curre === void 0 || _stripePopupRef$curre.open(options);
47
+ }
48
+ }
49
+ case 2:
50
+ case "end":
51
+ return _context.stop();
38
52
  }
39
- }
40
- }, [createOrder, displayType]);
41
- const handleClick = useCallback(e => {
53
+ }, _callee);
54
+ })), [createOrder, displayType]);
55
+ var handleClick = useCallback(function (e) {
42
56
  if (createOrder) {
43
57
  handlePayCreateOrder();
44
58
  } else {
@@ -1,47 +1,53 @@
1
- const _excluded = ["stripeProps", "visible", "onClose", "className"];
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
- 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
- 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; }
1
+ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
+ import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
3
+ import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
4
+ var _excluded = ["stripeProps", "visible", "onClose", "className"];
5
5
  import React, { memo, useImperativeHandle, useRef, useState } from 'react';
6
6
  import cs from '../utils/classNames';
7
7
  import PayModal from '../pay-modal';
8
8
  import Stripe from './stripe';
9
9
  import { getPrefixCls } from '../utils/getPrefixCls';
10
- const StripeModal = /*#__PURE__*/React.forwardRef((props, ref) => {
11
- const {
12
- stripeProps: propsStripeProps,
13
- visible,
14
- onClose,
15
- className
16
- } = props,
10
+ var StripeModal = /*#__PURE__*/React.forwardRef(function (props, ref) {
11
+ var propsStripeProps = props.stripeProps,
12
+ visible = props.visible,
13
+ _onClose = props.onClose,
14
+ className = props.className,
17
15
  rest = _objectWithoutProperties(props, _excluded);
18
- const stripeRef = useRef(null);
19
- const [uncontrolledVisible, setUncontrolledVisible] = useState(false);
20
- const [stripeProps, setStripeProps] = useState();
21
- const isControlled = visible !== undefined;
22
- const _visible = isControlled ? visible : uncontrolledVisible;
23
- useImperativeHandle(ref, () => ({
24
- open: value => {
25
- if (value) {
26
- setStripeProps(value);
27
- }
28
- setUncontrolledVisible(true);
29
- },
30
- close: () => {
31
- setUncontrolledVisible(false);
32
- onClose === null || onClose === void 0 || onClose();
33
- },
34
- current: stripeRef.current
35
- }));
36
- const _stripeProps = propsStripeProps !== null && propsStripeProps !== void 0 ? propsStripeProps : stripeProps;
16
+ var stripeRef = useRef(null);
17
+ var _useState = useState(false),
18
+ _useState2 = _slicedToArray(_useState, 2),
19
+ uncontrolledVisible = _useState2[0],
20
+ setUncontrolledVisible = _useState2[1];
21
+ var _useState3 = useState(),
22
+ _useState4 = _slicedToArray(_useState3, 2),
23
+ stripeProps = _useState4[0],
24
+ setStripeProps = _useState4[1];
25
+ var isControlled = visible !== undefined;
26
+ var _visible = isControlled ? visible : uncontrolledVisible;
27
+ useImperativeHandle(ref, function () {
28
+ return {
29
+ open: function open(value) {
30
+ if (value) {
31
+ setStripeProps(value);
32
+ }
33
+ setUncontrolledVisible(true);
34
+ },
35
+ close: function close() {
36
+ setUncontrolledVisible(false);
37
+ _onClose === null || _onClose === void 0 || _onClose();
38
+ },
39
+ current: stripeRef.current
40
+ };
41
+ });
42
+ var _stripeProps = propsStripeProps !== null && propsStripeProps !== void 0 ? propsStripeProps : stripeProps;
37
43
  return /*#__PURE__*/React.createElement(PayModal, _extends({
38
44
  className: cs(getPrefixCls('stripe-modal'), className),
39
45
  visible: _visible,
40
- onClose: () => {
46
+ onClose: function onClose() {
41
47
  if (!isControlled) {
42
48
  setUncontrolledVisible(false);
43
49
  }
44
- onClose === null || onClose === void 0 || onClose();
50
+ _onClose === null || _onClose === void 0 || _onClose();
45
51
  },
46
52
  footer: null
47
53
  }, rest), _stripeProps && /*#__PURE__*/React.createElement(Stripe, _stripeProps));
@@ -1,54 +1,59 @@
1
- const _excluded = ["visible", "onClose", "closeOnMaskClick", "className", "bodyStyle", "stripeProps"];
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); }
1
+ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
+ import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
3
+ import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
4
+ import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
5
+ var _excluded = ["visible", "onClose", "closeOnMaskClick", "className", "bodyStyle", "stripeProps"];
3
6
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
7
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
- 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; }
6
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
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
- 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
- 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
8
  import React, { memo, useImperativeHandle, useRef, useState } from 'react';
11
9
  import cs from '../utils/classNames';
12
10
  import Stripe from '.';
13
11
  import PayPopup from '../pay-popup';
14
12
  import { getPrefixCls } from '../utils/getPrefixCls';
15
- const StripePopup = /*#__PURE__*/React.forwardRef((props, ref) => {
16
- const {
17
- visible: controlledVisible,
18
- onClose,
19
- closeOnMaskClick = true,
20
- className,
21
- bodyStyle,
22
- stripeProps: propsStripeProps
23
- } = props,
13
+ var StripePopup = /*#__PURE__*/React.forwardRef(function (props, ref) {
14
+ var controlledVisible = props.visible,
15
+ _onClose = props.onClose,
16
+ _props$closeOnMaskCli = props.closeOnMaskClick,
17
+ closeOnMaskClick = _props$closeOnMaskCli === void 0 ? true : _props$closeOnMaskCli,
18
+ className = props.className,
19
+ bodyStyle = props.bodyStyle,
20
+ propsStripeProps = props.stripeProps,
24
21
  others = _objectWithoutProperties(props, _excluded);
25
- const [uncontrolledVisible, setUncontrolledVisible] = useState(false);
26
- const [stripeProps, setStripeProps] = useState();
27
- const stripeRef = useRef(null);
28
- const isControlled = controlledVisible !== undefined;
29
- const visible = isControlled ? controlledVisible : uncontrolledVisible;
30
- useImperativeHandle(ref, () => ({
31
- open: value => {
32
- if (value) {
33
- setStripeProps(value);
34
- }
35
- setUncontrolledVisible(true);
36
- },
37
- close: () => {
38
- setUncontrolledVisible(false);
39
- onClose === null || onClose === void 0 || onClose();
40
- },
41
- current: stripeRef.current
42
- }));
43
- const _stripeProps = propsStripeProps !== null && propsStripeProps !== void 0 ? propsStripeProps : stripeProps;
22
+ var _useState = useState(false),
23
+ _useState2 = _slicedToArray(_useState, 2),
24
+ uncontrolledVisible = _useState2[0],
25
+ setUncontrolledVisible = _useState2[1];
26
+ var _useState3 = useState(),
27
+ _useState4 = _slicedToArray(_useState3, 2),
28
+ stripeProps = _useState4[0],
29
+ setStripeProps = _useState4[1];
30
+ var stripeRef = useRef(null);
31
+ var isControlled = controlledVisible !== undefined;
32
+ var visible = isControlled ? controlledVisible : uncontrolledVisible;
33
+ useImperativeHandle(ref, function () {
34
+ return {
35
+ open: function open(value) {
36
+ if (value) {
37
+ setStripeProps(value);
38
+ }
39
+ setUncontrolledVisible(true);
40
+ },
41
+ close: function close() {
42
+ setUncontrolledVisible(false);
43
+ _onClose === null || _onClose === void 0 || _onClose();
44
+ },
45
+ current: stripeRef.current
46
+ };
47
+ });
48
+ var _stripeProps = propsStripeProps !== null && propsStripeProps !== void 0 ? propsStripeProps : stripeProps;
44
49
  return /*#__PURE__*/React.createElement(PayPopup, _extends({
45
50
  className: cs(getPrefixCls('stripe-popup'), className),
46
51
  visible: visible,
47
- onClose: () => {
52
+ onClose: function onClose() {
48
53
  if (!isControlled) {
49
54
  setUncontrolledVisible(false);
50
55
  }
51
- onClose === null || onClose === void 0 || onClose();
56
+ _onClose === null || _onClose === void 0 || _onClose();
52
57
  },
53
58
  closeOnMaskClick: closeOnMaskClick,
54
59
  bodyStyle: _objectSpread({