@blocklet/payment-react 1.25.9 → 1.26.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 (160) hide show
  1. package/es/checkout-v2/checkout-v2.d.ts +2 -0
  2. package/es/checkout-v2/checkout-v2.js +121 -0
  3. package/es/checkout-v2/components/dialogs/checkout-dialogs.d.ts +1 -0
  4. package/es/checkout-v2/components/dialogs/checkout-dialogs.js +106 -0
  5. package/es/checkout-v2/components/left/billing-toggle.d.ts +6 -0
  6. package/es/checkout-v2/components/left/billing-toggle.js +118 -0
  7. package/es/checkout-v2/components/left/cross-sell-card.d.ts +10 -0
  8. package/es/checkout-v2/components/left/cross-sell-card.js +167 -0
  9. package/es/checkout-v2/components/left/product-item-card.d.ts +26 -0
  10. package/es/checkout-v2/components/left/product-item-card.js +571 -0
  11. package/es/checkout-v2/components/left/promotion-input.d.ts +19 -0
  12. package/es/checkout-v2/components/left/promotion-input.js +178 -0
  13. package/es/checkout-v2/components/left/staking-breakdown.d.ts +9 -0
  14. package/es/checkout-v2/components/left/staking-breakdown.js +48 -0
  15. package/es/checkout-v2/components/left/trial-info.d.ts +13 -0
  16. package/es/checkout-v2/components/left/trial-info.js +48 -0
  17. package/es/checkout-v2/components/right/currency-grid.d.ts +8 -0
  18. package/es/checkout-v2/components/right/currency-grid.js +48 -0
  19. package/es/checkout-v2/components/right/customer-info-card.d.ts +17 -0
  20. package/es/checkout-v2/components/right/customer-info-card.js +156 -0
  21. package/es/checkout-v2/components/right/status-feedback.d.ts +7 -0
  22. package/es/checkout-v2/components/right/status-feedback.js +17 -0
  23. package/es/checkout-v2/components/right/submit-button.d.ts +10 -0
  24. package/es/checkout-v2/components/right/submit-button.js +29 -0
  25. package/es/checkout-v2/components/right/subscription-disclaimer.d.ts +11 -0
  26. package/es/checkout-v2/components/right/subscription-disclaimer.js +8 -0
  27. package/es/checkout-v2/components/shared/exchange-rate-footer.d.ts +23 -0
  28. package/es/checkout-v2/components/shared/exchange-rate-footer.js +182 -0
  29. package/es/checkout-v2/components/shared/scenario-badge.d.ts +6 -0
  30. package/es/checkout-v2/components/shared/scenario-badge.js +47 -0
  31. package/es/checkout-v2/components/shared/total-display.d.ts +7 -0
  32. package/es/checkout-v2/components/shared/total-display.js +84 -0
  33. package/es/checkout-v2/index.d.ts +2 -0
  34. package/es/checkout-v2/index.js +1 -0
  35. package/es/checkout-v2/layouts/checkout-layout.d.ts +7 -0
  36. package/es/checkout-v2/layouts/checkout-layout.js +226 -0
  37. package/es/checkout-v2/panels/left/composite-panel.d.ts +1 -0
  38. package/es/checkout-v2/panels/left/composite-panel.js +423 -0
  39. package/es/checkout-v2/panels/left/credit-topup-panel.d.ts +1 -0
  40. package/es/checkout-v2/panels/left/credit-topup-panel.js +615 -0
  41. package/es/checkout-v2/panels/left/scenario-router.d.ts +1 -0
  42. package/es/checkout-v2/panels/left/scenario-router.js +19 -0
  43. package/es/checkout-v2/panels/right/payment-panel.d.ts +1 -0
  44. package/es/checkout-v2/panels/right/payment-panel.js +644 -0
  45. package/es/checkout-v2/types.d.ts +15 -0
  46. package/es/checkout-v2/types.js +0 -0
  47. package/es/checkout-v2/utils/format.d.ts +59 -0
  48. package/es/checkout-v2/utils/format.js +125 -0
  49. package/es/checkout-v2/utils/scenario-detector.d.ts +3 -0
  50. package/es/checkout-v2/utils/scenario-detector.js +17 -0
  51. package/es/checkout-v2/views/error-view.d.ts +7 -0
  52. package/es/checkout-v2/views/error-view.js +269 -0
  53. package/es/checkout-v2/views/loading-view.d.ts +5 -0
  54. package/es/checkout-v2/views/loading-view.js +158 -0
  55. package/es/checkout-v2/views/success-view.d.ts +29 -0
  56. package/es/checkout-v2/views/success-view.js +614 -0
  57. package/es/components/phone-field.d.ts +14 -0
  58. package/es/components/phone-field.js +96 -0
  59. package/es/index.d.ts +3 -1
  60. package/es/index.js +3 -1
  61. package/es/locales/en.js +45 -6
  62. package/es/locales/zh.js +45 -6
  63. package/es/payment/form/index.js +10 -1
  64. package/lib/checkout-v2/checkout-v2.d.ts +2 -0
  65. package/lib/checkout-v2/checkout-v2.js +151 -0
  66. package/lib/checkout-v2/components/dialogs/checkout-dialogs.d.ts +1 -0
  67. package/lib/checkout-v2/components/dialogs/checkout-dialogs.js +131 -0
  68. package/lib/checkout-v2/components/left/billing-toggle.d.ts +6 -0
  69. package/lib/checkout-v2/components/left/billing-toggle.js +126 -0
  70. package/lib/checkout-v2/components/left/cross-sell-card.d.ts +10 -0
  71. package/lib/checkout-v2/components/left/cross-sell-card.js +257 -0
  72. package/lib/checkout-v2/components/left/product-item-card.d.ts +26 -0
  73. package/lib/checkout-v2/components/left/product-item-card.js +738 -0
  74. package/lib/checkout-v2/components/left/promotion-input.d.ts +19 -0
  75. package/lib/checkout-v2/components/left/promotion-input.js +220 -0
  76. package/lib/checkout-v2/components/left/staking-breakdown.d.ts +9 -0
  77. package/lib/checkout-v2/components/left/staking-breakdown.js +96 -0
  78. package/lib/checkout-v2/components/left/trial-info.d.ts +13 -0
  79. package/lib/checkout-v2/components/left/trial-info.js +82 -0
  80. package/lib/checkout-v2/components/right/currency-grid.d.ts +8 -0
  81. package/lib/checkout-v2/components/right/currency-grid.js +96 -0
  82. package/lib/checkout-v2/components/right/customer-info-card.d.ts +17 -0
  83. package/lib/checkout-v2/components/right/customer-info-card.js +246 -0
  84. package/lib/checkout-v2/components/right/status-feedback.d.ts +7 -0
  85. package/lib/checkout-v2/components/right/status-feedback.js +30 -0
  86. package/lib/checkout-v2/components/right/submit-button.d.ts +10 -0
  87. package/lib/checkout-v2/components/right/submit-button.js +35 -0
  88. package/lib/checkout-v2/components/right/subscription-disclaimer.d.ts +11 -0
  89. package/lib/checkout-v2/components/right/subscription-disclaimer.js +33 -0
  90. package/lib/checkout-v2/components/shared/exchange-rate-footer.d.ts +23 -0
  91. package/lib/checkout-v2/components/shared/exchange-rate-footer.js +282 -0
  92. package/lib/checkout-v2/components/shared/scenario-badge.d.ts +6 -0
  93. package/lib/checkout-v2/components/shared/scenario-badge.js +57 -0
  94. package/lib/checkout-v2/components/shared/total-display.d.ts +7 -0
  95. package/lib/checkout-v2/components/shared/total-display.js +154 -0
  96. package/lib/checkout-v2/index.d.ts +2 -0
  97. package/lib/checkout-v2/index.js +13 -0
  98. package/lib/checkout-v2/layouts/checkout-layout.d.ts +7 -0
  99. package/lib/checkout-v2/layouts/checkout-layout.js +308 -0
  100. package/lib/checkout-v2/panels/left/composite-panel.d.ts +1 -0
  101. package/lib/checkout-v2/panels/left/composite-panel.js +515 -0
  102. package/lib/checkout-v2/panels/left/credit-topup-panel.d.ts +1 -0
  103. package/lib/checkout-v2/panels/left/credit-topup-panel.js +799 -0
  104. package/lib/checkout-v2/panels/left/scenario-router.d.ts +1 -0
  105. package/lib/checkout-v2/panels/left/scenario-router.js +29 -0
  106. package/lib/checkout-v2/panels/right/payment-panel.d.ts +1 -0
  107. package/lib/checkout-v2/panels/right/payment-panel.js +906 -0
  108. package/lib/checkout-v2/types.d.ts +15 -0
  109. package/lib/checkout-v2/types.js +1 -0
  110. package/lib/checkout-v2/utils/format.d.ts +59 -0
  111. package/lib/checkout-v2/utils/format.js +158 -0
  112. package/lib/checkout-v2/utils/scenario-detector.d.ts +3 -0
  113. package/lib/checkout-v2/utils/scenario-detector.js +23 -0
  114. package/lib/checkout-v2/views/error-view.d.ts +7 -0
  115. package/lib/checkout-v2/views/error-view.js +321 -0
  116. package/lib/checkout-v2/views/loading-view.d.ts +5 -0
  117. package/lib/checkout-v2/views/loading-view.js +168 -0
  118. package/lib/checkout-v2/views/success-view.d.ts +29 -0
  119. package/lib/checkout-v2/views/success-view.js +735 -0
  120. package/lib/components/phone-field.d.ts +14 -0
  121. package/lib/components/phone-field.js +130 -0
  122. package/lib/index.d.ts +3 -1
  123. package/lib/index.js +8 -0
  124. package/lib/locales/en.js +45 -6
  125. package/lib/locales/zh.js +45 -6
  126. package/lib/payment/form/index.js +10 -1
  127. package/package.json +10 -9
  128. package/src/checkout-v2/checkout-v2.tsx +155 -0
  129. package/src/checkout-v2/components/dialogs/checkout-dialogs.tsx +134 -0
  130. package/src/checkout-v2/components/left/billing-toggle.tsx +122 -0
  131. package/src/checkout-v2/components/left/cross-sell-card.tsx +170 -0
  132. package/src/checkout-v2/components/left/product-item-card.tsx +634 -0
  133. package/src/checkout-v2/components/left/promotion-input.tsx +207 -0
  134. package/src/checkout-v2/components/left/staking-breakdown.tsx +57 -0
  135. package/src/checkout-v2/components/left/trial-info.tsx +63 -0
  136. package/src/checkout-v2/components/right/currency-grid.tsx +59 -0
  137. package/src/checkout-v2/components/right/customer-info-card.tsx +214 -0
  138. package/src/checkout-v2/components/right/status-feedback.tsx +35 -0
  139. package/src/checkout-v2/components/right/submit-button.tsx +37 -0
  140. package/src/checkout-v2/components/right/subscription-disclaimer.tsx +27 -0
  141. package/src/checkout-v2/components/shared/exchange-rate-footer.tsx +221 -0
  142. package/src/checkout-v2/components/shared/scenario-badge.tsx +51 -0
  143. package/src/checkout-v2/components/shared/total-display.tsx +112 -0
  144. package/src/checkout-v2/index.ts +2 -0
  145. package/src/checkout-v2/layouts/checkout-layout.tsx +232 -0
  146. package/src/checkout-v2/panels/left/composite-panel.tsx +465 -0
  147. package/src/checkout-v2/panels/left/credit-topup-panel.tsx +681 -0
  148. package/src/checkout-v2/panels/left/scenario-router.tsx +22 -0
  149. package/src/checkout-v2/panels/right/payment-panel.tsx +703 -0
  150. package/src/checkout-v2/types.ts +18 -0
  151. package/src/checkout-v2/utils/format.ts +204 -0
  152. package/src/checkout-v2/utils/scenario-detector.ts +30 -0
  153. package/src/checkout-v2/views/error-view.tsx +293 -0
  154. package/src/checkout-v2/views/loading-view.tsx +162 -0
  155. package/src/checkout-v2/views/success-view.tsx +770 -0
  156. package/src/components/phone-field.tsx +119 -0
  157. package/src/index.ts +3 -0
  158. package/src/locales/en.tsx +45 -4
  159. package/src/locales/zh.tsx +43 -4
  160. package/src/payment/form/index.tsx +16 -1
@@ -0,0 +1,168 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ module.exports = LoadingView;
7
+ var _jsxRuntime = require("react/jsx-runtime");
8
+ var _material = require("@mui/material");
9
+ var _styles = require("@mui/material/styles");
10
+ var _Header = _interopRequireDefault(require("@blocklet/ui-react/lib/Header"));
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ function PulsingDots() {
13
+ return /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
14
+ sx: {
15
+ display: "flex",
16
+ gap: 2,
17
+ mt: 4
18
+ },
19
+ children: [0, 1, 2].map(i => /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
20
+ sx: {
21
+ width: 12,
22
+ height: 12,
23
+ borderRadius: "50%",
24
+ bgcolor: "primary.main",
25
+ opacity: 0.4,
26
+ animation: `pulse 1.4s ease-in-out ${i * 0.2}s infinite`,
27
+ "@keyframes pulse": {
28
+ "0%, 80%, 100%": {
29
+ transform: "scale(0.6)",
30
+ opacity: 0.3
31
+ },
32
+ "40%": {
33
+ transform: "scale(1)",
34
+ opacity: 0.7
35
+ }
36
+ }
37
+ }
38
+ }, i))
39
+ });
40
+ }
41
+ function LoadingDecoration() {
42
+ return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
43
+ sx: {
44
+ position: "relative",
45
+ width: {
46
+ xs: 160,
47
+ md: 200
48
+ },
49
+ height: {
50
+ xs: 160,
51
+ md: 200
52
+ }
53
+ },
54
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
55
+ sx: {
56
+ position: "absolute",
57
+ inset: 0,
58
+ borderRadius: "38% 62% 63% 37% / 41% 44% 56% 59%",
59
+ background: t => `linear-gradient(45deg, ${(0, _styles.alpha)(t.palette.primary.main, 0.1)}, ${(0, _styles.alpha)(t.palette.primary.main, 0.03)})`,
60
+ filter: "blur(1px)",
61
+ animation: "spin 20s linear infinite",
62
+ "@keyframes spin": {
63
+ from: {
64
+ transform: "rotate(0deg)"
65
+ },
66
+ to: {
67
+ transform: "rotate(360deg)"
68
+ }
69
+ }
70
+ }
71
+ }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
72
+ sx: {
73
+ position: "absolute",
74
+ inset: 0,
75
+ borderRadius: "38% 62% 63% 37% / 41% 44% 56% 59%",
76
+ background: t => `linear-gradient(135deg, ${(0, _styles.alpha)(t.palette.primary.main, 0.07)}, ${(0, _styles.alpha)(t.palette.primary.main, 0.01)})`,
77
+ filter: "blur(1px)",
78
+ transform: "scale(0.88)",
79
+ opacity: 0.6,
80
+ animation: "spinReverse 15s linear infinite",
81
+ "@keyframes spinReverse": {
82
+ from: {
83
+ transform: "scale(0.88) rotate(0deg)"
84
+ },
85
+ to: {
86
+ transform: "scale(0.88) rotate(-360deg)"
87
+ }
88
+ }
89
+ }
90
+ })]
91
+ });
92
+ }
93
+ function LoadingView({
94
+ mode = "inline"
95
+ }) {
96
+ const isFullScreen = mode === "standalone";
97
+ const theme = (0, _styles.useTheme)();
98
+ const primaryColor = theme.palette.primary.main;
99
+ const bgSx = {
100
+ background: {
101
+ xs: "none",
102
+ md: `linear-gradient(160deg, ${(0, _styles.alpha)(primaryColor, 0.03)} 0%, ${(0, _styles.alpha)(primaryColor, 0.07)} 50%, ${(0, _styles.alpha)(primaryColor, 0.04)} 100%)`
103
+ },
104
+ bgcolor: t => t.palette.mode === "dark" ? "background.default" : "#f8faff"
105
+ };
106
+ const centerContent = /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
107
+ sx: {
108
+ display: "flex",
109
+ flexDirection: "column",
110
+ alignItems: "center",
111
+ justifyContent: "center",
112
+ flex: 1
113
+ },
114
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(LoadingDecoration, {}), /* @__PURE__ */(0, _jsxRuntime.jsx)(PulsingDots, {})]
115
+ });
116
+ if (!isFullScreen) {
117
+ return /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
118
+ sx: {
119
+ display: "flex",
120
+ width: "100%",
121
+ minHeight: {
122
+ xs: 400,
123
+ md: 640
124
+ },
125
+ maxWidth: 1120,
126
+ mx: "auto",
127
+ borderRadius: "16px",
128
+ overflow: "hidden",
129
+ boxShadow: 1,
130
+ border: 1,
131
+ borderColor: "divider",
132
+ borderLeft: "4px solid",
133
+ borderLeftColor: "primary.main",
134
+ ...bgSx
135
+ },
136
+ children: centerContent
137
+ });
138
+ }
139
+ return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
140
+ sx: {
141
+ width: "100%",
142
+ height: "100vh",
143
+ minHeight: "100vh",
144
+ display: "flex",
145
+ flexDirection: "column",
146
+ position: "relative",
147
+ overflow: "hidden",
148
+ ...bgSx
149
+ },
150
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_Header.default, {
151
+ sx: {
152
+ position: "absolute",
153
+ top: 20,
154
+ left: 0,
155
+ right: 0,
156
+ zIndex: 10,
157
+ background: "transparent",
158
+ "& .header-container": {
159
+ height: "auto"
160
+ }
161
+ },
162
+ hideNavMenu: true,
163
+ brand: null,
164
+ description: null,
165
+ addons: buildIns => buildIns.filter(addon => ["locale-selector", "theme-mode-toggle", "session-user"].includes(addon.key))
166
+ }), centerContent]
167
+ });
168
+ }
@@ -0,0 +1,29 @@
1
+ import type { TCheckoutSessionExpanded } from '@blocklet/payment-types';
2
+ interface VendorInfo {
3
+ success: boolean;
4
+ status: 'delivered' | 'pending' | 'failed';
5
+ progress: number;
6
+ message: string;
7
+ appUrl?: string;
8
+ title?: string;
9
+ name?: string;
10
+ vendorType: string;
11
+ }
12
+ interface SuccessViewProps {
13
+ submit: {
14
+ vendorStatus: {
15
+ payment_status: string;
16
+ session_status: string;
17
+ vendors: VendorInfo[];
18
+ error: string | null;
19
+ isAllCompleted: boolean;
20
+ hasFailed: boolean;
21
+ } | null;
22
+ result: {
23
+ checkoutSession: TCheckoutSessionExpanded;
24
+ } | null;
25
+ };
26
+ session: TCheckoutSessionExpanded | null | undefined;
27
+ }
28
+ export default function SuccessView({ submit, session }: SuccessViewProps): import("react").JSX.Element;
29
+ export {};