pay-sdk-react 1.1.14 → 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 (119) hide show
  1. package/README.md +241 -78
  2. package/README.zh-CN.md +243 -79
  3. package/dist/css/index.css +11 -0
  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/Alipay/alipay-button.js +26 -7
  20. package/dist/es/Alipay/alipay.js +39 -12
  21. package/dist/es/Alipay/interface.d.ts +26 -1
  22. package/dist/es/Paypal/index.d.ts +2 -0
  23. package/dist/es/Paypal/index.js +3 -1
  24. package/dist/es/Paypal/interface.d.ts +40 -0
  25. package/dist/es/Paypal/paypal-button.js +24 -3
  26. package/dist/es/Paypal/paypal-smart-button.d.ts +4 -0
  27. package/dist/es/Paypal/paypal-smart-button.js +48 -0
  28. package/dist/es/Payssion/interface.d.ts +7 -0
  29. package/dist/es/Payssion/payssion-button.js +25 -4
  30. package/dist/es/Pix/interface.d.ts +67 -0
  31. package/dist/es/Pix/pix-button.js +26 -7
  32. package/dist/es/Pix/pix-enhanced.d.ts +4 -0
  33. package/dist/es/Pix/pix-enhanced.js +182 -0
  34. package/dist/es/Pix/pix.d.ts +1 -1
  35. package/dist/es/Pix/pix.js +6 -1
  36. package/dist/es/Pix/style/index.css +11 -0
  37. package/dist/es/Pix/style/index.min.css +1 -1
  38. package/dist/es/Stripe/hooks/useStripeCheckout.d.ts +7 -0
  39. package/dist/es/Stripe/hooks/useStripeCheckout.js +86 -0
  40. package/dist/es/Stripe/index.d.ts +4 -0
  41. package/dist/es/Stripe/index.js +5 -1
  42. package/dist/es/Stripe/interface.d.ts +120 -0
  43. package/dist/es/Stripe/stripe-button.js +32 -10
  44. package/dist/es/Stripe/stripe-checkout-button.d.ts +4 -0
  45. package/dist/es/Stripe/stripe-checkout-button.js +70 -0
  46. package/dist/es/Stripe/stripe-modal.js +19 -2
  47. package/dist/es/Stripe/stripe-popup.js +13 -2
  48. package/dist/es/Stripe/stripe.js +38 -4
  49. package/dist/es/Wechat/interface.d.ts +13 -0
  50. package/dist/es/Wechat/wechat-button.js +26 -7
  51. package/dist/es/Wechat/wechat-content.d.ts +4 -0
  52. package/dist/es/Wechat/wechat-content.js +61 -0
  53. package/dist/es/Wechat/wechat.d.ts +1 -1
  54. package/dist/es/Wechat/wechat.js +5 -1
  55. package/dist/es/hooks/useLatestCallback.d.ts +1 -0
  56. package/dist/es/hooks/useLatestCallback.js +8 -0
  57. package/dist/es/hooks/useManagedOrder.d.ts +8 -0
  58. package/dist/es/hooks/useManagedOrder.js +67 -0
  59. package/dist/es/hooks/usePaymentExecution.d.ts +13 -0
  60. package/dist/es/hooks/usePaymentExecution.js +176 -0
  61. package/dist/es/hooks/usePaymentQr.d.ts +6 -0
  62. package/dist/es/hooks/usePaymentQr.js +52 -0
  63. package/dist/es/hooks/usePaymentRedirect.d.ts +5 -0
  64. package/dist/es/hooks/usePaymentRedirect.js +83 -0
  65. package/dist/es/index.d.ts +33 -6
  66. package/dist/es/index.js +19 -1
  67. package/dist/es/pay-modal/interface.d.ts +22 -2
  68. package/dist/es/pay-modal/pay-modal.js +36 -16
  69. package/dist/es/shared/entitys/payment.d.ts +227 -0
  70. package/dist/es/shared/entitys/payment.js +75 -0
  71. package/dist/es/shared/enums/index.d.ts +1 -88
  72. package/dist/es/shared/enums/index.js +1 -91
  73. package/dist/es/shared/enums/payment.d.ts +162 -0
  74. package/dist/es/shared/enums/payment.js +168 -0
  75. package/dist/es/shared/index.d.ts +2 -0
  76. package/dist/es/shared/index.js +2 -1
  77. package/dist/lib/Airwallex/airwallex-button.js +31 -10
  78. package/dist/lib/Airwallex/airwallex-checkout-button.js +52 -0
  79. package/dist/lib/Airwallex/airwallex-managed.js +86 -0
  80. package/dist/lib/Airwallex/airwallex-modal.js +4 -2
  81. package/dist/lib/Airwallex/airwallex-popup.js +4 -2
  82. package/dist/lib/Airwallex/airwallex.js +9 -1
  83. package/dist/lib/Airwallex/hooks/useAirwallexCheckout.js +83 -0
  84. package/dist/lib/Airwallex/index.js +18 -1
  85. package/dist/lib/Alipay/alipay-button.js +21 -6
  86. package/dist/lib/Alipay/alipay.js +36 -9
  87. package/dist/lib/Paypal/index.js +17 -1
  88. package/dist/lib/Paypal/paypal-button.js +19 -2
  89. package/dist/lib/Paypal/paypal-smart-button.js +45 -0
  90. package/dist/lib/Payssion/payssion-button.js +20 -3
  91. package/dist/lib/Pix/pix-button.js +21 -6
  92. package/dist/lib/Pix/pix-enhanced.js +143 -0
  93. package/dist/lib/Pix/pix.js +6 -1
  94. package/dist/lib/Pix/style/index.css +11 -0
  95. package/dist/lib/Pix/style/index.min.css +1 -1
  96. package/dist/lib/Stripe/hooks/useStripeCheckout.js +41 -0
  97. package/dist/lib/Stripe/index.js +18 -1
  98. package/dist/lib/Stripe/stripe-button.js +28 -10
  99. package/dist/lib/Stripe/stripe-checkout-button.js +50 -0
  100. package/dist/lib/Stripe/stripe-modal.js +12 -1
  101. package/dist/lib/Stripe/stripe-popup.js +12 -1
  102. package/dist/lib/Stripe/stripe.js +30 -1
  103. package/dist/lib/Wechat/wechat-button.js +21 -6
  104. package/dist/lib/Wechat/wechat-content.js +65 -0
  105. package/dist/lib/Wechat/wechat.js +3 -1
  106. package/dist/lib/hooks/useLatestCallback.js +13 -0
  107. package/dist/lib/hooks/useManagedOrder.js +29 -0
  108. package/dist/lib/hooks/usePaymentExecution.js +113 -0
  109. package/dist/lib/hooks/usePaymentQr.js +51 -0
  110. package/dist/lib/hooks/usePaymentRedirect.js +87 -0
  111. package/dist/lib/index.js +57 -1
  112. package/dist/lib/pay-modal/pay-modal.js +33 -16
  113. package/dist/lib/shared/entitys/payment.js +61 -0
  114. package/dist/lib/shared/enums/index.js +11 -91
  115. package/dist/lib/shared/enums/payment.js +172 -0
  116. package/dist/lib/shared/index.js +12 -1
  117. package/dist/umd/pay-sdk-react.umd.js +6488 -7731
  118. package/dist/umd/pay-sdk-react.umd.js.map +1 -1
  119. package/package.json +17 -3
@@ -3,94 +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
- /**
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
- }({});
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");