pay-sdk-react 1.1.2 → 1.1.3

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 (239) hide show
  1. package/README.md +37 -19
  2. package/README.zh-CN.md +37 -19
  3. package/dist/css/index.css +703 -1
  4. package/dist/css/index.min.css +1 -0
  5. package/dist/es/Airwallex/airwallex-button.js +56 -36
  6. package/dist/es/Airwallex/airwallex-modal.js +41 -34
  7. package/dist/es/Airwallex/airwallex-popup.js +43 -38
  8. package/dist/es/Airwallex/airwallex.js +26 -28
  9. package/dist/es/Airwallex/index.js +1 -1
  10. package/dist/es/Airwallex/style/index.css +335 -1
  11. package/dist/es/Airwallex/style/index.min.css +1 -0
  12. package/dist/es/Alipay/alipay-button.js +39 -24
  13. package/dist/es/Alipay/alipay-modal.js +37 -31
  14. package/dist/es/Alipay/alipay.js +22 -15
  15. package/dist/es/Alipay/index.d.ts +4 -4
  16. package/dist/es/Alipay/index.js +5 -5
  17. package/dist/es/Alipay/style/index.css +18 -1
  18. package/dist/es/Alipay/style/index.min.css +1 -0
  19. package/dist/es/Button/button.js +62 -37
  20. package/dist/es/Button/index.d.ts +2 -2
  21. package/dist/es/Button/index.js +2 -2
  22. package/dist/es/Button/style/index.css +95 -1
  23. package/dist/es/Button/style/index.min.css +1 -0
  24. package/dist/es/FullScreenLoading/index.js +40 -40
  25. package/dist/es/FullScreenLoading/interface.d.ts +2 -2
  26. package/dist/es/FullScreenLoading/style/index.css +239 -1
  27. package/dist/es/FullScreenLoading/style/index.min.css +1 -0
  28. package/dist/es/MAlipay/index.js +1 -1
  29. package/dist/es/MAlipay/m-alipay-auto-submit.js +9 -11
  30. package/dist/es/MAlipay/m-alipay-button.js +71 -51
  31. package/dist/es/MAlipay/style/index.css +252 -1
  32. package/dist/es/MAlipay/style/index.min.css +1 -0
  33. package/dist/es/MWeChat/index.d.ts +2 -2
  34. package/dist/es/MWeChat/index.js +2 -2
  35. package/dist/es/MWeChat/m-wechat-button.js +70 -50
  36. package/dist/es/MWeChat/style/index.css +252 -1
  37. package/dist/es/MWeChat/style/index.min.css +1 -0
  38. package/dist/es/Mask/index.d.ts +2 -2
  39. package/dist/es/Mask/index.js +2 -2
  40. package/dist/es/Mask/mask.js +48 -45
  41. package/dist/es/Mask/style/index.css +11 -1
  42. package/dist/es/Mask/style/index.min.css +1 -0
  43. package/dist/es/PayButton/index.js +2 -2
  44. package/dist/es/PayButton/interface.d.ts +9 -9
  45. package/dist/es/PayButton/interface.js +1 -1
  46. package/dist/es/PayMask/index.d.ts +2 -2
  47. package/dist/es/PayMask/index.js +2 -2
  48. package/dist/es/PayMask/interface.d.ts +2 -2
  49. package/dist/es/PayMask/pay-mask.js +41 -40
  50. package/dist/es/PayMask/style/index.css +62 -1
  51. package/dist/es/PayMask/style/index.min.css +1 -0
  52. package/dist/es/Paypal/index.d.ts +2 -2
  53. package/dist/es/Paypal/index.js +2 -2
  54. package/dist/es/Paypal/paypal-button.js +55 -36
  55. package/dist/es/Paypal/style/index.css +207 -1
  56. package/dist/es/Paypal/style/index.min.css +1 -0
  57. package/dist/es/Payssion/index.d.ts +2 -2
  58. package/dist/es/Payssion/index.js +2 -2
  59. package/dist/es/Payssion/payssion-button.js +56 -37
  60. package/dist/es/Payssion/style/index.css +157 -1
  61. package/dist/es/Payssion/style/index.min.css +1 -0
  62. package/dist/es/Stripe/index.d.ts +5 -5
  63. package/dist/es/Stripe/index.js +6 -6
  64. package/dist/es/Stripe/stripe-button.js +47 -33
  65. package/dist/es/Stripe/stripe-modal.js +38 -32
  66. package/dist/es/Stripe/stripe-popup.js +42 -37
  67. package/dist/es/Stripe/stripe.js +15 -15
  68. package/dist/es/Stripe/style/index.css +365 -1
  69. package/dist/es/Stripe/style/index.min.css +1 -0
  70. package/dist/es/Wechat/index.d.ts +4 -4
  71. package/dist/es/Wechat/index.js +5 -5
  72. package/dist/es/Wechat/style/index.css +25 -1
  73. package/dist/es/Wechat/style/index.min.css +1 -0
  74. package/dist/es/Wechat/wechat-button.js +38 -23
  75. package/dist/es/Wechat/wechat-modal.js +37 -31
  76. package/dist/es/Wechat/wechat.js +16 -12
  77. package/dist/es/confirm-modal/index.js +38 -39
  78. package/dist/es/confirm-modal/interface.d.ts +2 -2
  79. package/dist/es/confirm-modal/style/index.css +95 -1
  80. package/dist/es/confirm-modal/style/index.min.css +1 -0
  81. package/dist/es/dot-loading/dot-loading.js +25 -23
  82. package/dist/es/dot-loading/index.d.ts +2 -2
  83. package/dist/es/dot-loading/index.js +2 -2
  84. package/dist/es/dot-loading/style/index.css +3 -1
  85. package/dist/es/dot-loading/style/index.min.css +1 -0
  86. package/dist/es/hooks/use-initialized.js +2 -2
  87. package/dist/es/hooks/use-inner-visible.js +8 -4
  88. package/dist/es/hooks/use-lock-scroll.d.ts +2 -2
  89. package/dist/es/hooks/use-lock-scroll.js +30 -34
  90. package/dist/es/hooks/use-touch.d.ts +1 -1
  91. package/dist/es/hooks/use-touch.js +35 -31
  92. package/dist/es/hooks/usePayWindowOpen.d.ts +1 -1
  93. package/dist/es/hooks/usePayWindowOpen.js +31 -27
  94. package/dist/es/icons/IconAlipay/index.js +18 -16
  95. package/dist/es/icons/IconClose/index.js +24 -22
  96. package/dist/es/icons/IconPaypalText/index.js +24 -22
  97. package/dist/es/icons/IconPaypalWhite/index.js +19 -17
  98. package/dist/es/icons/IconPayssionPay/index.js +47 -45
  99. package/dist/es/icons/IconStripe/index.js +19 -17
  100. package/dist/es/icons/IconStripeText/index.js +19 -17
  101. package/dist/es/icons/IconWechatPay/index.js +18 -16
  102. package/dist/es/icons/interface.d.ts +1 -1
  103. package/dist/es/icons/style/index.css +45 -1
  104. package/dist/es/icons/style/index.min.css +1 -0
  105. package/dist/es/pay-modal/index.d.ts +2 -2
  106. package/dist/es/pay-modal/index.js +2 -2
  107. package/dist/es/pay-modal/pay-modal.js +45 -48
  108. package/dist/es/pay-modal/style/index.css +95 -1
  109. package/dist/es/pay-modal/style/index.min.css +1 -0
  110. package/dist/es/pay-popup/index.js +51 -53
  111. package/dist/es/pay-popup/interface.d.ts +6 -6
  112. package/dist/es/pay-popup/style/index.css +145 -1
  113. package/dist/es/pay-popup/style/index.min.css +1 -0
  114. package/dist/es/shared/enums/index.js +1 -1
  115. package/dist/es/shared/index.d.ts +1 -1
  116. package/dist/es/shared/index.js +1 -1
  117. package/dist/es/utils/can-use-dom.js +1 -1
  118. package/dist/es/utils/classNames.js +15 -11
  119. package/dist/es/utils/dom.js +18 -18
  120. package/dist/es/utils/get-container.js +2 -2
  121. package/dist/es/utils/get-scroll-parent.js +8 -9
  122. package/dist/es/utils/is.js +54 -32
  123. package/dist/es/utils/native-props.d.ts +2 -2
  124. package/dist/es/utils/native-props.js +7 -9
  125. package/dist/es/utils/omit.js +3 -5
  126. package/dist/es/utils/qrcode.js +5 -5
  127. package/dist/es/utils/render-to-container.d.ts +1 -1
  128. package/dist/es/utils/render-to-container.js +4 -4
  129. package/dist/es/utils/should-render.d.ts +1 -1
  130. package/dist/es/utils/should-render.js +4 -4
  131. package/dist/es/utils/supports-passive.js +8 -7
  132. package/dist/es/utils/warning.js +0 -1
  133. package/dist/es/utils/with-default-props.js +6 -4
  134. package/dist/es/utils/with-stop-propagation.d.ts +3 -3
  135. package/dist/es/utils/with-stop-propagation.js +27 -14
  136. package/dist/lib/Airwallex/airwallex-button.js +12 -15
  137. package/dist/lib/Airwallex/airwallex-modal.js +11 -14
  138. package/dist/lib/Airwallex/airwallex-popup.js +16 -23
  139. package/dist/lib/Airwallex/airwallex.js +20 -25
  140. package/dist/lib/Airwallex/index.js +1 -1
  141. package/dist/lib/Airwallex/style/index.css +335 -1
  142. package/dist/lib/Airwallex/style/index.min.css +1 -0
  143. package/dist/lib/Alipay/alipay-button.js +12 -15
  144. package/dist/lib/Alipay/alipay-modal.js +9 -12
  145. package/dist/lib/Alipay/alipay.js +19 -23
  146. package/dist/lib/Alipay/index.js +1 -1
  147. package/dist/lib/Alipay/style/index.css +18 -1
  148. package/dist/lib/Alipay/style/index.min.css +1 -0
  149. package/dist/lib/Button/button.js +13 -13
  150. package/dist/lib/Button/index.js +1 -1
  151. package/dist/lib/Button/style/index.css +95 -1
  152. package/dist/lib/Button/style/index.min.css +1 -0
  153. package/dist/lib/FullScreenLoading/index.js +28 -29
  154. package/dist/lib/FullScreenLoading/style/index.css +239 -1
  155. package/dist/lib/FullScreenLoading/style/index.min.css +1 -0
  156. package/dist/lib/MAlipay/index.js +1 -1
  157. package/dist/lib/MAlipay/m-alipay-auto-submit.js +3 -4
  158. package/dist/lib/MAlipay/m-alipay-button.js +34 -44
  159. package/dist/lib/MAlipay/style/index.css +252 -1
  160. package/dist/lib/MAlipay/style/index.min.css +1 -0
  161. package/dist/lib/MWeChat/index.js +2 -2
  162. package/dist/lib/MWeChat/m-wechat-button.js +34 -44
  163. package/dist/lib/MWeChat/style/index.css +252 -1
  164. package/dist/lib/MWeChat/style/index.min.css +1 -0
  165. package/dist/lib/Mask/index.js +1 -1
  166. package/dist/lib/Mask/mask.js +6 -11
  167. package/dist/lib/Mask/style/index.css +11 -1
  168. package/dist/lib/Mask/style/index.min.css +1 -0
  169. package/dist/lib/PayButton/index.js +10 -10
  170. package/dist/lib/PayMask/index.js +1 -1
  171. package/dist/lib/PayMask/pay-mask.js +20 -23
  172. package/dist/lib/PayMask/style/index.css +62 -1
  173. package/dist/lib/PayMask/style/index.min.css +1 -0
  174. package/dist/lib/Paypal/index.js +2 -2
  175. package/dist/lib/Paypal/paypal-button.js +17 -22
  176. package/dist/lib/Paypal/style/index.css +207 -1
  177. package/dist/lib/Paypal/style/index.min.css +1 -0
  178. package/dist/lib/Payssion/index.js +2 -2
  179. package/dist/lib/Payssion/payssion-button.js +17 -22
  180. package/dist/lib/Payssion/style/index.css +157 -1
  181. package/dist/lib/Payssion/style/index.min.css +1 -0
  182. package/dist/lib/Stripe/index.js +1 -1
  183. package/dist/lib/Stripe/stripe-button.js +14 -17
  184. package/dist/lib/Stripe/stripe-modal.js +10 -13
  185. package/dist/lib/Stripe/stripe-popup.js +16 -23
  186. package/dist/lib/Stripe/stripe.js +8 -11
  187. package/dist/lib/Stripe/style/index.css +365 -1
  188. package/dist/lib/Stripe/style/index.min.css +1 -0
  189. package/dist/lib/Wechat/index.js +1 -1
  190. package/dist/lib/Wechat/style/index.css +25 -1
  191. package/dist/lib/Wechat/style/index.min.css +1 -0
  192. package/dist/lib/Wechat/wechat-button.js +12 -15
  193. package/dist/lib/Wechat/wechat-modal.js +9 -12
  194. package/dist/lib/Wechat/wechat.js +11 -12
  195. package/dist/lib/confirm-modal/index.js +17 -26
  196. package/dist/lib/confirm-modal/style/index.css +95 -1
  197. package/dist/lib/confirm-modal/style/index.min.css +1 -0
  198. package/dist/lib/dot-loading/dot-loading.js +3 -4
  199. package/dist/lib/dot-loading/index.js +1 -1
  200. package/dist/lib/dot-loading/style/index.css +3 -1
  201. package/dist/lib/dot-loading/style/index.min.css +1 -0
  202. package/dist/lib/hooks/use-lock-scroll.js +11 -12
  203. package/dist/lib/hooks/use-touch.js +10 -10
  204. package/dist/lib/hooks/usePayWindowOpen.js +14 -15
  205. package/dist/lib/icons/IconAlipay/index.js +6 -6
  206. package/dist/lib/icons/IconClose/index.js +8 -8
  207. package/dist/lib/icons/IconPaypalText/index.js +7 -7
  208. package/dist/lib/icons/IconPaypalWhite/index.js +6 -6
  209. package/dist/lib/icons/IconPayssionPay/index.js +13 -13
  210. package/dist/lib/icons/IconStripe/index.js +6 -6
  211. package/dist/lib/icons/IconStripeText/index.js +6 -6
  212. package/dist/lib/icons/IconWechatPay/index.js +6 -6
  213. package/dist/lib/icons/index.js +2 -2
  214. package/dist/lib/icons/style/index.css +45 -1
  215. package/dist/lib/icons/style/index.min.css +1 -0
  216. package/dist/lib/index.js +2 -2
  217. package/dist/lib/pay-modal/index.js +1 -1
  218. package/dist/lib/pay-modal/pay-modal.js +24 -30
  219. package/dist/lib/pay-modal/style/index.css +95 -1
  220. package/dist/lib/pay-modal/style/index.min.css +1 -0
  221. package/dist/lib/pay-popup/index.js +24 -28
  222. package/dist/lib/pay-popup/style/index.css +145 -1
  223. package/dist/lib/pay-popup/style/index.min.css +1 -0
  224. package/dist/lib/utils/can-use-dom.js +1 -1
  225. package/dist/lib/utils/classNames.js +6 -7
  226. package/dist/lib/utils/dom.js +9 -11
  227. package/dist/lib/utils/get-scroll-parent.js +2 -3
  228. package/dist/lib/utils/getPrefixCls.js +1 -1
  229. package/dist/lib/utils/is.js +16 -14
  230. package/dist/lib/utils/native-props.js +10 -10
  231. package/dist/lib/utils/omit.js +3 -6
  232. package/dist/lib/utils/qrcode.js +1 -1
  233. package/dist/lib/utils/supports-passive.js +4 -3
  234. package/dist/lib/utils/warning.js +2 -6
  235. package/dist/lib/utils/with-default-props.js +4 -8
  236. package/dist/lib/utils/with-stop-propagation.js +6 -9
  237. package/dist/umd/pay-sdk-react.umd.js +61 -63
  238. package/dist/umd/pay-sdk-react.umd.js.map +1 -1
  239. package/package.json +5 -2
@@ -4,7 +4,6 @@ export default function warning(condition, message) {
4
4
  for (var _len = arguments.length, extra = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
5
5
  extra[_key - 2] = arguments[_key];
6
6
  }
7
- // eslint-disable-next-line no-console
8
7
  return console.error("[pay-sdk-react]: ".concat(message), extra ? {
9
8
  detail: extra
10
9
  } : undefined);
@@ -1,11 +1,13 @@
1
+ /* eslint-disable no-redeclare */
2
+
1
3
  export function mergeProps() {
2
- const ret = {};
4
+ var ret = {};
3
5
  for (var _len = arguments.length, items = new Array(_len), _key = 0; _key < _len; _key++) {
4
6
  items[_key] = arguments[_key];
5
7
  }
6
- items.forEach(item => {
8
+ items.forEach(function (item) {
7
9
  if (item) {
8
- Object.keys(item).forEach(key => {
10
+ Object.keys(item).forEach(function (key) {
9
11
  if (item[key] !== undefined) {
10
12
  ret[key] = item[key];
11
13
  }
@@ -24,7 +26,7 @@ export function mergeProp(defaultProp) {
24
26
  for (var _len2 = arguments.length, propList = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
25
27
  propList[_key2 - 1] = arguments[_key2];
26
28
  }
27
- for (let i = propList.length - 1; i >= 0; i -= 1) {
29
+ for (var i = propList.length - 1; i >= 0; i -= 1) {
28
30
  if (propList[i] !== undefined) {
29
31
  return propList[i];
30
32
  }
@@ -1,4 +1,4 @@
1
- import React from "react";
2
- import type { ReactElement } from "react";
3
- export type PropagationEvent = "click" | "touchstart";
1
+ import React from 'react';
2
+ import type { ReactElement } from 'react';
3
+ export type PropagationEvent = 'click' | 'touchstart';
4
4
  export declare function withStopPropagation(events: PropagationEvent[], element: ReactElement): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
@@ -1,22 +1,35 @@
1
+ import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
2
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
3
+ 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; } }
4
+ 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; }
1
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; }
2
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; }
3
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
4
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
5
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
6
- import React from "react";
7
- const eventToPropRecord = {
8
- click: "onClick",
9
- touchstart: "onTouchStart"
7
+ import React from 'react';
8
+ var eventToPropRecord = {
9
+ click: 'onClick',
10
+ touchstart: 'onTouchStart'
10
11
  };
11
12
  export function withStopPropagation(events, element) {
12
- const props = _objectSpread({}, element.props);
13
- for (const key of events) {
14
- const prop = eventToPropRecord[key];
15
- props[prop] = function (e) {
16
- var _element$props$prop, _element$props;
17
- e.stopPropagation();
18
- (_element$props$prop = (_element$props = element.props)[prop]) === null || _element$props$prop === void 0 || _element$props$prop.call(_element$props, e);
13
+ var props = _objectSpread({}, element.props);
14
+ var _iterator = _createForOfIteratorHelper(events),
15
+ _step;
16
+ try {
17
+ var _loop = function _loop() {
18
+ var key = _step.value;
19
+ var prop = eventToPropRecord[key];
20
+ props[prop] = function (e) {
21
+ var _element$props$prop, _element$props;
22
+ e.stopPropagation();
23
+ (_element$props$prop = (_element$props = element.props)[prop]) === null || _element$props$prop === void 0 || _element$props$prop.call(_element$props, e);
24
+ };
19
25
  };
26
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
27
+ _loop();
28
+ }
29
+ } catch (err) {
30
+ _iterator.e(err);
31
+ } finally {
32
+ _iterator.f();
20
33
  }
21
34
  return /*#__PURE__*/React.cloneElement(element, props);
22
35
  }
@@ -1,28 +1,25 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.default = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
7
9
  var _react = _interopRequireWildcard(require("react"));
8
10
  var _airwallexPopup = _interopRequireDefault(require("./airwallex-popup"));
9
11
  var _airwallexModal = _interopRequireDefault(require("./airwallex-modal"));
10
12
  var _Button = _interopRequireDefault(require("../Button"));
11
13
  var _PayMask = _interopRequireDefault(require("../PayMask"));
12
14
  var _omit = _interopRequireDefault(require("../utils/omit"));
13
- const _excluded = ["children", "onClick", "createOrder"];
14
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
15
  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); }
16
- 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); }
17
- 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; }
18
- 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; }
19
16
  const AirwallexButton = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
20
17
  const {
21
- children = 'Airwallex',
22
- onClick,
23
- createOrder
24
- } = props,
25
- others = _objectWithoutProperties(props, _excluded);
18
+ children = 'Airwallex',
19
+ onClick,
20
+ createOrder,
21
+ ...others
22
+ } = props;
26
23
  const airwallexButtonRef = (0, _react.useRef)({
27
24
  nativeElement: null
28
25
  });
@@ -34,7 +31,7 @@ const AirwallexButton = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
34
31
  const handlePayCreateOrder = (0, _react.useCallback)(async () => {
35
32
  if (createOrder) {
36
33
  // 1. 业务侧创建订单,获取参数
37
- const options = await (createOrder === null || createOrder === void 0 ? void 0 : createOrder());
34
+ const options = await createOrder();
38
35
  if (options) {
39
36
  if ((props === null || props === void 0 ? void 0 : props.payMode) === 'embedded') {
40
37
  if ((props === null || props === void 0 ? void 0 : props.displayType) === 'modal') {
@@ -72,14 +69,14 @@ const AirwallexButton = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
72
69
  setAirwallexUrl(props === null || props === void 0 ? void 0 : props.airwallexUrl);
73
70
  }
74
71
  }, [onClick, createOrder, handlePayCreateOrder, props]);
75
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Button.default, _extends({
72
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Button.default, (0, _extends2.default)({
76
73
  ref: airwallexButtonRef,
77
74
  onClick: handleClick
78
- }, (0, _omit.default)(others, ['payMode', 'displayType', 'createOrder', 'airwallexUrl', 'maskProps', 'popupProps', 'modalProps'])), children), (props === null || props === void 0 ? void 0 : props.payMode) === 'embedded' && (props === null || props === void 0 ? void 0 : props.displayType) === 'popup' && /*#__PURE__*/_react.default.createElement(_airwallexPopup.default, _extends({
75
+ }, (0, _omit.default)(others, ['payMode', 'displayType', 'createOrder', 'airwallexUrl', 'maskProps', 'popupProps', 'modalProps'])), children), (props === null || props === void 0 ? void 0 : props.payMode) === 'embedded' && (props === null || props === void 0 ? void 0 : props.displayType) === 'popup' && /*#__PURE__*/_react.default.createElement(_airwallexPopup.default, (0, _extends2.default)({
79
76
  ref: airwallexPopupRef
80
- }, props === null || props === void 0 ? void 0 : props.popupProps)), (props === null || props === void 0 ? void 0 : props.payMode) === 'embedded' && (props === null || props === void 0 ? void 0 : props.displayType) === 'modal' && /*#__PURE__*/_react.default.createElement(_airwallexModal.default, _extends({
77
+ }, props === null || props === void 0 ? void 0 : props.popupProps)), (props === null || props === void 0 ? void 0 : props.payMode) === 'embedded' && (props === null || props === void 0 ? void 0 : props.displayType) === 'modal' && /*#__PURE__*/_react.default.createElement(_airwallexModal.default, (0, _extends2.default)({
81
78
  ref: airwallexModalRef
82
- }, props === null || props === void 0 ? void 0 : props.modalProps)), (props === null || props === void 0 ? void 0 : props.payMode) === 'redirect' && showMask && airwallexUrl && /*#__PURE__*/_react.default.createElement(_PayMask.default, _extends({
79
+ }, props === null || props === void 0 ? void 0 : props.modalProps)), (props === null || props === void 0 ? void 0 : props.payMode) === 'redirect' && showMask && airwallexUrl && /*#__PURE__*/_react.default.createElement(_PayMask.default, (0, _extends2.default)({
83
80
  visible: showMask,
84
81
  onClose: () => {
85
82
  var _props$maskProps, _props$maskProps$onCl;
@@ -1,27 +1,24 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.default = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
7
9
  var _react = _interopRequireWildcard(require("react"));
8
10
  var _payModal = _interopRequireDefault(require("../pay-modal"));
9
11
  var _airwallex = _interopRequireDefault(require("./airwallex"));
10
12
  var _omit = _interopRequireDefault(require("../utils/omit"));
11
- const _excluded = ["airwallexProps", "visible", "onClose", "footer"];
12
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
13
  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); }
14
- 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); }
15
- 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; }
16
- 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; }
17
14
  const AirwallexModal = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
18
15
  const {
19
- airwallexProps: propsAirwallexProps,
20
- visible,
21
- onClose,
22
- footer = null
23
- } = props,
24
- rest = _objectWithoutProperties(props, _excluded);
16
+ airwallexProps: propsAirwallexProps,
17
+ visible,
18
+ onClose,
19
+ footer = null,
20
+ ...rest
21
+ } = props;
25
22
  const airwallexRef = (0, _react.useRef)(null);
26
23
  const [uncontrolledVisible, setUncontrolledVisible] = (0, _react.useState)(false);
27
24
  const [airwallexProps, setAirwallexProps] = (0, _react.useState)();
@@ -40,8 +37,8 @@ const AirwallexModal = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
40
37
  },
41
38
  current: airwallexRef.current
42
39
  }));
43
- const _airwallexProps = propsAirwallexProps !== null && propsAirwallexProps !== void 0 ? propsAirwallexProps : airwallexProps;
44
- return /*#__PURE__*/_react.default.createElement(_payModal.default, _extends({
40
+ const _airwallexProps = propsAirwallexProps ?? airwallexProps;
41
+ return /*#__PURE__*/_react.default.createElement(_payModal.default, (0, _extends2.default)({
45
42
  visible: _visible,
46
43
  onClose: () => {
47
44
  if (!isControlled) {
@@ -50,7 +47,7 @@ const AirwallexModal = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
50
47
  onClose === null || onClose === void 0 || onClose();
51
48
  },
52
49
  footer: footer
53
- }, rest), _airwallexProps && /*#__PURE__*/_react.default.createElement(_airwallex.default, _extends({
50
+ }, rest), _airwallexProps && /*#__PURE__*/_react.default.createElement(_airwallex.default, (0, _extends2.default)({
54
51
  onSuccess: event => {
55
52
  var _airwallexProps$onSuc;
56
53
  if (!isControlled) {
@@ -1,39 +1,31 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.default = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
7
9
  var _react = _interopRequireWildcard(require("react"));
8
10
  var _airwallex = _interopRequireDefault(require("./airwallex"));
9
11
  var _payPopup = _interopRequireDefault(require("../pay-popup"));
10
12
  var _omit = _interopRequireDefault(require("../utils/omit"));
11
- const _excluded = ["visible", "onClose", "closeOnMaskClick", "bodyStyle", "airwallexProps"];
12
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
13
  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); }
14
- 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); }
15
- 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; }
16
- 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; }
17
- 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; }
18
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
19
- 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); }
20
- 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; }
21
- 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; }
22
14
  const AirwallexPopup = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
23
15
  const {
24
- visible: controlledVisible,
25
- onClose,
26
- closeOnMaskClick = true,
27
- bodyStyle,
28
- airwallexProps: propsAirwallexProps
29
- } = props,
30
- others = _objectWithoutProperties(props, _excluded);
16
+ visible: controlledVisible,
17
+ onClose,
18
+ closeOnMaskClick = true,
19
+ bodyStyle,
20
+ airwallexProps: propsAirwallexProps,
21
+ ...others
22
+ } = props;
31
23
  const airwallexRef = (0, _react.useRef)(null);
32
24
  const [uncontrolledVisible, setUncontrolledVisible] = (0, _react.useState)(false);
33
25
  const [airwallexProps, setAirwallexProps] = (0, _react.useState)();
34
26
  const isControlled = controlledVisible !== undefined;
35
27
  const visible = isControlled ? controlledVisible : uncontrolledVisible;
36
- const _airwallexProps = propsAirwallexProps !== null && propsAirwallexProps !== void 0 ? propsAirwallexProps : airwallexProps;
28
+ const _airwallexProps = propsAirwallexProps ?? airwallexProps;
37
29
  (0, _react.useImperativeHandle)(ref, () => ({
38
30
  open: value => {
39
31
  if (value) {
@@ -47,7 +39,7 @@ const AirwallexPopup = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
47
39
  },
48
40
  current: airwallexRef.current
49
41
  }));
50
- return /*#__PURE__*/_react.default.createElement(_payPopup.default, _extends({
42
+ return /*#__PURE__*/_react.default.createElement(_payPopup.default, (0, _extends2.default)({
51
43
  visible: visible,
52
44
  closeOnMaskClick: closeOnMaskClick,
53
45
  onClose: () => {
@@ -56,12 +48,13 @@ const AirwallexPopup = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
56
48
  }
57
49
  onClose === null || onClose === void 0 || onClose();
58
50
  },
59
- bodyStyle: _objectSpread({
51
+ bodyStyle: {
60
52
  padding: 12,
61
53
  height: '40vh',
62
- overflowY: 'scroll'
63
- }, bodyStyle)
64
- }, others), _airwallexProps && /*#__PURE__*/_react.default.createElement(_airwallex.default, _extends({
54
+ overflowY: 'scroll',
55
+ ...bodyStyle
56
+ }
57
+ }, others), _airwallexProps && /*#__PURE__*/_react.default.createElement(_airwallex.default, (0, _extends2.default)({
65
58
  onSuccess: event => {
66
59
  var _airwallexProps$onSuc;
67
60
  if (!isControlled) {
@@ -1,39 +1,33 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.default = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
7
9
  var _react = _interopRequireWildcard(require("react"));
8
10
  var _airwallexPaymentElements = require("airwallex-payment-elements");
9
11
  var _dom = require("../utils/dom");
10
- const _excluded = ["type", "options", "initOptions", "style", "onReady", "onSuccess", "onError"];
11
12
  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); }
12
- 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); }
13
- 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; }
14
- 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; }
15
- 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; }
16
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
17
- 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); }
18
- 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; }
19
- 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; }
20
13
  const Airwallex = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
21
14
  const {
22
- type = 'fullFeaturedCard',
23
- options,
24
- initOptions,
25
- style,
26
- onReady: propsOnReady,
27
- onSuccess: propsOnSuccess,
28
- onError: propsOnError
29
- } = props,
30
- others = _objectWithoutProperties(props, _excluded);
15
+ type = 'fullFeaturedCard',
16
+ options,
17
+ initOptions,
18
+ style,
19
+ onReady: propsOnReady,
20
+ onSuccess: propsOnSuccess,
21
+ onError: propsOnError,
22
+ ...others
23
+ } = props;
31
24
  const airwallexRef = (0, _react.useRef)(null);
32
25
  (0, _react.useImperativeHandle)(ref, () => airwallexRef.current);
33
26
  (0, _react.useEffect)(() => {
34
- (0, _airwallexPaymentElements.loadAirwallex)(_objectSpread({
35
- env: 'demo'
36
- }, initOptions)).then(airwallex => {
27
+ (0, _airwallexPaymentElements.loadAirwallex)({
28
+ env: 'demo',
29
+ ...initOptions
30
+ }).then(airwallex => {
37
31
  if (airwallex) {
38
32
  const cardElement = airwallex.createElement(type, options);
39
33
  if (cardElement) {
@@ -66,12 +60,13 @@ const Airwallex = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
66
60
  }
67
61
  };
68
62
  }, [type, propsOnReady, propsOnSuccess, propsOnError]);
69
- return /*#__PURE__*/_react.default.createElement("div", _extends({
63
+ return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({
70
64
  ref: airwallexRef,
71
65
  id: String(type),
72
- style: _objectSpread({
73
- width: '100%'
74
- }, style)
66
+ style: {
67
+ width: '100%',
68
+ ...style
69
+ }
75
70
  }, others));
76
71
  });
77
72
  Airwallex.displayName = 'Airwallex';
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
@@ -21,7 +22,6 @@ Object.keys(_interface).forEach(function (key) {
21
22
  }
22
23
  });
23
24
  });
24
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
25
25
  const AirwallexComponent = _airwallex.default;
26
26
  AirwallexComponent.Button = _airwallexButton.default;
27
27
  AirwallexComponent.Popup = _airwallexPopup.default;