pay-sdk-react 1.1.13 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (194) hide show
  1. package/README.md +465 -84
  2. package/README.zh-CN.md +466 -85
  3. package/dist/css/index.css +86 -6
  4. package/dist/css/index.min.css +1 -1
  5. package/dist/es/Airwallex/airwallex-button.js +48 -16
  6. package/dist/es/Airwallex/airwallex-checkout-button.d.ts +4 -0
  7. package/dist/es/Airwallex/airwallex-checkout-button.js +73 -0
  8. package/dist/es/Airwallex/airwallex-managed.d.ts +4 -0
  9. package/dist/es/Airwallex/airwallex-managed.js +87 -0
  10. package/dist/es/Airwallex/airwallex-modal.js +7 -3
  11. package/dist/es/Airwallex/airwallex-popup.js +7 -3
  12. package/dist/es/Airwallex/airwallex.d.ts +1 -3
  13. package/dist/es/Airwallex/airwallex.js +10 -1
  14. package/dist/es/Airwallex/hooks/useAirwallexCheckout.d.ts +7 -0
  15. package/dist/es/Airwallex/hooks/useAirwallexCheckout.js +155 -0
  16. package/dist/es/Airwallex/index.d.ts +4 -0
  17. package/dist/es/Airwallex/index.js +5 -1
  18. package/dist/es/Airwallex/interface.d.ts +146 -0
  19. package/dist/es/Airwallex/style/index.css +2 -2
  20. package/dist/es/Airwallex/style/index.min.css +1 -1
  21. package/dist/es/Alipay/alipay-button.js +26 -7
  22. package/dist/es/Alipay/alipay.js +39 -12
  23. package/dist/es/Alipay/interface.d.ts +26 -1
  24. package/dist/es/Alipay/style/index.css +2 -2
  25. package/dist/es/Alipay/style/index.min.css +1 -1
  26. package/dist/es/MAlipay/style/index.css +2 -2
  27. package/dist/es/MAlipay/style/index.min.css +1 -1
  28. package/dist/es/MPix/index.d.ts +2 -0
  29. package/dist/es/MPix/index.js +2 -0
  30. package/dist/es/MPix/interface.d.ts +44 -0
  31. package/dist/es/MPix/interface.js +1 -0
  32. package/dist/es/MPix/m-pix-button.d.ts +6 -0
  33. package/dist/es/MPix/m-pix-button.js +159 -0
  34. package/dist/es/MPix/style/index.css +256 -0
  35. package/dist/es/MPix/style/index.d.ts +1 -0
  36. package/dist/es/MPix/style/index.js +1 -0
  37. package/dist/es/MPix/style/index.min.css +1 -0
  38. package/dist/es/MWeChat/style/index.css +2 -2
  39. package/dist/es/MWeChat/style/index.min.css +1 -1
  40. package/dist/es/PayButton/index.js +12 -0
  41. package/dist/es/PayButton/interface.d.ts +28 -2
  42. package/dist/es/Paypal/index.d.ts +2 -0
  43. package/dist/es/Paypal/index.js +3 -1
  44. package/dist/es/Paypal/interface.d.ts +40 -0
  45. package/dist/es/Paypal/paypal-button.js +24 -3
  46. package/dist/es/Paypal/paypal-smart-button.d.ts +4 -0
  47. package/dist/es/Paypal/paypal-smart-button.js +48 -0
  48. package/dist/es/Payssion/interface.d.ts +7 -0
  49. package/dist/es/Payssion/payssion-button.js +25 -4
  50. package/dist/es/Pix/index.d.ts +11 -0
  51. package/dist/es/Pix/index.js +10 -0
  52. package/dist/es/Pix/interface.d.ts +147 -0
  53. package/dist/es/Pix/interface.js +1 -0
  54. package/dist/es/Pix/pix-button.d.ts +6 -0
  55. package/dist/es/Pix/pix-button.js +99 -0
  56. package/dist/es/Pix/pix-enhanced.d.ts +4 -0
  57. package/dist/es/Pix/pix-enhanced.js +182 -0
  58. package/dist/es/Pix/pix-modal.d.ts +6 -0
  59. package/dist/es/Pix/pix-modal.js +57 -0
  60. package/dist/es/Pix/pix.d.ts +4 -0
  61. package/dist/es/Pix/pix.js +125 -0
  62. package/dist/es/Pix/style/index.css +80 -0
  63. package/dist/es/Pix/style/index.d.ts +1 -0
  64. package/dist/es/Pix/style/index.js +1 -0
  65. package/dist/es/Pix/style/index.min.css +1 -0
  66. package/dist/es/Stripe/hooks/useStripeCheckout.d.ts +7 -0
  67. package/dist/es/Stripe/hooks/useStripeCheckout.js +86 -0
  68. package/dist/es/Stripe/index.d.ts +4 -0
  69. package/dist/es/Stripe/index.js +5 -1
  70. package/dist/es/Stripe/interface.d.ts +120 -0
  71. package/dist/es/Stripe/stripe-button.js +32 -10
  72. package/dist/es/Stripe/stripe-checkout-button.d.ts +4 -0
  73. package/dist/es/Stripe/stripe-checkout-button.js +70 -0
  74. package/dist/es/Stripe/stripe-modal.js +19 -2
  75. package/dist/es/Stripe/stripe-popup.js +13 -2
  76. package/dist/es/Stripe/stripe.js +38 -4
  77. package/dist/es/Stripe/style/index.css +2 -2
  78. package/dist/es/Stripe/style/index.min.css +1 -1
  79. package/dist/es/Wechat/interface.d.ts +13 -0
  80. package/dist/es/Wechat/style/index.css +2 -2
  81. package/dist/es/Wechat/style/index.min.css +1 -1
  82. package/dist/es/Wechat/wechat-button.js +26 -7
  83. package/dist/es/Wechat/wechat-content.d.ts +4 -0
  84. package/dist/es/Wechat/wechat-content.js +61 -0
  85. package/dist/es/Wechat/wechat.d.ts +1 -1
  86. package/dist/es/Wechat/wechat.js +5 -1
  87. package/dist/es/confirm-modal/style/index.css +2 -2
  88. package/dist/es/confirm-modal/style/index.min.css +1 -1
  89. package/dist/es/hooks/useLatestCallback.d.ts +1 -0
  90. package/dist/es/hooks/useLatestCallback.js +8 -0
  91. package/dist/es/hooks/useManagedOrder.d.ts +8 -0
  92. package/dist/es/hooks/useManagedOrder.js +67 -0
  93. package/dist/es/hooks/usePaymentExecution.d.ts +13 -0
  94. package/dist/es/hooks/usePaymentExecution.js +176 -0
  95. package/dist/es/hooks/usePaymentQr.d.ts +6 -0
  96. package/dist/es/hooks/usePaymentQr.js +52 -0
  97. package/dist/es/hooks/usePaymentRedirect.d.ts +5 -0
  98. package/dist/es/hooks/usePaymentRedirect.js +83 -0
  99. package/dist/es/icons/IconCheck/index.d.ts +4 -0
  100. package/dist/es/icons/IconCheck/index.js +22 -0
  101. package/dist/es/icons/IconCopy/index.d.ts +4 -0
  102. package/dist/es/icons/IconCopy/index.js +27 -0
  103. package/dist/es/icons/IconPix/index.d.ts +4 -0
  104. package/dist/es/icons/IconPix/index.js +33 -0
  105. package/dist/es/icons/index.d.ts +3 -0
  106. package/dist/es/icons/index.js +4 -1
  107. package/dist/es/index.d.ts +50 -6
  108. package/dist/es/index.js +28 -1
  109. package/dist/es/pay-modal/interface.d.ts +22 -2
  110. package/dist/es/pay-modal/pay-modal.js +36 -16
  111. package/dist/es/pay-modal/style/index.css +2 -2
  112. package/dist/es/pay-modal/style/index.min.css +1 -1
  113. package/dist/es/shared/entitys/payment.d.ts +227 -0
  114. package/dist/es/shared/entitys/payment.js +75 -0
  115. package/dist/es/shared/enums/index.d.ts +1 -78
  116. package/dist/es/shared/enums/index.js +1 -81
  117. package/dist/es/shared/enums/payment.d.ts +162 -0
  118. package/dist/es/shared/enums/payment.js +168 -0
  119. package/dist/es/shared/index.d.ts +2 -0
  120. package/dist/es/shared/index.js +2 -1
  121. package/dist/lib/Airwallex/airwallex-button.js +31 -10
  122. package/dist/lib/Airwallex/airwallex-checkout-button.js +52 -0
  123. package/dist/lib/Airwallex/airwallex-managed.js +86 -0
  124. package/dist/lib/Airwallex/airwallex-modal.js +4 -2
  125. package/dist/lib/Airwallex/airwallex-popup.js +4 -2
  126. package/dist/lib/Airwallex/airwallex.js +9 -1
  127. package/dist/lib/Airwallex/hooks/useAirwallexCheckout.js +83 -0
  128. package/dist/lib/Airwallex/index.js +18 -1
  129. package/dist/lib/Airwallex/style/index.css +2 -2
  130. package/dist/lib/Airwallex/style/index.min.css +1 -1
  131. package/dist/lib/Alipay/alipay-button.js +21 -6
  132. package/dist/lib/Alipay/alipay.js +36 -9
  133. package/dist/lib/Alipay/style/index.css +2 -2
  134. package/dist/lib/Alipay/style/index.min.css +1 -1
  135. package/dist/lib/MAlipay/style/index.css +2 -2
  136. package/dist/lib/MAlipay/style/index.min.css +1 -1
  137. package/dist/lib/MPix/index.js +28 -0
  138. package/dist/lib/MPix/interface.js +5 -0
  139. package/dist/lib/MPix/m-pix-button.js +127 -0
  140. package/dist/lib/MPix/style/index.css +256 -0
  141. package/dist/lib/MPix/style/index.js +3 -0
  142. package/dist/lib/MPix/style/index.min.css +1 -0
  143. package/dist/lib/MWeChat/style/index.css +2 -2
  144. package/dist/lib/MWeChat/style/index.min.css +1 -1
  145. package/dist/lib/PayButton/index.js +12 -0
  146. package/dist/lib/Paypal/index.js +17 -1
  147. package/dist/lib/Paypal/paypal-button.js +19 -2
  148. package/dist/lib/Paypal/paypal-smart-button.js +45 -0
  149. package/dist/lib/Payssion/payssion-button.js +20 -3
  150. package/dist/lib/Pix/index.js +43 -0
  151. package/dist/lib/Pix/interface.js +5 -0
  152. package/dist/lib/Pix/pix-button.js +83 -0
  153. package/dist/lib/Pix/pix-enhanced.js +143 -0
  154. package/dist/lib/Pix/pix-modal.js +50 -0
  155. package/dist/lib/Pix/pix.js +97 -0
  156. package/dist/lib/Pix/style/index.css +80 -0
  157. package/dist/lib/Pix/style/index.js +3 -0
  158. package/dist/lib/Pix/style/index.min.css +1 -0
  159. package/dist/lib/Stripe/hooks/useStripeCheckout.js +41 -0
  160. package/dist/lib/Stripe/index.js +18 -1
  161. package/dist/lib/Stripe/stripe-button.js +28 -10
  162. package/dist/lib/Stripe/stripe-checkout-button.js +50 -0
  163. package/dist/lib/Stripe/stripe-modal.js +12 -1
  164. package/dist/lib/Stripe/stripe-popup.js +12 -1
  165. package/dist/lib/Stripe/stripe.js +30 -1
  166. package/dist/lib/Stripe/style/index.css +2 -2
  167. package/dist/lib/Stripe/style/index.min.css +1 -1
  168. package/dist/lib/Wechat/style/index.css +2 -2
  169. package/dist/lib/Wechat/style/index.min.css +1 -1
  170. package/dist/lib/Wechat/wechat-button.js +21 -6
  171. package/dist/lib/Wechat/wechat-content.js +65 -0
  172. package/dist/lib/Wechat/wechat.js +3 -1
  173. package/dist/lib/confirm-modal/style/index.css +2 -2
  174. package/dist/lib/confirm-modal/style/index.min.css +1 -1
  175. package/dist/lib/hooks/useLatestCallback.js +13 -0
  176. package/dist/lib/hooks/useManagedOrder.js +29 -0
  177. package/dist/lib/hooks/usePaymentExecution.js +113 -0
  178. package/dist/lib/hooks/usePaymentQr.js +51 -0
  179. package/dist/lib/hooks/usePaymentRedirect.js +87 -0
  180. package/dist/lib/icons/IconCheck/index.js +27 -0
  181. package/dist/lib/icons/IconCopy/index.js +32 -0
  182. package/dist/lib/icons/IconPix/index.js +38 -0
  183. package/dist/lib/icons/index.js +25 -1
  184. package/dist/lib/index.js +86 -1
  185. package/dist/lib/pay-modal/pay-modal.js +33 -16
  186. package/dist/lib/pay-modal/style/index.css +2 -2
  187. package/dist/lib/pay-modal/style/index.min.css +1 -1
  188. package/dist/lib/shared/entitys/payment.js +61 -0
  189. package/dist/lib/shared/enums/index.js +11 -81
  190. package/dist/lib/shared/enums/payment.js +172 -0
  191. package/dist/lib/shared/index.js +12 -1
  192. package/dist/umd/pay-sdk-react.umd.js +10455 -11463
  193. package/dist/umd/pay-sdk-react.umd.js.map +1 -1
  194. package/package.json +44 -25
package/dist/lib/index.js CHANGED
@@ -9,13 +9,21 @@ var _exportNames = {
9
9
  MAlipay: true,
10
10
  Alipay: true,
11
11
  Wechat: true,
12
+ Pix: true,
13
+ Paypal: true,
12
14
  PaypalButton: true,
15
+ PaypalSmartButton: true,
16
+ PaypalProvider: true,
13
17
  StripeButton: true,
14
18
  StripePopup: true,
15
19
  StripeModal: true,
20
+ StripeCheckoutButton: true,
21
+ useStripeCheckout: true,
16
22
  AirwallexButton: true,
17
23
  AirwallexPopup: true,
18
24
  AirwallexModal: true,
25
+ AirwallexCheckoutButton: true,
26
+ useAirwallexCheckout: true,
19
27
  PayssionButton: true,
20
28
  MWechatButton: true,
21
29
  MAlipayButton: true,
@@ -23,6 +31,9 @@ var _exportNames = {
23
31
  AlipayModal: true,
24
32
  WechatButton: true,
25
33
  WechatModal: true,
34
+ PixButton: true,
35
+ PixModal: true,
36
+ MPixButton: true,
26
37
  PayButton: true
27
38
  };
28
39
  exports.Airwallex = void 0;
@@ -32,6 +43,12 @@ Object.defineProperty(exports, "AirwallexButton", {
32
43
  return _Airwallex.AirwallexButton;
33
44
  }
34
45
  });
46
+ Object.defineProperty(exports, "AirwallexCheckoutButton", {
47
+ enumerable: true,
48
+ get: function () {
49
+ return _Airwallex.AirwallexCheckoutButton;
50
+ }
51
+ });
35
52
  Object.defineProperty(exports, "AirwallexModal", {
36
53
  enumerable: true,
37
54
  get: function () {
@@ -64,6 +81,12 @@ Object.defineProperty(exports, "MAlipayButton", {
64
81
  return _MAlipay.MAlipayButton;
65
82
  }
66
83
  });
84
+ Object.defineProperty(exports, "MPixButton", {
85
+ enumerable: true,
86
+ get: function () {
87
+ return _MPix.MPixButton;
88
+ }
89
+ });
67
90
  Object.defineProperty(exports, "MWechatButton", {
68
91
  enumerable: true,
69
92
  get: function () {
@@ -76,18 +99,44 @@ Object.defineProperty(exports, "PayButton", {
76
99
  return _PayButton.default;
77
100
  }
78
101
  });
102
+ exports.Paypal = void 0;
79
103
  Object.defineProperty(exports, "PaypalButton", {
80
104
  enumerable: true,
81
105
  get: function () {
82
106
  return _Paypal.PaypalButton;
83
107
  }
84
108
  });
109
+ Object.defineProperty(exports, "PaypalProvider", {
110
+ enumerable: true,
111
+ get: function () {
112
+ return _Paypal.PaypalProvider;
113
+ }
114
+ });
115
+ Object.defineProperty(exports, "PaypalSmartButton", {
116
+ enumerable: true,
117
+ get: function () {
118
+ return _Paypal.PaypalSmartButton;
119
+ }
120
+ });
85
121
  Object.defineProperty(exports, "PayssionButton", {
86
122
  enumerable: true,
87
123
  get: function () {
88
124
  return _Payssion.PayssionButton;
89
125
  }
90
126
  });
127
+ exports.Pix = void 0;
128
+ Object.defineProperty(exports, "PixButton", {
129
+ enumerable: true,
130
+ get: function () {
131
+ return _Pix.PixButton;
132
+ }
133
+ });
134
+ Object.defineProperty(exports, "PixModal", {
135
+ enumerable: true,
136
+ get: function () {
137
+ return _Pix.PixModal;
138
+ }
139
+ });
91
140
  exports.Stripe = void 0;
92
141
  Object.defineProperty(exports, "StripeButton", {
93
142
  enumerable: true,
@@ -95,6 +144,12 @@ Object.defineProperty(exports, "StripeButton", {
95
144
  return _Stripe.StripeButton;
96
145
  }
97
146
  });
147
+ Object.defineProperty(exports, "StripeCheckoutButton", {
148
+ enumerable: true,
149
+ get: function () {
150
+ return _Stripe.StripeCheckoutButton;
151
+ }
152
+ });
98
153
  Object.defineProperty(exports, "StripeModal", {
99
154
  enumerable: true,
100
155
  get: function () {
@@ -120,6 +175,18 @@ Object.defineProperty(exports, "WechatModal", {
120
175
  return _Wechat.WechatModal;
121
176
  }
122
177
  });
178
+ Object.defineProperty(exports, "useAirwallexCheckout", {
179
+ enumerable: true,
180
+ get: function () {
181
+ return _Airwallex.useAirwallexCheckout;
182
+ }
183
+ });
184
+ Object.defineProperty(exports, "useStripeCheckout", {
185
+ enumerable: true,
186
+ get: function () {
187
+ return _Stripe.useStripeCheckout;
188
+ }
189
+ });
123
190
  var _Paypal = require("./Paypal");
124
191
  var _Stripe = _interopRequireWildcard(require("./Stripe"));
125
192
  var _Airwallex = _interopRequireWildcard(require("./Airwallex"));
@@ -128,6 +195,8 @@ var _MWeChat = require("./MWeChat");
128
195
  var _MAlipay = _interopRequireWildcard(require("./MAlipay"));
129
196
  var _Alipay = _interopRequireWildcard(require("./Alipay"));
130
197
  var _Wechat = _interopRequireWildcard(require("./Wechat"));
198
+ var _Pix = _interopRequireWildcard(require("./Pix"));
199
+ var _MPix = require("./MPix");
131
200
  var _PayButton = _interopRequireDefault(require("./PayButton"));
132
201
  var _shared = require("./shared");
133
202
  Object.keys(_shared).forEach(function (key) {
@@ -144,11 +213,13 @@ Object.keys(_shared).forEach(function (key) {
144
213
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
145
214
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
146
215
  const Stripe = exports.Stripe = Object.assign({}, _Stripe.default, {
216
+ CheckoutButton: _Stripe.StripeCheckoutButton,
147
217
  Button: _Stripe.StripeButton,
148
218
  Popup: _Stripe.StripePopup,
149
219
  Modal: _Stripe.StripeModal
150
220
  });
151
221
  const Airwallex = exports.Airwallex = Object.assign({}, _Airwallex.default, {
222
+ CheckoutButton: _Airwallex.AirwallexCheckoutButton,
152
223
  Button: _Airwallex.AirwallexButton,
153
224
  Popup: _Airwallex.AirwallexPopup,
154
225
  Modal: _Airwallex.AirwallexModal
@@ -163,4 +234,18 @@ const Alipay = exports.Alipay = Object.assign({}, _Alipay.default, {
163
234
  const Wechat = exports.Wechat = Object.assign({}, _Wechat.default, {
164
235
  Button: _Wechat.WechatButton,
165
236
  Modal: _Wechat.WechatModal
166
- });
237
+ });
238
+ const Pix = exports.Pix = Object.assign({}, _Pix.default, {
239
+ Button: _Pix.PixButton,
240
+ Modal: _Pix.PixModal
241
+ });
242
+ /**
243
+ * @zh PayPal 独立入口保留原 URL 按钮。
244
+ * @en PayPal namespace keeps the legacy URL button.
245
+ * @since 1.2.0
246
+ */
247
+ const Paypal = exports.Paypal = {
248
+ Button: _Paypal.PaypalButton,
249
+ SmartButton: _Paypal.PaypalSmartButton,
250
+ Provider: _Paypal.PaypalProvider
251
+ };
@@ -46,7 +46,11 @@ const PayModal = props => {
46
46
  style,
47
47
  contentClassName,
48
48
  contentStyle,
49
- container
49
+ container,
50
+ classNames: slots = {},
51
+ styles = {},
52
+ closeIcon,
53
+ closeLabel = '关闭'
50
54
  } = props;
51
55
  const {
52
56
  className: retryButtonClassName,
@@ -75,8 +79,8 @@ const PayModal = props => {
75
79
  };
76
80
  }
77
81
  }, [visible, container]);
78
- const classNames = (0, _classNames.default)(classPrefix, className);
79
- const contentClassNames = (0, _classNames.default)(`${classPrefix}__content`, contentClassName);
82
+ const classNames = (0, _classNames.default)(classPrefix, className, slots.root);
83
+ const contentClassNames = (0, _classNames.default)(`${classPrefix}__content`, contentClassName, slots.content);
80
84
  const handleMaskClose = (0, _react.useCallback)(() => {
81
85
  if (maskClosable) onClose === null || onClose === void 0 || onClose();
82
86
  }, [maskClosable, onClose]);
@@ -90,31 +94,44 @@ const PayModal = props => {
90
94
  }, finishButtonPropsRest), finishButtonChildren);
91
95
  const footerContent = (0, _is.isFunction)(footer) ? footer(retryButtonNode, finishButtonNode) : footer || /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, retryButtonNode, finishButtonNode);
92
96
  return /*#__PURE__*/_react.default.createElement("div", {
93
- className: `${classPrefix}__actions`
97
+ className: (0, _classNames.default)(`${classPrefix}__actions`, slots.footer),
98
+ style: styles.footer
94
99
  }, footerContent);
95
100
  };
96
101
  if (!visible || !el.current) return null;
97
102
  const modalContent = /*#__PURE__*/_react.default.createElement("div", {
98
103
  className: classNames,
99
- style: style
104
+ style: {
105
+ ...style,
106
+ ...styles.root
107
+ }
100
108
  }, /*#__PURE__*/_react.default.createElement("div", {
101
- className: `${classPrefix}__mask`,
109
+ className: (0, _classNames.default)(`${classPrefix}__mask`, slots.mask),
110
+ style: styles.mask,
102
111
  onClick: handleMaskClose
103
112
  }), /*#__PURE__*/_react.default.createElement("div", {
104
113
  className: contentClassNames,
105
- style: contentStyle
114
+ style: {
115
+ ...contentStyle,
116
+ ...styles.content
117
+ }
106
118
  }, showClose && /*#__PURE__*/_react.default.createElement("button", {
107
- className: `${classPrefix}__close`,
119
+ className: (0, _classNames.default)(`${classPrefix}__close`, slots.close),
120
+ style: styles.close,
108
121
  onClick: onClose,
109
- "aria-label": "\u5173\u95ED"
110
- }, "\xD7"), icon && /*#__PURE__*/_react.default.createElement("div", {
111
- className: `${classPrefix}__icon`
112
- }, icon), title && /*#__PURE__*/_react.default.createElement("div", {
113
- className: `${classPrefix}__title`
114
- }, title), desc && /*#__PURE__*/_react.default.createElement("div", {
115
- className: `${classPrefix}__desc`
122
+ "aria-label": closeLabel
123
+ }, closeIcon === undefined ? '×' : closeIcon), icon && /*#__PURE__*/_react.default.createElement("div", {
124
+ className: (0, _classNames.default)(`${classPrefix}__icon`, slots.icon),
125
+ style: styles.icon
126
+ }, icon), title !== undefined && title !== null && title !== false && title !== '' ? /*#__PURE__*/_react.default.createElement("div", {
127
+ className: (0, _classNames.default)(`${classPrefix}__title`, slots.title),
128
+ style: styles.title
129
+ }, title) : null, desc && /*#__PURE__*/_react.default.createElement("div", {
130
+ className: (0, _classNames.default)(`${classPrefix}__desc`, slots.description),
131
+ style: styles.description
116
132
  }, desc), children && /*#__PURE__*/_react.default.createElement("div", {
117
- className: `${classPrefix}__content-wrapper`
133
+ className: (0, _classNames.default)(`${classPrefix}__content-wrapper`, slots.body),
134
+ style: styles.body
118
135
  }, children), renderFooter()));
119
136
  return /*#__PURE__*/_reactDom.default.createPortal(modalContent, el.current);
120
137
  };
@@ -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: 60vh;
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:60vh;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:1;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}
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,61 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.PaymentExecutionError = void 0;
7
+ /**
8
+ * @zh 分区域样式,不传时保留原样。
9
+ * @en Semantic styles; omitted values preserve defaults.
10
+ * @since 1.2.0
11
+ */
12
+
13
+ /**
14
+ * @zh 二维码展示配置。
15
+ * @en QR presentation options.
16
+ * @since 1.2.0
17
+ */
18
+
19
+ /**
20
+ * @zh 支付执行错误;不包含支付凭证。
21
+ * @en Execution error without credentials.
22
+ * @since 1.2.0
23
+ */
24
+ class PaymentExecutionError extends Error {
25
+ constructor(code, message) {
26
+ super(message);
27
+ this.code = code;
28
+ this.name = 'PaymentExecutionError';
29
+ }
30
+ }
31
+
32
+ /**
33
+ * @zh 可选的受管理执行配置。
34
+ * @en Optional managed execution options.
35
+ * @since 1.2.0
36
+ */
37
+
38
+ /**
39
+ * @zh 每次执行的显式结果。
40
+ * @en Explicit execution result.
41
+ * @since 1.2.0
42
+ */
43
+
44
+ /**
45
+ * @zh 执行 Hook 的公开状态。
46
+ * @en Public execution state.
47
+ * @since 1.2.0
48
+ */
49
+
50
+ /**
51
+ * @zh URL 跳转配置,仅用于 URL 分支。
52
+ * @en Redirect options for URL targets only.
53
+ * @since 1.2.0
54
+ */
55
+
56
+ /**
57
+ * @zh 已有目标或获取目标的回调;null 表示中止。
58
+ * @en Target or factory; null stops execution.
59
+ * @since 1.2.0
60
+ */
61
+ exports.PaymentExecutionError = PaymentExecutionError;
@@ -3,84 +3,14 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.PaymentMethod = exports.OpenPayUrlMode = void 0;
7
- let PaymentMethod = exports.PaymentMethod = /*#__PURE__*/function (PaymentMethod) {
8
- /**
9
- * @zh 微信(pc)
10
- * @en Wechat(pc)
11
- */
12
- PaymentMethod["WechatPc"] = "wechat-pc";
13
- /**
14
- * @zh 支付宝(pc)
15
- * @en Alipay(pc)
16
- */
17
- PaymentMethod["AlipayPc"] = "alipay-pc";
18
- /**
19
- * @zh paypal(pc)
20
- * @en Paypal(pc)
21
- */
22
- PaymentMethod["PaypalPc"] = "paypal-pc";
23
- /**
24
- * @zh stripe(pc)
25
- * @en Stripe(pc)
26
- */
27
- PaymentMethod["StripePc"] = "stripe-pc";
28
- /**
29
- * @zh 微信(H5)
30
- * @en Wechat(H5)
31
- */
32
- PaymentMethod["WechatH5"] = "wechat-h5";
33
- /**
34
- * @zh 支付宝(H5)
35
- * @en Alipay(H5)
36
- */
37
- PaymentMethod["AlipayH5"] = "alipay-h5";
38
- /**
39
- * @zh paypal(H5)
40
- * @en Paypal(H5)
41
- */
42
- PaymentMethod["PaypalH5"] = "paypal-h5";
43
- /**
44
- * @zh 微信内部(H5)
45
- * @en Wechat inside(H5)
46
- */
47
- PaymentMethod["WechatInsideH5"] = "wechat-inside-h5";
48
- /**
49
- * @zh stripe(H5)
50
- * @en Stripe(H5)
51
- */
52
- PaymentMethod["StripeH5"] = "stripe-h5";
53
- /**
54
- * @zh payssion支付
55
- * @en Payssion
56
- */
57
- PaymentMethod["Payssion"] = "payssion";
58
- /**
59
- * @zh 空中云汇
60
- * @en Airwallex
61
- */
62
- PaymentMethod["Airwallex"] = "airwallex";
63
- return PaymentMethod;
64
- }({});
65
- /**
66
- * @zh 支付页面打开模式枚举
67
- * @en Payment page opening mode enum
68
- */
69
- let OpenPayUrlMode = exports.OpenPayUrlMode = /*#__PURE__*/function (OpenPayUrlMode) {
70
- /**
71
- * @zh 新页面或弹窗模式 - 使用 window.open() 打开新页面或弹窗,支持智能设备检测
72
- * @en New page or popup mode - Use window.open() to open new page or popup, supports smart device detection
73
- */
74
- OpenPayUrlMode["Window"] = "window";
75
- /**
76
- * @zh 新页面模式 - 使用 window.location.href 跳转到新页面
77
- * @en New page mode - Use window.location.href to navigate to new page
78
- */
79
- OpenPayUrlMode["Href"] = "href";
80
- /**
81
- * @zh 替换页面模式 - 使用 window.location.replace 替换当前页面
82
- * @en Replace page mode - Use window.location.replace to replace current page
83
- */
84
- OpenPayUrlMode["Replace"] = "replace";
85
- return OpenPayUrlMode;
86
- }({});
6
+ var _payment = require("./payment");
7
+ Object.keys(_payment).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _payment[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _payment[key];
14
+ }
15
+ });
16
+ });
@@ -0,0 +1,172 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.PaymentMethod = exports.PaymentExecutionStatus = exports.PaymentErrorCode = exports.OpenPayUrlMode = void 0;
7
+ let PaymentMethod = exports.PaymentMethod = /*#__PURE__*/function (PaymentMethod) {
8
+ /**
9
+ * @zh 微信(pc)
10
+ * @en Wechat(pc)
11
+ */
12
+ PaymentMethod["WechatPc"] = "wechat-pc";
13
+ /**
14
+ * @zh 支付宝(pc)
15
+ * @en Alipay(pc)
16
+ */
17
+ PaymentMethod["AlipayPc"] = "alipay-pc";
18
+ /**
19
+ * @zh paypal(pc)
20
+ * @en Paypal(pc)
21
+ */
22
+ PaymentMethod["PaypalPc"] = "paypal-pc";
23
+ /**
24
+ * @zh stripe(pc)
25
+ * @en Stripe(pc)
26
+ */
27
+ PaymentMethod["StripePc"] = "stripe-pc";
28
+ /**
29
+ * @zh 微信(H5)
30
+ * @en Wechat(H5)
31
+ */
32
+ PaymentMethod["WechatH5"] = "wechat-h5";
33
+ /**
34
+ * @zh 支付宝(H5)
35
+ * @en Alipay(H5)
36
+ */
37
+ PaymentMethod["AlipayH5"] = "alipay-h5";
38
+ /**
39
+ * @zh paypal(H5)
40
+ * @en Paypal(H5)
41
+ */
42
+ PaymentMethod["PaypalH5"] = "paypal-h5";
43
+ /**
44
+ * @zh 微信内部(H5)
45
+ * @en Wechat inside(H5)
46
+ */
47
+ PaymentMethod["WechatInsideH5"] = "wechat-inside-h5";
48
+ /**
49
+ * @zh stripe(H5)
50
+ * @en Stripe(H5)
51
+ */
52
+ PaymentMethod["StripeH5"] = "stripe-h5";
53
+ /**
54
+ * @zh payssion支付
55
+ * @en Payssion
56
+ */
57
+ PaymentMethod["Payssion"] = "payssion";
58
+ /**
59
+ * @zh 空中云汇
60
+ * @en Airwallex
61
+ */
62
+ PaymentMethod["Airwallex"] = "airwallex";
63
+ /**
64
+ * @zh PIX(pc)
65
+ * @en PIX(pc)
66
+ */
67
+ PaymentMethod["PixPc"] = "pix-pc";
68
+ /**
69
+ * @zh PIX(H5)
70
+ * @en PIX(H5)
71
+ */
72
+ PaymentMethod["PixH5"] = "pix-h5";
73
+ return PaymentMethod;
74
+ }({});
75
+ /**
76
+ * @zh 支付页面打开模式枚举
77
+ * @en Payment page opening mode enum
78
+ */
79
+ let OpenPayUrlMode = exports.OpenPayUrlMode = /*#__PURE__*/function (OpenPayUrlMode) {
80
+ /**
81
+ * @zh 新页面或弹窗模式 - 使用 window.open() 打开新页面或弹窗,支持智能设备检测
82
+ * @en New page or popup mode - Use window.open() to open new page or popup, supports smart device detection
83
+ */
84
+ OpenPayUrlMode["Window"] = "window";
85
+ /**
86
+ * @zh 新页面模式 - 使用 window.location.href 跳转到新页面
87
+ * @en New page mode - Use window.location.href to navigate to new page
88
+ */
89
+ OpenPayUrlMode["Href"] = "href";
90
+ /**
91
+ * @zh 替换页面模式 - 使用 window.location.replace 替换当前页面
92
+ * @en Replace page mode - Use window.location.replace to replace current page
93
+ */
94
+ OpenPayUrlMode["Replace"] = "replace";
95
+ return OpenPayUrlMode;
96
+ }({});
97
+ /**
98
+ * @zh 前端执行状态,不代表订单状态。
99
+ * @en Frontend execution, not order status.
100
+ * @since 1.2.0
101
+ */
102
+ let PaymentExecutionStatus = exports.PaymentExecutionStatus = /*#__PURE__*/function (PaymentExecutionStatus) {
103
+ /**
104
+ * @zh 尚未执行。
105
+ * @en Not executed.
106
+ * @since 1.2.0
107
+ */
108
+ PaymentExecutionStatus["Idle"] = "idle";
109
+ /**
110
+ * @zh 当前前端执行处理中。
111
+ * @en Frontend execution is pending.
112
+ * @since 1.2.0
113
+ */
114
+ PaymentExecutionStatus["Pending"] = "pending";
115
+ /**
116
+ * @zh 当前执行阶段完成,不代表支付成功。
117
+ * @en Execution stage completed, not payment success.
118
+ * @since 1.2.0
119
+ */
120
+ PaymentExecutionStatus["Completed"] = "completed";
121
+ /**
122
+ * @zh 当前前端执行已取消。
123
+ * @en Frontend execution cancelled.
124
+ * @since 1.2.0
125
+ */
126
+ PaymentExecutionStatus["Cancelled"] = "cancelled";
127
+ /**
128
+ * @zh 当前前端执行失败。
129
+ * @en Frontend execution failed.
130
+ * @since 1.2.0
131
+ */
132
+ PaymentExecutionStatus["Failed"] = "failed";
133
+ return PaymentExecutionStatus;
134
+ }({});
135
+ /**
136
+ * @zh 执行错误分类。
137
+ * @en Execution error codes.
138
+ * @since 1.2.0
139
+ */
140
+ let PaymentErrorCode = exports.PaymentErrorCode = /*#__PURE__*/function (PaymentErrorCode) {
141
+ /**
142
+ * @zh 目标或凭证无效。
143
+ * @en Invalid target or credentials.
144
+ * @since 1.2.0
145
+ */
146
+ PaymentErrorCode["InvalidParameters"] = "invalid_parameters";
147
+ /**
148
+ * @zh 执行时缺少浏览器环境。
149
+ * @en Browser environment unavailable for execution.
150
+ * @since 1.2.0
151
+ */
152
+ PaymentErrorCode["BrowserUnavailable"] = "browser_unavailable";
153
+ /**
154
+ * @zh 支付窗口被浏览器拦截。
155
+ * @en Payment window blocked by the browser.
156
+ * @since 1.2.0
157
+ */
158
+ PaymentErrorCode["WindowBlocked"] = "window_blocked";
159
+ /**
160
+ * @zh 官方 SDK 初始化失败。
161
+ * @en Official SDK initialization failed.
162
+ * @since 1.2.0
163
+ */
164
+ PaymentErrorCode["InitializationFailed"] = "initialization_failed";
165
+ /**
166
+ * @zh 其他前端执行失败。
167
+ * @en Other frontend execution failure.
168
+ * @since 1.2.0
169
+ */
170
+ PaymentErrorCode["ExecutionFailed"] = "execution_failed";
171
+ return PaymentErrorCode;
172
+ }({});
@@ -3,9 +3,19 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ var _exportNames = {
7
+ PaymentExecutionError: true
8
+ };
9
+ Object.defineProperty(exports, "PaymentExecutionError", {
10
+ enumerable: true,
11
+ get: function () {
12
+ return _payment.PaymentExecutionError;
13
+ }
14
+ });
6
15
  var _enums = require("./enums");
7
16
  Object.keys(_enums).forEach(function (key) {
8
17
  if (key === "default" || key === "__esModule") return;
18
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
9
19
  if (key in exports && exports[key] === _enums[key]) return;
10
20
  Object.defineProperty(exports, key, {
11
21
  enumerable: true,
@@ -13,4 +23,5 @@ Object.keys(_enums).forEach(function (key) {
13
23
  return _enums[key];
14
24
  }
15
25
  });
16
- });
26
+ });
27
+ var _payment = require("./entitys/payment");