pay-sdk-react 1.1.13 → 1.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +226 -8
- package/README.zh-CN.md +225 -8
- package/dist/css/index.css +75 -6
- package/dist/css/index.min.css +1 -1
- package/dist/es/Airwallex/style/index.css +2 -2
- package/dist/es/Airwallex/style/index.min.css +1 -1
- package/dist/es/Alipay/style/index.css +2 -2
- package/dist/es/Alipay/style/index.min.css +1 -1
- package/dist/es/MAlipay/style/index.css +2 -2
- package/dist/es/MAlipay/style/index.min.css +1 -1
- package/dist/es/MPix/index.d.ts +2 -0
- package/dist/es/MPix/index.js +2 -0
- package/dist/es/MPix/interface.d.ts +44 -0
- package/dist/es/MPix/interface.js +1 -0
- package/dist/es/MPix/m-pix-button.d.ts +6 -0
- package/dist/es/MPix/m-pix-button.js +159 -0
- package/dist/es/MPix/style/index.css +256 -0
- package/dist/es/MPix/style/index.d.ts +1 -0
- package/dist/es/MPix/style/index.js +1 -0
- package/dist/es/MPix/style/index.min.css +1 -0
- package/dist/es/MWeChat/style/index.css +2 -2
- package/dist/es/MWeChat/style/index.min.css +1 -1
- package/dist/es/PayButton/index.js +12 -0
- package/dist/es/PayButton/interface.d.ts +28 -2
- package/dist/es/Pix/index.d.ts +11 -0
- package/dist/es/Pix/index.js +10 -0
- package/dist/es/Pix/interface.d.ts +80 -0
- package/dist/es/Pix/interface.js +1 -0
- package/dist/es/Pix/pix-button.d.ts +6 -0
- package/dist/es/Pix/pix-button.js +80 -0
- package/dist/es/Pix/pix-modal.d.ts +6 -0
- package/dist/es/Pix/pix-modal.js +57 -0
- package/dist/es/Pix/pix.d.ts +4 -0
- package/dist/es/Pix/pix.js +120 -0
- package/dist/es/Pix/style/index.css +69 -0
- package/dist/es/Pix/style/index.d.ts +1 -0
- package/dist/es/Pix/style/index.js +1 -0
- package/dist/es/Pix/style/index.min.css +1 -0
- package/dist/es/Stripe/style/index.css +2 -2
- package/dist/es/Stripe/style/index.min.css +1 -1
- package/dist/es/Wechat/style/index.css +2 -2
- package/dist/es/Wechat/style/index.min.css +1 -1
- package/dist/es/confirm-modal/style/index.css +2 -2
- package/dist/es/confirm-modal/style/index.min.css +1 -1
- package/dist/es/icons/IconCheck/index.d.ts +4 -0
- package/dist/es/icons/IconCheck/index.js +22 -0
- package/dist/es/icons/IconCopy/index.d.ts +4 -0
- package/dist/es/icons/IconCopy/index.js +27 -0
- package/dist/es/icons/IconPix/index.d.ts +4 -0
- package/dist/es/icons/IconPix/index.js +33 -0
- package/dist/es/icons/index.d.ts +3 -0
- package/dist/es/icons/index.js +4 -1
- package/dist/es/index.d.ts +17 -0
- package/dist/es/index.js +9 -0
- package/dist/es/pay-modal/style/index.css +2 -2
- package/dist/es/pay-modal/style/index.min.css +1 -1
- package/dist/es/shared/enums/index.d.ts +11 -1
- package/dist/es/shared/enums/index.js +10 -0
- package/dist/lib/Airwallex/style/index.css +2 -2
- package/dist/lib/Airwallex/style/index.min.css +1 -1
- package/dist/lib/Alipay/style/index.css +2 -2
- package/dist/lib/Alipay/style/index.min.css +1 -1
- package/dist/lib/MAlipay/style/index.css +2 -2
- package/dist/lib/MAlipay/style/index.min.css +1 -1
- package/dist/lib/MPix/index.js +28 -0
- package/dist/lib/MPix/interface.js +5 -0
- package/dist/lib/MPix/m-pix-button.js +127 -0
- package/dist/lib/MPix/style/index.css +256 -0
- package/dist/lib/MPix/style/index.js +3 -0
- package/dist/lib/MPix/style/index.min.css +1 -0
- package/dist/lib/MWeChat/style/index.css +2 -2
- package/dist/lib/MWeChat/style/index.min.css +1 -1
- package/dist/lib/PayButton/index.js +12 -0
- package/dist/lib/Pix/index.js +43 -0
- package/dist/lib/Pix/interface.js +5 -0
- package/dist/lib/Pix/pix-button.js +68 -0
- package/dist/lib/Pix/pix-modal.js +50 -0
- package/dist/lib/Pix/pix.js +92 -0
- package/dist/lib/Pix/style/index.css +69 -0
- package/dist/lib/Pix/style/index.js +3 -0
- package/dist/lib/Pix/style/index.min.css +1 -0
- package/dist/lib/Stripe/style/index.css +2 -2
- package/dist/lib/Stripe/style/index.min.css +1 -1
- package/dist/lib/Wechat/style/index.css +2 -2
- package/dist/lib/Wechat/style/index.min.css +1 -1
- package/dist/lib/confirm-modal/style/index.css +2 -2
- package/dist/lib/confirm-modal/style/index.min.css +1 -1
- package/dist/lib/icons/IconCheck/index.js +27 -0
- package/dist/lib/icons/IconCopy/index.js +32 -0
- package/dist/lib/icons/IconPix/index.js +38 -0
- package/dist/lib/icons/index.js +25 -1
- package/dist/lib/index.js +29 -0
- package/dist/lib/pay-modal/style/index.css +2 -2
- package/dist/lib/pay-modal/style/index.min.css +1 -1
- package/dist/lib/shared/enums/index.js +10 -0
- package/dist/umd/pay-sdk-react.umd.js +304 -69
- package/dist/umd/pay-sdk-react.umd.js.map +1 -1
- package/package.json +29 -24
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import Pix from './pix';
|
|
2
|
+
import PixButton from './pix-button';
|
|
3
|
+
import PixModal from './pix-modal';
|
|
4
|
+
var PixComponent = Object.assign({}, Pix, {
|
|
5
|
+
Button: PixButton,
|
|
6
|
+
Modal: PixModal
|
|
7
|
+
});
|
|
8
|
+
export * from './interface';
|
|
9
|
+
export default PixComponent;
|
|
10
|
+
export { PixButton, PixModal };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PayModalProps } from '../pay-modal';
|
|
3
|
+
import { ButtonProps, ButtonRef } from '../Button';
|
|
4
|
+
export interface PixProps {
|
|
5
|
+
/**
|
|
6
|
+
* @zh PIX 支付码字符串(后端返回的 code_url)
|
|
7
|
+
* @en PIX payment code string (code_url returned by backend)
|
|
8
|
+
*/
|
|
9
|
+
pixCode: string;
|
|
10
|
+
/**
|
|
11
|
+
* @zh 二维码下方提示文字
|
|
12
|
+
* @en Tip text below the QR code
|
|
13
|
+
* @default '请使用银行App扫码支付'
|
|
14
|
+
*/
|
|
15
|
+
tipText?: string;
|
|
16
|
+
/**
|
|
17
|
+
* @zh 是否显示 PIX Code 文本 + 复制按钮
|
|
18
|
+
* @en Whether to show PIX Code text + copy button
|
|
19
|
+
* @default true
|
|
20
|
+
*/
|
|
21
|
+
showCopyButton?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* @zh 容器自定义 class
|
|
24
|
+
* @en Custom class for the container
|
|
25
|
+
*/
|
|
26
|
+
className?: string;
|
|
27
|
+
/**
|
|
28
|
+
* @zh 容器自定义 style
|
|
29
|
+
* @en Custom style for the container
|
|
30
|
+
*/
|
|
31
|
+
style?: React.CSSProperties;
|
|
32
|
+
}
|
|
33
|
+
export interface PixButtonProps extends ButtonProps {
|
|
34
|
+
/**
|
|
35
|
+
* @zh 创建订单函数,返回 Pix 所需参数
|
|
36
|
+
* @en Function to create order, returns Pix required params
|
|
37
|
+
*/
|
|
38
|
+
createOrder?: CreateOrderPixFn;
|
|
39
|
+
/**
|
|
40
|
+
* @zh 弹窗属性
|
|
41
|
+
* @en Modal props
|
|
42
|
+
*/
|
|
43
|
+
modalProps?: PixModalProps;
|
|
44
|
+
}
|
|
45
|
+
export interface PixButtonRef extends ButtonRef {
|
|
46
|
+
/**
|
|
47
|
+
* @zh 打开弹窗
|
|
48
|
+
* @en Open the popup
|
|
49
|
+
*/
|
|
50
|
+
openModal: (options?: PixProps) => void;
|
|
51
|
+
/**
|
|
52
|
+
* @zh 关闭弹窗
|
|
53
|
+
* @en Close the popup
|
|
54
|
+
*/
|
|
55
|
+
closeModal: () => void;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* @zh 创建订单函数,返回 Pix 所需参数
|
|
59
|
+
* @en Function to create order, returns Pix required params
|
|
60
|
+
*/
|
|
61
|
+
export type CreateOrderPixFn = () => Promise<PixProps>;
|
|
62
|
+
export interface PixModalRef {
|
|
63
|
+
/**
|
|
64
|
+
* @zh 打开弹窗
|
|
65
|
+
* @en Open the popup
|
|
66
|
+
*/
|
|
67
|
+
open: (options?: PixProps) => void;
|
|
68
|
+
/**
|
|
69
|
+
* @zh 关闭弹窗
|
|
70
|
+
* @en Close the popup
|
|
71
|
+
*/
|
|
72
|
+
close: () => void;
|
|
73
|
+
}
|
|
74
|
+
export interface PixModalProps extends PayModalProps {
|
|
75
|
+
/**
|
|
76
|
+
* @zh Pix 属性
|
|
77
|
+
* @en Pix props
|
|
78
|
+
*/
|
|
79
|
+
pixProps?: PixProps;
|
|
80
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PixButtonProps, PixButtonRef } from './interface';
|
|
3
|
+
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<PixButtonProps & {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
} & React.RefAttributes<PixButtonRef>>>;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
var _excluded = ["className", "children", "onClick", "createOrder", "modalProps"];
|
|
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 _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
4
|
+
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { if (r) i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n;else { var o = function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); }; o("next", 0), o("throw", 1), o("return", 2); } }, _regeneratorDefine2(e, r, n, t); }
|
|
5
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
6
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
7
|
+
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; }
|
|
8
|
+
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; }
|
|
9
|
+
import React, { forwardRef, memo, useCallback, useImperativeHandle, useRef } from 'react';
|
|
10
|
+
import cs from '../utils/classNames';
|
|
11
|
+
import PixModal from './pix-modal';
|
|
12
|
+
import Button from '../Button';
|
|
13
|
+
import { IconPix } from '../icons';
|
|
14
|
+
import { getPrefixCls } from '../utils/getPrefixCls';
|
|
15
|
+
var PixButton = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
16
|
+
var className = props.className,
|
|
17
|
+
_props$children = props.children,
|
|
18
|
+
children = _props$children === void 0 ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IconPix, null), "PIX") : _props$children,
|
|
19
|
+
onClick = props.onClick,
|
|
20
|
+
createOrder = props.createOrder,
|
|
21
|
+
modalProps = props.modalProps,
|
|
22
|
+
others = _objectWithoutProperties(props, _excluded);
|
|
23
|
+
var pixButtonRef = useRef(null);
|
|
24
|
+
var pixModalRef = useRef(null);
|
|
25
|
+
useImperativeHandle(ref, function () {
|
|
26
|
+
return {
|
|
27
|
+
get nativeElement() {
|
|
28
|
+
var _pixButtonRef$current;
|
|
29
|
+
return ((_pixButtonRef$current = pixButtonRef.current) === null || _pixButtonRef$current === void 0 ? void 0 : _pixButtonRef$current.nativeElement) || null;
|
|
30
|
+
},
|
|
31
|
+
openModal: function openModal(options) {
|
|
32
|
+
var _pixModalRef$current;
|
|
33
|
+
(_pixModalRef$current = pixModalRef.current) === null || _pixModalRef$current === void 0 || _pixModalRef$current.open(options);
|
|
34
|
+
},
|
|
35
|
+
closeModal: function closeModal() {
|
|
36
|
+
var _pixModalRef$current2;
|
|
37
|
+
(_pixModalRef$current2 = pixModalRef.current) === null || _pixModalRef$current2 === void 0 || _pixModalRef$current2.close();
|
|
38
|
+
},
|
|
39
|
+
current: pixButtonRef.current
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
var handlePayCreateOrder = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
43
|
+
var _pixModalRef$current3, options;
|
|
44
|
+
return _regenerator().w(function (_context) {
|
|
45
|
+
while (1) switch (_context.n) {
|
|
46
|
+
case 0:
|
|
47
|
+
if (!createOrder) {
|
|
48
|
+
_context.n = 2;
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
_context.n = 1;
|
|
52
|
+
return createOrder();
|
|
53
|
+
case 1:
|
|
54
|
+
options = _context.v;
|
|
55
|
+
(_pixModalRef$current3 = pixModalRef.current) === null || _pixModalRef$current3 === void 0 || _pixModalRef$current3.open(options);
|
|
56
|
+
case 2:
|
|
57
|
+
return _context.a(2);
|
|
58
|
+
}
|
|
59
|
+
}, _callee);
|
|
60
|
+
})), [createOrder]);
|
|
61
|
+
var handleClick = useCallback(function (e) {
|
|
62
|
+
var _modalProps$pixProps;
|
|
63
|
+
if (createOrder) {
|
|
64
|
+
handlePayCreateOrder();
|
|
65
|
+
} else if (modalProps !== null && modalProps !== void 0 && (_modalProps$pixProps = modalProps.pixProps) !== null && _modalProps$pixProps !== void 0 && _modalProps$pixProps.pixCode) {
|
|
66
|
+
var _pixModalRef$current4;
|
|
67
|
+
pixModalRef === null || pixModalRef === void 0 || (_pixModalRef$current4 = pixModalRef.current) === null || _pixModalRef$current4 === void 0 || _pixModalRef$current4.open();
|
|
68
|
+
}
|
|
69
|
+
onClick === null || onClick === void 0 || onClick(e);
|
|
70
|
+
}, [onClick, createOrder, handlePayCreateOrder, modalProps]);
|
|
71
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, _extends({
|
|
72
|
+
ref: pixButtonRef,
|
|
73
|
+
className: cs(getPrefixCls('pix-btn'), className),
|
|
74
|
+
onClick: handleClick
|
|
75
|
+
}, others), children), /*#__PURE__*/React.createElement(PixModal, _extends({
|
|
76
|
+
ref: pixModalRef
|
|
77
|
+
}, modalProps)));
|
|
78
|
+
});
|
|
79
|
+
PixButton.displayName = 'PixButton';
|
|
80
|
+
export default /*#__PURE__*/memo(PixButton);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PixModalProps, PixModalRef } from './interface';
|
|
3
|
+
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<PixModalProps & {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
} & React.RefAttributes<PixModalRef>>>;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
var _excluded = ["pixProps", "visible", "onClose"];
|
|
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 _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
4
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
5
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
6
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
7
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
8
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
9
|
+
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; }
|
|
10
|
+
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; }
|
|
11
|
+
import React, { memo, useImperativeHandle, useRef, useState } from 'react';
|
|
12
|
+
import PayModal from '../pay-modal';
|
|
13
|
+
import PixQrCode from './pix';
|
|
14
|
+
var PixModal = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
15
|
+
var propsPixProps = props.pixProps,
|
|
16
|
+
visible = props.visible,
|
|
17
|
+
_onClose = props.onClose,
|
|
18
|
+
others = _objectWithoutProperties(props, _excluded);
|
|
19
|
+
var pixRef = useRef(null);
|
|
20
|
+
var _useState = useState(false),
|
|
21
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
22
|
+
uncontrolledVisible = _useState2[0],
|
|
23
|
+
setUncontrolledVisible = _useState2[1];
|
|
24
|
+
var _useState3 = useState(),
|
|
25
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
26
|
+
pixProps = _useState4[0],
|
|
27
|
+
setPixProps = _useState4[1];
|
|
28
|
+
var isControlled = visible !== undefined;
|
|
29
|
+
var _visible = isControlled ? visible : uncontrolledVisible;
|
|
30
|
+
useImperativeHandle(ref, function () {
|
|
31
|
+
return {
|
|
32
|
+
open: function open(value) {
|
|
33
|
+
if (value) {
|
|
34
|
+
setPixProps(value);
|
|
35
|
+
}
|
|
36
|
+
setUncontrolledVisible(true);
|
|
37
|
+
},
|
|
38
|
+
close: function close() {
|
|
39
|
+
setUncontrolledVisible(false);
|
|
40
|
+
_onClose === null || _onClose === void 0 || _onClose();
|
|
41
|
+
},
|
|
42
|
+
current: pixRef.current
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
var _pixProps = propsPixProps !== null && propsPixProps !== void 0 ? propsPixProps : pixProps;
|
|
46
|
+
return /*#__PURE__*/React.createElement(PayModal, _extends({
|
|
47
|
+
visible: _visible,
|
|
48
|
+
onClose: function onClose() {
|
|
49
|
+
if (!isControlled) {
|
|
50
|
+
setUncontrolledVisible(false);
|
|
51
|
+
}
|
|
52
|
+
_onClose === null || _onClose === void 0 || _onClose();
|
|
53
|
+
}
|
|
54
|
+
}, others), (_pixProps === null || _pixProps === void 0 ? void 0 : _pixProps.pixCode) && /*#__PURE__*/React.createElement(PixQrCode, _pixProps));
|
|
55
|
+
});
|
|
56
|
+
PixModal.displayName = 'PixModal';
|
|
57
|
+
export default /*#__PURE__*/memo(PixModal);
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
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; }
|
|
3
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
4
|
+
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); }
|
|
5
|
+
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
6
|
+
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { if (r) i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n;else { var o = function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); }; o("next", 0), o("throw", 1), o("return", 2); } }, _regeneratorDefine2(e, r, n, t); }
|
|
7
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
8
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
9
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
10
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
11
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
12
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
13
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
14
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
15
|
+
import React, { memo, useCallback, useEffect, useRef, useState } from 'react';
|
|
16
|
+
import cs from '../utils/classNames';
|
|
17
|
+
import makeQrcode from '../utils/qrcode';
|
|
18
|
+
import { IconCopy, IconCheck } from '../icons';
|
|
19
|
+
import { getPrefixCls } from '../utils/getPrefixCls';
|
|
20
|
+
var classPrefix = getPrefixCls('pix-qrcode');
|
|
21
|
+
var PixQrCode = function PixQrCode(_ref) {
|
|
22
|
+
var pixCode = _ref.pixCode,
|
|
23
|
+
_ref$tipText = _ref.tipText,
|
|
24
|
+
tipText = _ref$tipText === void 0 ? '请使用银行App扫码支付' : _ref$tipText,
|
|
25
|
+
_ref$showCopyButton = _ref.showCopyButton,
|
|
26
|
+
showCopyButton = _ref$showCopyButton === void 0 ? true : _ref$showCopyButton,
|
|
27
|
+
className = _ref.className,
|
|
28
|
+
style = _ref.style;
|
|
29
|
+
var _useState = useState(''),
|
|
30
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
31
|
+
imageUrl = _useState2[0],
|
|
32
|
+
setImageUrl = _useState2[1];
|
|
33
|
+
var _useState3 = useState(false),
|
|
34
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
35
|
+
copied = _useState4[0],
|
|
36
|
+
setCopied = _useState4[1];
|
|
37
|
+
var timerRef = useRef();
|
|
38
|
+
useEffect(function () {
|
|
39
|
+
if (pixCode) {
|
|
40
|
+
makeQrcode(pixCode).then(function (url) {
|
|
41
|
+
setImageUrl(url);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}, [pixCode]);
|
|
45
|
+
useEffect(function () {
|
|
46
|
+
return function () {
|
|
47
|
+
if (timerRef.current) {
|
|
48
|
+
clearTimeout(timerRef.current);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}, []);
|
|
52
|
+
var handleCopy = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
53
|
+
var textarea, _t;
|
|
54
|
+
return _regenerator().w(function (_context) {
|
|
55
|
+
while (1) switch (_context.n) {
|
|
56
|
+
case 0:
|
|
57
|
+
_context.p = 0;
|
|
58
|
+
_context.n = 1;
|
|
59
|
+
return navigator.clipboard.writeText(pixCode);
|
|
60
|
+
case 1:
|
|
61
|
+
setCopied(true);
|
|
62
|
+
if (timerRef.current) {
|
|
63
|
+
clearTimeout(timerRef.current);
|
|
64
|
+
}
|
|
65
|
+
timerRef.current = setTimeout(function () {
|
|
66
|
+
return setCopied(false);
|
|
67
|
+
}, 2000);
|
|
68
|
+
_context.n = 3;
|
|
69
|
+
break;
|
|
70
|
+
case 2:
|
|
71
|
+
_context.p = 2;
|
|
72
|
+
_t = _context.v;
|
|
73
|
+
// Fallback: use textarea for older browsers
|
|
74
|
+
textarea = document.createElement('textarea');
|
|
75
|
+
textarea.value = pixCode;
|
|
76
|
+
textarea.style.position = 'fixed';
|
|
77
|
+
textarea.style.opacity = '0';
|
|
78
|
+
document.body.appendChild(textarea);
|
|
79
|
+
textarea.select();
|
|
80
|
+
document.execCommand('copy');
|
|
81
|
+
document.body.removeChild(textarea);
|
|
82
|
+
setCopied(true);
|
|
83
|
+
if (timerRef.current) {
|
|
84
|
+
clearTimeout(timerRef.current);
|
|
85
|
+
}
|
|
86
|
+
timerRef.current = setTimeout(function () {
|
|
87
|
+
return setCopied(false);
|
|
88
|
+
}, 2000);
|
|
89
|
+
case 3:
|
|
90
|
+
return _context.a(2);
|
|
91
|
+
}
|
|
92
|
+
}, _callee, null, [[0, 2]]);
|
|
93
|
+
})), [pixCode]);
|
|
94
|
+
if (!imageUrl) {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
98
|
+
className: cs(classPrefix, className),
|
|
99
|
+
style: style
|
|
100
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
101
|
+
className: "".concat(classPrefix, "__container")
|
|
102
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
103
|
+
className: "".concat(classPrefix, "__image"),
|
|
104
|
+
src: imageUrl,
|
|
105
|
+
alt: 'PIX支付二维码'
|
|
106
|
+
})), tipText && /*#__PURE__*/React.createElement("span", {
|
|
107
|
+
className: "".concat(classPrefix, "__tip")
|
|
108
|
+
}, tipText), showCopyButton && /*#__PURE__*/React.createElement("div", {
|
|
109
|
+
className: "".concat(classPrefix, "__code-section")
|
|
110
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
111
|
+
type: "button",
|
|
112
|
+
className: cs("".concat(classPrefix, "__copy-btn"), _defineProperty({}, "".concat(classPrefix, "__copy-btn--copied"), copied)),
|
|
113
|
+
onClick: handleCopy
|
|
114
|
+
}, copied ? /*#__PURE__*/React.createElement(IconCheck, {
|
|
115
|
+
className: "".concat(classPrefix, "__copy-icon")
|
|
116
|
+
}) : /*#__PURE__*/React.createElement(IconCopy, {
|
|
117
|
+
className: "".concat(classPrefix, "__copy-icon")
|
|
118
|
+
}), /*#__PURE__*/React.createElement("span", null, copied ? '已复制' : '复制 PIX Code'))));
|
|
119
|
+
};
|
|
120
|
+
export default /*#__PURE__*/memo(PixQrCode);
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
.pay-pix-qrcode {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
align-items: center;
|
|
5
|
+
}
|
|
6
|
+
.pay-pix-qrcode__container {
|
|
7
|
+
background-color: #fff;
|
|
8
|
+
border-radius: 8px;
|
|
9
|
+
display: flex;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
align-items: center;
|
|
12
|
+
width: 180px;
|
|
13
|
+
height: 180px;
|
|
14
|
+
}
|
|
15
|
+
.pay-pix-qrcode__image {
|
|
16
|
+
width: 100%;
|
|
17
|
+
height: 100%;
|
|
18
|
+
object-fit: cover;
|
|
19
|
+
}
|
|
20
|
+
.pay-pix-qrcode__tip {
|
|
21
|
+
text-align: center;
|
|
22
|
+
color: #333;
|
|
23
|
+
font-size: 14px;
|
|
24
|
+
line-height: 20px;
|
|
25
|
+
margin-top: 12px;
|
|
26
|
+
}
|
|
27
|
+
.pay-pix-qrcode__code-section {
|
|
28
|
+
width: 100%;
|
|
29
|
+
max-width: 320px;
|
|
30
|
+
margin-top: 16px;
|
|
31
|
+
}
|
|
32
|
+
.pay-pix-qrcode__copy-btn {
|
|
33
|
+
width: 100%;
|
|
34
|
+
padding: 10px 16px;
|
|
35
|
+
border: 1px solid #32bcad;
|
|
36
|
+
background-color: #fff;
|
|
37
|
+
color: #32bcad;
|
|
38
|
+
border-radius: 8px;
|
|
39
|
+
font-size: 13px;
|
|
40
|
+
font-weight: 600;
|
|
41
|
+
cursor: pointer;
|
|
42
|
+
transition: all 0.2s ease;
|
|
43
|
+
display: flex;
|
|
44
|
+
align-items: center;
|
|
45
|
+
justify-content: center;
|
|
46
|
+
gap: 6px;
|
|
47
|
+
}
|
|
48
|
+
.pay-pix-qrcode__copy-btn:hover {
|
|
49
|
+
background-color: rgba(50, 188, 173, 0.06);
|
|
50
|
+
}
|
|
51
|
+
.pay-pix-qrcode__copy-btn:active {
|
|
52
|
+
background-color: rgba(50, 188, 173, 0.12);
|
|
53
|
+
}
|
|
54
|
+
.pay-pix-qrcode__copy-btn--copied {
|
|
55
|
+
color: #2ecc71;
|
|
56
|
+
border-color: #2ecc71;
|
|
57
|
+
background-color: rgba(46, 204, 113, 0.04);
|
|
58
|
+
}
|
|
59
|
+
.pay-pix-qrcode__copy-btn--copied:hover {
|
|
60
|
+
background-color: rgba(46, 204, 113, 0.08);
|
|
61
|
+
}
|
|
62
|
+
.pay-pix-qrcode__copy-btn--copied:active {
|
|
63
|
+
background-color: rgba(46, 204, 113, 0.14);
|
|
64
|
+
}
|
|
65
|
+
.pay-pix-qrcode__copy-icon {
|
|
66
|
+
width: 16px;
|
|
67
|
+
height: 16px;
|
|
68
|
+
flex-shrink: 0;
|
|
69
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './index.css';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './index.css';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.pay-pix-qrcode{display:flex;flex-direction:column;align-items:center}.pay-pix-qrcode__container{background-color:#fff;border-radius:8px;display:flex;justify-content:center;align-items:center;width:180px;height:180px}.pay-pix-qrcode__image{width:100%;height:100%;object-fit:cover}.pay-pix-qrcode__tip{text-align:center;color:#333;font-size:14px;line-height:20px;margin-top:12px}.pay-pix-qrcode__code-section{width:100%;max-width:320px;margin-top:16px}.pay-pix-qrcode__copy-btn{width:100%;padding:10px 16px;border:1px solid #32bcad;background-color:#fff;color:#32bcad;border-radius:8px;font-size:13px;font-weight:600;cursor:pointer;transition:.2s;display:flex;align-items:center;justify-content:center;gap:6px}.pay-pix-qrcode__copy-btn:hover{background-color:rgba(50,188,173,.06)}.pay-pix-qrcode__copy-btn:active{background-color:rgba(50,188,173,.12)}.pay-pix-qrcode__copy-btn--copied{color:#2ecc71;border-color:#2ecc71;background-color:rgba(46,204,113,.04)}.pay-pix-qrcode__copy-btn--copied:hover{background-color:rgba(46,204,113,.08)}.pay-pix-qrcode__copy-btn--copied:active{background-color:rgba(46,204,113,.14)}.pay-pix-qrcode__copy-icon{width:16px;height:16px;flex-shrink:0}
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
max-width: 80vw;
|
|
124
124
|
box-shadow: 0 4px 24px #0001;
|
|
125
125
|
text-align: center;
|
|
126
|
-
max-height:
|
|
126
|
+
max-height: 80vh;
|
|
127
127
|
display: flex;
|
|
128
128
|
flex-direction: column;
|
|
129
129
|
}
|
|
@@ -163,7 +163,7 @@
|
|
|
163
163
|
z-index: 1;
|
|
164
164
|
text-align: center;
|
|
165
165
|
overflow-y: auto;
|
|
166
|
-
flex: 1;
|
|
166
|
+
flex: 0 1 auto;
|
|
167
167
|
min-height: 0;
|
|
168
168
|
}
|
|
169
169
|
.pay-modal__actions {
|
|
@@ -1 +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-modal{position:fixed;z-index:9999;left:0;top:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center}.pay-modal__mask{position:absolute;left:0;top:0;right:0;bottom:0;background:rgba(0,0,0,.55);z-index:0}.pay-modal__content{position:relative;z-index:1;background:#fff;border-radius:16px;padding:42px 20px 20px;min-width:280px;max-width:80vw;box-shadow:0 4px 24px #0001;text-align:center;max-height:
|
|
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-modal{position:fixed;z-index:9999;left:0;top:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center}.pay-modal__mask{position:absolute;left:0;top:0;right:0;bottom:0;background:rgba(0,0,0,.55);z-index:0}.pay-modal__content{position:relative;z-index:1;background:#fff;border-radius:16px;padding:42px 20px 20px;min-width:280px;max-width:80vw;box-shadow:0 4px 24px #0001;text-align:center;max-height:80vh;display:flex;flex-direction:column}.pay-modal__close{position:absolute;right:12px;top:12px;background:0 0;border:none;font-size:32px;font-weight:500;line-height:32px;cursor:pointer;text-align:left}.pay-modal__icon{display:flex;justify-content:center;margin-bottom:8px;font-size:40px}.pay-modal__title{font-size:20px;font-weight:700;color:#222;margin-bottom:12px}.pay-modal__desc{color:#222;font-size:15px;margin-bottom:24px;line-height:1.7;text-align:left}.pay-modal__content-wrapper{position:relative;z-index:1;text-align:center;overflow-y:auto;flex:0 1 auto;min-height:0}.pay-modal__actions{display:flex;justify-content:center;gap:16px;margin-top:16px}.pay-modal__btn{min-width:96px;padding:8px 0;border-radius:24px;border:none;font-size:15px;font-weight:600;cursor:pointer;transition:background .2s}.pay-modal__btn--retry{background:#fff;color:#f25a5a;border:1.5px solid #f25a5a}.pay-modal__btn--finish{background:#f25a5a;color:#fff;border:none}.pay-mask{position:fixed;z-index:1000;left:0;top:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center}.pay-icon{display:inline-block;color:inherit;width:16px;vertical-align:-2px;stroke:currentColor}.pay-icon[fill=currentColor]{fill:currentColor;stroke:none}.pay-icon[stroke=currentColor]{stroke:currentColor;fill:none}.pay-icon[fill=currentColor][stroke=currentColor]{fill:currentColor;stroke:currentColor}.pay-icon-paypal-text{width:64px;height:26px;max-width:72px;max-height:32px}.pay-icon-close{width:18px;height:18px}.pay-icon-stripe-text{width:24px;height:24px}.pay-icon-alipay{width:20px;height:20px}.pay-icon-wechat-pay{width:20px;height:20px}.pay-icon-payssion-pay{width:36px;height:20px}.pay-popup{position:fixed;z-index:1001}.pay-popup-body{position:fixed;display:flex;flex-direction:column;background-color:#fff;z-index:1010;box-sizing:border-box}.pay-popup-body.pay-popup-body-position-bottom{width:100%;left:0;bottom:0}.pay-popup-body.pay-popup-body-position-top{width:100%;left:0;top:0}.pay-popup-body.pay-popup-body-position-left{height:100%;width:80vw;left:0;top:0}.pay-popup-body.pay-popup-body-position-right{height:100%;width:80vw;right:0;top:0}.pay-popup-body.pay-popup-body-round.pay-popup-body-position-bottom{border-radius:16px 16px 0 0}.pay-popup-body.pay-popup-body-round.pay-popup-body-position-top{border-radius:0 0 16px 16px}.pay-popup-body.pay-popup-body-round.pay-popup-body-position-left{border-radius:0 16px 16px 0}.pay-popup-body.pay-popup-body-round.pay-popup-body-position-right{border-radius:16px 0 0 16px}.pay-popup-close-icon{position:absolute;z-index:1;cursor:pointer;padding:4px;font-size:18px;line-height:1;color:#999}.pay-popup-body.pay-popup-body-position-bottom .pay-popup-close-icon,.pay-popup-body.pay-popup-body-position-left .pay-popup-close-icon{top:8px;right:8px}.pay-popup-body.pay-popup-body-position-top .pay-popup-close-icon{bottom:8px;right:8px}.pay-popup-body.pay-popup-body-position-right .pay-popup-close-icon{top:8px;left:8px}.pay-popup-content{flex:1;overflow-y:auto;-webkit-overflow-scrolling:touch}.pay-popup-body.pay-popup-body-with-close.pay-popup-body-position-bottom .pay-popup-content,.pay-popup-body.pay-popup-body-with-close.pay-popup-body-position-left .pay-popup-content{padding-top:40px}.pay-popup-body.pay-popup-body-with-close.pay-popup-body-position-right .pay-popup-content{padding-top:40px}.pay-popup-body.pay-popup-body-with-close.pay-popup-body-position-top .pay-popup-content{padding-bottom:40px}@media (min-width:576px){.pay-stripe-modal.pay-modal .pay-modal__content{width:72%}}@media (min-width:768px){.pay-stripe-modal.pay-modal .pay-modal__content{width:50%}}@media (min-width:992px){.pay-stripe-modal.pay-modal .pay-modal__content{width:40%}}@media (min-width:1200px){.pay-stripe-modal.pay-modal .pay-modal__content{width:27%}}@media (min-width:1600px){.pay-stripe-modal.pay-modal .pay-modal__content{width:26%}}@media (min-width:2000px){.pay-stripe-modal.pay-modal .pay-modal__content{width:20%}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.pay-wechat-qrcode{display:flex;flex-direction:column;align-items:center}.pay-wechat-qrcode__container{background-color:#fff;border-radius:8px;display:flex;justify-content:center;align-items:center;width:
|
|
1
|
+
.pay-wechat-qrcode{display:flex;flex-direction:column;align-items:center}.pay-wechat-qrcode__container{background-color:#fff;border-radius:8px;display:flex;justify-content:center;align-items:center;width:180px;height:180px}.pay-wechat-qrcode__image{width:100%;height:100%;object-fit:cover}.pay-wechat-qrcode__tip{text-align:center;color:#333;font-size:14px;line-height:20px}
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
max-width: 80vw;
|
|
29
29
|
box-shadow: 0 4px 24px #0001;
|
|
30
30
|
text-align: center;
|
|
31
|
-
max-height:
|
|
31
|
+
max-height: 80vh;
|
|
32
32
|
display: flex;
|
|
33
33
|
flex-direction: column;
|
|
34
34
|
}
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
z-index: 1;
|
|
69
69
|
text-align: center;
|
|
70
70
|
overflow-y: auto;
|
|
71
|
-
flex: 1;
|
|
71
|
+
flex: 0 1 auto;
|
|
72
72
|
min-height: 0;
|
|
73
73
|
}
|
|
74
74
|
.pay-modal__actions {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.pay-modal{position:fixed;z-index:9999;left:0;top:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center}.pay-modal__mask{position:absolute;left:0;top:0;right:0;bottom:0;background:rgba(0,0,0,.55);z-index:0}.pay-modal__content{position:relative;z-index:1;background:#fff;border-radius:16px;padding:42px 20px 20px;min-width:280px;max-width:80vw;box-shadow:0 4px 24px #0001;text-align:center;max-height:
|
|
1
|
+
.pay-modal{position:fixed;z-index:9999;left:0;top:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center}.pay-modal__mask{position:absolute;left:0;top:0;right:0;bottom:0;background:rgba(0,0,0,.55);z-index:0}.pay-modal__content{position:relative;z-index:1;background:#fff;border-radius:16px;padding:42px 20px 20px;min-width:280px;max-width:80vw;box-shadow:0 4px 24px #0001;text-align:center;max-height:80vh;display:flex;flex-direction:column}.pay-modal__close{position:absolute;right:12px;top:12px;background:0 0;border:none;font-size:32px;font-weight:500;line-height:32px;cursor:pointer;text-align:left}.pay-modal__icon{display:flex;justify-content:center;margin-bottom:8px;font-size:40px}.pay-modal__title{font-size:20px;font-weight:700;color:#222;margin-bottom:12px}.pay-modal__desc{color:#222;font-size:15px;margin-bottom:24px;line-height:1.7;text-align:left}.pay-modal__content-wrapper{position:relative;z-index:1;text-align:center;overflow-y:auto;flex:0 1 auto;min-height:0}.pay-modal__actions{display:flex;justify-content:center;gap:16px;margin-top:16px}.pay-modal__btn{min-width:96px;padding:8px 0;border-radius:24px;border:none;font-size:15px;font-weight:600;cursor:pointer;transition:background .2s}.pay-modal__btn--retry{background:#fff;color:#f25a5a;border:1.5px solid #f25a5a}.pay-modal__btn--finish{background:#f25a5a;color:#fff;border:none}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import omit from '../../utils/omit';
|
|
4
|
+
import { getPrefixCls } from '../../utils/getPrefixCls';
|
|
5
|
+
var classPrefix = getPrefixCls('icon');
|
|
6
|
+
var IconCheck = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
7
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
8
|
+
ref: ref,
|
|
9
|
+
viewBox: "0 0 24 24",
|
|
10
|
+
fill: "none",
|
|
11
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
12
|
+
stroke: "currentColor",
|
|
13
|
+
strokeWidth: "2",
|
|
14
|
+
strokeLinecap: "round",
|
|
15
|
+
strokeLinejoin: "round",
|
|
16
|
+
className: "".concat(classPrefix, " ").concat(classPrefix, "-check")
|
|
17
|
+
}, omit(props, ['className'])), /*#__PURE__*/React.createElement("path", {
|
|
18
|
+
d: "M5 13l4 4L19 7"
|
|
19
|
+
}));
|
|
20
|
+
});
|
|
21
|
+
IconCheck.displayName = 'IconCheck';
|
|
22
|
+
export default IconCheck;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import omit from '../../utils/omit';
|
|
4
|
+
import { getPrefixCls } from '../../utils/getPrefixCls';
|
|
5
|
+
var classPrefix = getPrefixCls('icon');
|
|
6
|
+
var IconCopy = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
7
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
8
|
+
ref: ref,
|
|
9
|
+
viewBox: "0 0 24 24",
|
|
10
|
+
fill: "none",
|
|
11
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
12
|
+
stroke: "currentColor",
|
|
13
|
+
strokeWidth: "2",
|
|
14
|
+
className: "".concat(classPrefix, " ").concat(classPrefix, "-copy")
|
|
15
|
+
}, omit(props, ['className'])), /*#__PURE__*/React.createElement("rect", {
|
|
16
|
+
x: "9",
|
|
17
|
+
y: "9",
|
|
18
|
+
width: "13",
|
|
19
|
+
height: "13",
|
|
20
|
+
rx: "2"
|
|
21
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
22
|
+
d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1",
|
|
23
|
+
strokeLinecap: "round"
|
|
24
|
+
}));
|
|
25
|
+
});
|
|
26
|
+
IconCopy.displayName = 'IconCopy';
|
|
27
|
+
export default IconCopy;
|