pay-sdk-react 1.1.12 → 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 +34 -25
|
@@ -185,7 +185,7 @@
|
|
|
185
185
|
max-width: 80vw;
|
|
186
186
|
box-shadow: 0 4px 24px #0001;
|
|
187
187
|
text-align: center;
|
|
188
|
-
max-height:
|
|
188
|
+
max-height: 80vh;
|
|
189
189
|
display: flex;
|
|
190
190
|
flex-direction: column;
|
|
191
191
|
}
|
|
@@ -225,7 +225,7 @@
|
|
|
225
225
|
z-index: 1;
|
|
226
226
|
text-align: center;
|
|
227
227
|
overflow-y: auto;
|
|
228
|
-
flex: 1;
|
|
228
|
+
flex: 0 1 auto;
|
|
229
229
|
min-height: 0;
|
|
230
230
|
}
|
|
231
231
|
.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-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}.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-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}.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,44 @@
|
|
|
1
|
+
import { ButtonProps, ButtonRef } from '../Button';
|
|
2
|
+
import { ConfirmModalProps } from '../confirm-modal';
|
|
3
|
+
import { PayMaskProps } from '../PayMask';
|
|
4
|
+
export interface MPixButtonProps extends ButtonProps {
|
|
5
|
+
/**
|
|
6
|
+
* @zh PIX 支付码字符串(可直接传入或通过 createOrder 获取)
|
|
7
|
+
* @en PIX payment code string
|
|
8
|
+
*/
|
|
9
|
+
pixCode?: string;
|
|
10
|
+
/**
|
|
11
|
+
* @zh 创建订单函数,返回 PIX 所需参数
|
|
12
|
+
* @en Function to create order, returns Pix required params
|
|
13
|
+
*/
|
|
14
|
+
createOrder?: CreateOrderMPixFn;
|
|
15
|
+
/**
|
|
16
|
+
* @zh 显示类型,默认值为 "modal"
|
|
17
|
+
* @en Display type, default is "modal"
|
|
18
|
+
* @default "modal"
|
|
19
|
+
*/
|
|
20
|
+
displayType?: 'modal' | 'mask';
|
|
21
|
+
/**
|
|
22
|
+
* @zh 弹窗属性
|
|
23
|
+
* @en Modal props
|
|
24
|
+
*/
|
|
25
|
+
modalProps?: ConfirmModalProps;
|
|
26
|
+
/**
|
|
27
|
+
* @zh 蒙层属性
|
|
28
|
+
* @en Mask props
|
|
29
|
+
*/
|
|
30
|
+
maskProps?: Omit<PayMaskProps, 'visible' | 'payUrl'>;
|
|
31
|
+
}
|
|
32
|
+
export type MPixButtonRef = ButtonRef;
|
|
33
|
+
export interface MPixFormData {
|
|
34
|
+
/**
|
|
35
|
+
* @zh PIX 支付码字符串
|
|
36
|
+
* @en PIX payment code string
|
|
37
|
+
*/
|
|
38
|
+
pixCode: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* @zh 创建订单函数,返回 PIX 所需参数
|
|
42
|
+
* @en Function to create order, returns Pix required params
|
|
43
|
+
*/
|
|
44
|
+
export type CreateOrderMPixFn = () => Promise<MPixFormData>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MPixButtonProps } from './interface';
|
|
3
|
+
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<MPixButtonProps & {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
} & React.RefAttributes<import("../Button").ButtonRef>>>;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,159 @@
|
|
|
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
|
+
var _excluded = ["className", "children", "onClick", "pixCode", "createOrder", "displayType", "modalProps", "maskProps"],
|
|
3
|
+
_excluded2 = ["retryButtonProps", "finishButtonProps", "onClose"],
|
|
4
|
+
_excluded3 = ["onClose"];
|
|
5
|
+
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; }
|
|
6
|
+
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; }
|
|
7
|
+
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; }
|
|
8
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
9
|
+
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); }
|
|
10
|
+
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); }
|
|
11
|
+
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 }; })(); }
|
|
12
|
+
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); }
|
|
13
|
+
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); }
|
|
14
|
+
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); }); }; }
|
|
15
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
16
|
+
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."); }
|
|
17
|
+
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; } }
|
|
18
|
+
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; }
|
|
19
|
+
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; } }
|
|
20
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
21
|
+
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; }
|
|
22
|
+
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; }
|
|
23
|
+
import React, { forwardRef, memo, useCallback, useImperativeHandle, useRef, useState } from 'react';
|
|
24
|
+
import cs from '../utils/classNames';
|
|
25
|
+
import PayMask from '../PayMask';
|
|
26
|
+
import ConfirmModal from '../confirm-modal';
|
|
27
|
+
import Button from '../Button';
|
|
28
|
+
import { IconPix } from '../icons';
|
|
29
|
+
import { getPrefixCls } from '../utils/getPrefixCls';
|
|
30
|
+
import omit from '../utils/omit';
|
|
31
|
+
var MPixButton = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
32
|
+
var className = props.className,
|
|
33
|
+
_props$children = props.children,
|
|
34
|
+
children = _props$children === void 0 ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IconPix, null), "PIX") : _props$children,
|
|
35
|
+
onClick = props.onClick,
|
|
36
|
+
propsPixCode = props.pixCode,
|
|
37
|
+
createOrder = props.createOrder,
|
|
38
|
+
_props$displayType = props.displayType,
|
|
39
|
+
displayType = _props$displayType === void 0 ? 'modal' : _props$displayType,
|
|
40
|
+
modalProps = props.modalProps,
|
|
41
|
+
maskProps = props.maskProps,
|
|
42
|
+
others = _objectWithoutProperties(props, _excluded);
|
|
43
|
+
var _ref = modalProps || {},
|
|
44
|
+
retryButtonProps = _ref.retryButtonProps,
|
|
45
|
+
finishButtonProps = _ref.finishButtonProps,
|
|
46
|
+
onClose = _ref.onClose,
|
|
47
|
+
modalPropsOthers = _objectWithoutProperties(_ref, _excluded2);
|
|
48
|
+
var _ref2 = maskProps || {},
|
|
49
|
+
onMaskClose = _ref2.onClose,
|
|
50
|
+
restMaskProps = _objectWithoutProperties(_ref2, _excluded3);
|
|
51
|
+
var mPixButtonRef = useRef({
|
|
52
|
+
nativeElement: null
|
|
53
|
+
});
|
|
54
|
+
var _useState = useState(false),
|
|
55
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
56
|
+
showMask = _useState2[0],
|
|
57
|
+
setShowMask = _useState2[1];
|
|
58
|
+
var _useState3 = useState(false),
|
|
59
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
60
|
+
showModal = _useState4[0],
|
|
61
|
+
setShowModal = _useState4[1];
|
|
62
|
+
var _useState5 = useState(),
|
|
63
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
64
|
+
pixCode = _useState6[0],
|
|
65
|
+
setPixCode = _useState6[1];
|
|
66
|
+
useImperativeHandle(ref, function () {
|
|
67
|
+
return mPixButtonRef.current;
|
|
68
|
+
});
|
|
69
|
+
var handleRetry = useCallback(function (event) {
|
|
70
|
+
if (displayType === 'modal') {
|
|
71
|
+
var _retryButtonProps$onC;
|
|
72
|
+
retryButtonProps === null || retryButtonProps === void 0 || (_retryButtonProps$onC = retryButtonProps.onClick) === null || _retryButtonProps$onC === void 0 || _retryButtonProps$onC.call(retryButtonProps, event);
|
|
73
|
+
setShowModal(false);
|
|
74
|
+
}
|
|
75
|
+
}, [retryButtonProps, displayType]);
|
|
76
|
+
var handleFinish = useCallback(function (event) {
|
|
77
|
+
if (displayType === 'modal') {
|
|
78
|
+
var _finishButtonProps$on;
|
|
79
|
+
finishButtonProps === null || finishButtonProps === void 0 || (_finishButtonProps$on = finishButtonProps.onClick) === null || _finishButtonProps$on === void 0 || _finishButtonProps$on.call(finishButtonProps, event);
|
|
80
|
+
setShowModal(false);
|
|
81
|
+
}
|
|
82
|
+
}, [finishButtonProps, displayType]);
|
|
83
|
+
var handleDisplay = useCallback(function () {
|
|
84
|
+
if (displayType === 'modal') {
|
|
85
|
+
setShowModal(true);
|
|
86
|
+
} else {
|
|
87
|
+
setShowMask(true);
|
|
88
|
+
}
|
|
89
|
+
}, [displayType]);
|
|
90
|
+
var handleOnCloseModal = useCallback(function () {
|
|
91
|
+
if (displayType === 'modal') {
|
|
92
|
+
onClose === null || onClose === void 0 || onClose();
|
|
93
|
+
setShowModal(false);
|
|
94
|
+
}
|
|
95
|
+
}, [onClose, displayType]);
|
|
96
|
+
var handlePayCreateOrder = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
97
|
+
var _yield$createOrder, code;
|
|
98
|
+
return _regenerator().w(function (_context) {
|
|
99
|
+
while (1) switch (_context.n) {
|
|
100
|
+
case 0:
|
|
101
|
+
if (!createOrder) {
|
|
102
|
+
_context.n = 2;
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
_context.n = 1;
|
|
106
|
+
return createOrder();
|
|
107
|
+
case 1:
|
|
108
|
+
_yield$createOrder = _context.v;
|
|
109
|
+
code = _yield$createOrder.pixCode;
|
|
110
|
+
if (code) {
|
|
111
|
+
handleDisplay();
|
|
112
|
+
setPixCode(code);
|
|
113
|
+
}
|
|
114
|
+
case 2:
|
|
115
|
+
return _context.a(2);
|
|
116
|
+
}
|
|
117
|
+
}, _callee);
|
|
118
|
+
})), [createOrder, handleDisplay]);
|
|
119
|
+
var handleOpen = useCallback(function () {
|
|
120
|
+
if (propsPixCode) {
|
|
121
|
+
handleDisplay();
|
|
122
|
+
setPixCode(propsPixCode);
|
|
123
|
+
}
|
|
124
|
+
}, [propsPixCode, handleDisplay]);
|
|
125
|
+
var handleClick = useCallback(function (e) {
|
|
126
|
+
if (createOrder) {
|
|
127
|
+
handlePayCreateOrder();
|
|
128
|
+
} else {
|
|
129
|
+
handleOpen();
|
|
130
|
+
}
|
|
131
|
+
onClick === null || onClick === void 0 || onClick(e);
|
|
132
|
+
}, [onClick, createOrder, handlePayCreateOrder, handleOpen]);
|
|
133
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, _extends({
|
|
134
|
+
ref: mPixButtonRef,
|
|
135
|
+
className: cs(getPrefixCls('m-pix-btn'), className),
|
|
136
|
+
onClick: handleClick
|
|
137
|
+
}, others), children), displayType === 'mask' && showMask && pixCode && /*#__PURE__*/React.createElement(PayMask, _extends({
|
|
138
|
+
visible: showMask,
|
|
139
|
+
onClose: function onClose() {
|
|
140
|
+
setShowMask(false);
|
|
141
|
+
onMaskClose === null || onMaskClose === void 0 || onMaskClose();
|
|
142
|
+
},
|
|
143
|
+
payUrl: pixCode,
|
|
144
|
+
title: 'PIX'
|
|
145
|
+
}, restMaskProps)), displayType === 'modal' && showModal && pixCode && /*#__PURE__*/React.createElement(ConfirmModal, _extends({
|
|
146
|
+
visible: showModal,
|
|
147
|
+
onClose: handleOnCloseModal,
|
|
148
|
+
retryButtonProps: _objectSpread({
|
|
149
|
+
onClick: handleRetry
|
|
150
|
+
}, omit(retryButtonProps || {}, ['onClick'])),
|
|
151
|
+
finishButtonProps: _objectSpread({
|
|
152
|
+
onClick: handleFinish
|
|
153
|
+
}, omit(finishButtonProps || {}, ['onClick'])),
|
|
154
|
+
payUrl: pixCode,
|
|
155
|
+
autoOpenWindow: true
|
|
156
|
+
}, modalPropsOthers)));
|
|
157
|
+
});
|
|
158
|
+
MPixButton.displayName = 'MPixButton';
|
|
159
|
+
export default /*#__PURE__*/memo(MPixButton);
|
|
@@ -0,0 +1,256 @@
|
|
|
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
|
+
}
|
|
158
|
+
.pay-modal {
|
|
159
|
+
position: fixed;
|
|
160
|
+
z-index: 9999;
|
|
161
|
+
left: 0;
|
|
162
|
+
top: 0;
|
|
163
|
+
right: 0;
|
|
164
|
+
bottom: 0;
|
|
165
|
+
display: flex;
|
|
166
|
+
align-items: center;
|
|
167
|
+
justify-content: center;
|
|
168
|
+
}
|
|
169
|
+
.pay-modal__mask {
|
|
170
|
+
position: absolute;
|
|
171
|
+
left: 0;
|
|
172
|
+
top: 0;
|
|
173
|
+
right: 0;
|
|
174
|
+
bottom: 0;
|
|
175
|
+
background: rgba(0, 0, 0, 0.55);
|
|
176
|
+
z-index: 0;
|
|
177
|
+
}
|
|
178
|
+
.pay-modal__content {
|
|
179
|
+
position: relative;
|
|
180
|
+
z-index: 1;
|
|
181
|
+
background: #fff;
|
|
182
|
+
border-radius: 16px;
|
|
183
|
+
padding: 42px 20px 20px 20px;
|
|
184
|
+
min-width: 280px;
|
|
185
|
+
max-width: 80vw;
|
|
186
|
+
box-shadow: 0 4px 24px #0001;
|
|
187
|
+
text-align: center;
|
|
188
|
+
max-height: 80vh;
|
|
189
|
+
display: flex;
|
|
190
|
+
flex-direction: column;
|
|
191
|
+
}
|
|
192
|
+
.pay-modal__close {
|
|
193
|
+
position: absolute;
|
|
194
|
+
right: 12px;
|
|
195
|
+
top: 12px;
|
|
196
|
+
background: none;
|
|
197
|
+
border: none;
|
|
198
|
+
font-size: 32px;
|
|
199
|
+
font-weight: 500;
|
|
200
|
+
line-height: 32px;
|
|
201
|
+
cursor: pointer;
|
|
202
|
+
text-align: left;
|
|
203
|
+
}
|
|
204
|
+
.pay-modal__icon {
|
|
205
|
+
display: flex;
|
|
206
|
+
justify-content: center;
|
|
207
|
+
margin-bottom: 8px;
|
|
208
|
+
font-size: 40px;
|
|
209
|
+
}
|
|
210
|
+
.pay-modal__title {
|
|
211
|
+
font-size: 20px;
|
|
212
|
+
font-weight: 700;
|
|
213
|
+
color: #222;
|
|
214
|
+
margin-bottom: 12px;
|
|
215
|
+
}
|
|
216
|
+
.pay-modal__desc {
|
|
217
|
+
color: #222;
|
|
218
|
+
font-size: 15px;
|
|
219
|
+
margin-bottom: 24px;
|
|
220
|
+
line-height: 1.7;
|
|
221
|
+
text-align: left;
|
|
222
|
+
}
|
|
223
|
+
.pay-modal__content-wrapper {
|
|
224
|
+
position: relative;
|
|
225
|
+
z-index: 1;
|
|
226
|
+
text-align: center;
|
|
227
|
+
overflow-y: auto;
|
|
228
|
+
flex: 0 1 auto;
|
|
229
|
+
min-height: 0;
|
|
230
|
+
}
|
|
231
|
+
.pay-modal__actions {
|
|
232
|
+
display: flex;
|
|
233
|
+
justify-content: center;
|
|
234
|
+
gap: 16px;
|
|
235
|
+
margin-top: 16px;
|
|
236
|
+
}
|
|
237
|
+
.pay-modal__btn {
|
|
238
|
+
min-width: 96px;
|
|
239
|
+
padding: 8px 0;
|
|
240
|
+
border-radius: 24px;
|
|
241
|
+
border: none;
|
|
242
|
+
font-size: 15px;
|
|
243
|
+
font-weight: 600;
|
|
244
|
+
cursor: pointer;
|
|
245
|
+
transition: background 0.2s;
|
|
246
|
+
}
|
|
247
|
+
.pay-modal__btn--retry {
|
|
248
|
+
background: #fff;
|
|
249
|
+
color: #f25a5a;
|
|
250
|
+
border: 1.5px solid #f25a5a;
|
|
251
|
+
}
|
|
252
|
+
.pay-modal__btn--finish {
|
|
253
|
+
background: #f25a5a;
|
|
254
|
+
color: #fff;
|
|
255
|
+
border: none;
|
|
256
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './index.css';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './index.css';
|
|
@@ -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}.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}
|
|
@@ -185,7 +185,7 @@
|
|
|
185
185
|
max-width: 80vw;
|
|
186
186
|
box-shadow: 0 4px 24px #0001;
|
|
187
187
|
text-align: center;
|
|
188
|
-
max-height:
|
|
188
|
+
max-height: 80vh;
|
|
189
189
|
display: flex;
|
|
190
190
|
flex-direction: column;
|
|
191
191
|
}
|
|
@@ -225,7 +225,7 @@
|
|
|
225
225
|
z-index: 1;
|
|
226
226
|
text-align: center;
|
|
227
227
|
overflow-y: auto;
|
|
228
|
-
flex: 1;
|
|
228
|
+
flex: 0 1 auto;
|
|
229
229
|
min-height: 0;
|
|
230
230
|
}
|
|
231
231
|
.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-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}.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-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}.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}
|
|
@@ -9,6 +9,8 @@ import { MWechatButton } from '../MWeChat';
|
|
|
9
9
|
import { AlipayButton } from '../Alipay';
|
|
10
10
|
import { WechatButton } from '../Wechat';
|
|
11
11
|
import { MAlipayButton } from '../MAlipay';
|
|
12
|
+
import { PixButton } from '../Pix';
|
|
13
|
+
import { MPixButton } from '../MPix';
|
|
12
14
|
var PayButton = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
13
15
|
var typedRef = ref;
|
|
14
16
|
if (props.payMethod === PaymentMethod.PaypalH5 || props.payMethod === PaymentMethod.PaypalPc) {
|
|
@@ -51,6 +53,16 @@ var PayButton = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
51
53
|
ref: typedRef
|
|
52
54
|
}, props));
|
|
53
55
|
}
|
|
56
|
+
if (props.payMethod === PaymentMethod.PixPc) {
|
|
57
|
+
return /*#__PURE__*/React.createElement(PixButton, _extends({
|
|
58
|
+
ref: typedRef
|
|
59
|
+
}, props));
|
|
60
|
+
}
|
|
61
|
+
if (props.payMethod === PaymentMethod.PixH5) {
|
|
62
|
+
return /*#__PURE__*/React.createElement(MPixButton, _extends({
|
|
63
|
+
ref: typedRef
|
|
64
|
+
}, props));
|
|
65
|
+
}
|
|
54
66
|
return null;
|
|
55
67
|
});
|
|
56
68
|
PayButton.displayName = 'PayButton';
|
|
@@ -7,6 +7,8 @@ import { MWeChatButtonProps, MWeChatButtonRef } from '../MWeChat';
|
|
|
7
7
|
import { MAlipayButtonProps, MAlipayButtonRef } from '../MAlipay';
|
|
8
8
|
import { AlipayButtonProps, AlipayButtonRef } from '../Alipay';
|
|
9
9
|
import { WechatButtonProps, WechatButtonRef } from '../Wechat';
|
|
10
|
+
import { PixButtonProps, PixButtonRef } from '../Pix';
|
|
11
|
+
import { MPixButtonProps, MPixButtonRef } from '../MPix';
|
|
10
12
|
/**
|
|
11
13
|
* @zh PayPal 按钮基础属性
|
|
12
14
|
* @en Base props for PayPal button
|
|
@@ -103,14 +105,38 @@ type RealAlipayButtonProps = BaseAlipayButtonProps & AlipayButtonProps;
|
|
|
103
105
|
* @en Full props for Wechat button
|
|
104
106
|
*/
|
|
105
107
|
type RealWechatButtonProps = BaseWechatButtonProps & WechatButtonProps;
|
|
108
|
+
/**
|
|
109
|
+
* @zh PIX 按钮基础属性
|
|
110
|
+
* @en Base props for PIX button
|
|
111
|
+
*/
|
|
112
|
+
interface BasePixButtonProps {
|
|
113
|
+
payMethod: PaymentMethod.PixPc;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* @zh MPix 按钮基础属性
|
|
117
|
+
* @en Base props for MPix button
|
|
118
|
+
*/
|
|
119
|
+
interface BaseMPixButtonProps {
|
|
120
|
+
payMethod: PaymentMethod.PixH5;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* @zh Pix 按钮完整属性
|
|
124
|
+
* @en Full props for Pix button
|
|
125
|
+
*/
|
|
126
|
+
type RealPixButtonProps = BasePixButtonProps & PixButtonProps;
|
|
127
|
+
/**
|
|
128
|
+
* @zh MPix 按钮完整属性
|
|
129
|
+
* @en Full props for MPix button
|
|
130
|
+
*/
|
|
131
|
+
type RealMPixButtonProps = BaseMPixButtonProps & MPixButtonProps;
|
|
106
132
|
/**
|
|
107
133
|
* @zh 支付按钮属性联合类型,根据 payMethod 自动分发
|
|
108
134
|
* @en Union type for pay button props, auto-dispatch by payMethod
|
|
109
135
|
*/
|
|
110
|
-
export type PayButtonProps = RealPaypalButtonProps | RealStripeButtonProps | RealAirwallexButtonProps | RealPayssionButtonProps | RealMWeChatButtonProps | RealMAlipayButtonProps | RealAlipayButtonProps | RealWechatButtonProps;
|
|
136
|
+
export type PayButtonProps = RealPaypalButtonProps | RealStripeButtonProps | RealAirwallexButtonProps | RealPayssionButtonProps | RealMWeChatButtonProps | RealMAlipayButtonProps | RealAlipayButtonProps | RealWechatButtonProps | RealPixButtonProps | RealMPixButtonProps;
|
|
111
137
|
/**
|
|
112
138
|
* @zh 通用的支付按钮 ref 类型,支持所有支付方式
|
|
113
139
|
* @en Generic pay button ref type that supports all payment methods
|
|
114
140
|
*/
|
|
115
|
-
export type GenericPayButtonRef = PaypalButtonRef | StripeButtonRef | AirwallexButtonRef | PayssionButtonRef | MWeChatButtonRef | MAlipayButtonRef | AlipayButtonRef | WechatButtonRef;
|
|
141
|
+
export type GenericPayButtonRef = PaypalButtonRef | StripeButtonRef | AirwallexButtonRef | PayssionButtonRef | MWeChatButtonRef | MAlipayButtonRef | AlipayButtonRef | WechatButtonRef | PixButtonRef | MPixButtonRef;
|
|
116
142
|
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import Pix from './pix';
|
|
2
|
+
import PixButton from './pix-button';
|
|
3
|
+
import PixModal from './pix-modal';
|
|
4
|
+
type PixComponentType = typeof Pix & {
|
|
5
|
+
Button: typeof PixButton;
|
|
6
|
+
Modal: typeof PixModal;
|
|
7
|
+
};
|
|
8
|
+
declare const PixComponent: PixComponentType;
|
|
9
|
+
export * from './interface';
|
|
10
|
+
export default PixComponent;
|
|
11
|
+
export { PixButton, PixModal };
|