@pisell/private-materials 3.4.37 → 3.4.39

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 (163) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/preview.js +7 -7
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +7 -7
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +7 -7
  11. package/es/businessModel/SalesModel/index.d.ts +1 -0
  12. package/es/components/Sales/Event/Detail.js +4 -3
  13. package/es/components/Sales/Summary/utils.d.ts +1 -1
  14. package/es/components/appointmentBooking/components/Content/index.d.ts +1 -0
  15. package/es/components/appointmentBooking/components/Header/index.d.ts +1 -0
  16. package/es/components/appointmentBooking/components/Voucher/index.d.ts +1 -0
  17. package/es/components/appointmentBooking/deposit/index.d.ts +1 -0
  18. package/es/components/appointmentBooking/index.d.ts +1 -0
  19. package/es/components/booking/components/footer/index.d.ts +1 -0
  20. package/es/components/booking/deposit/index.d.ts +1 -0
  21. package/es/components/booking/hooks/useQuotation.d.ts +1 -0
  22. package/es/components/booking/info/addServiceVariant/index.d.ts +1 -0
  23. package/es/components/booking/info/header/index.d.ts +1 -0
  24. package/es/components/booking/info/hooks/useInfoHolder.d.ts +1 -0
  25. package/es/components/booking/info/index.d.ts +1 -0
  26. package/es/components/booking/info/service/Lists.d.ts +1 -0
  27. package/es/components/booking/info/service/addService/index.d.ts +1 -0
  28. package/es/components/booking/info/service/addTimeModal/index.d.ts +1 -0
  29. package/es/components/booking/info/service/editService/BookingList/index.d.ts +1 -0
  30. package/es/components/booking/info/service/serviceItem/index.d.ts +1 -0
  31. package/es/components/booking/info/service/serviceList/index.d.ts +1 -0
  32. package/es/components/booking/info/service2/Lists.d.ts +1 -0
  33. package/es/components/booking/info2/service/addTimeModal/index.d.ts +1 -0
  34. package/es/components/booking/info2/service/serviceItem/index.d.ts +1 -0
  35. package/es/components/booking/info2/service/serviceList/index.d.ts +1 -0
  36. package/es/components/booking/notes/addNote/index.d.ts +1 -0
  37. package/es/components/booking/utils.d.ts +2 -2
  38. package/es/components/eftpos/surcharge/index.d.ts +1 -0
  39. package/es/components/eftposPay/amount.d.ts +1 -1
  40. package/es/components/eftposPay/app.d.ts +1 -0
  41. package/es/components/eftposPay/device.d.ts +2 -1
  42. package/es/components/eftposPay/hooks.d.ts +1 -1
  43. package/es/components/eftposPay/index.d.ts +1 -0
  44. package/es/components/eftposPay/linkly/index.d.ts +1 -0
  45. package/es/components/eftposPay/store/index.d.ts +2 -2
  46. package/es/components/eventBooking/components/Provider/Cart/ContinueButton/index.d.ts +1 -0
  47. package/es/components/eventBooking/components/Provider/Cart/Item/Total.d.ts +1 -0
  48. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +1 -0
  49. package/es/components/eventBooking/components/scheduleCalendar/calendarItem.d.ts +1 -0
  50. package/es/components/eventBooking/index.d.ts +1 -0
  51. package/es/components/pay/toC/PaymentMethods/ApplePay/index.js +68 -35
  52. package/es/components/pay/toC/PaymentMethods/GooglePay/index.js +70 -42
  53. package/es/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/ThreedsLoading/index.d.ts +1 -0
  54. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/Finish/index.d.ts +1 -0
  55. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/SDK.d.ts +1 -0
  56. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/components/PageLoading/index.d.ts +1 -0
  57. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/PaymentRequestForm.d.ts +1 -0
  58. package/es/components/pay/toC/PaymentMethods/SuperPayAliPayH5/index.js +72 -41
  59. package/es/components/pay/toC/PaymentMethods/components/PaymentReturnContent/index.d.ts +15 -0
  60. package/es/components/pay/toC/PaymentMethods/components/PaymentReturnContent/index.js +143 -0
  61. package/es/components/pay/toC/PaymentMethods/components/PaymentReturnContent/index.less +34 -0
  62. package/es/components/pay/toC/PaymentMethods/hooks/index.d.ts +19 -0
  63. package/es/components/pay/toC/PaymentMethods/hooks/index.js +126 -0
  64. package/es/components/pay/toC/index.js +3 -2
  65. package/es/components/pay/toC/locales.d.ts +9 -0
  66. package/es/components/pay/toC/locales.js +12 -3
  67. package/es/components/pay/toC/model.d.ts +1 -0
  68. package/es/components/pay/toC/serve.d.ts +5 -0
  69. package/es/components/pay/toC/serve.js +9 -1
  70. package/es/components/pisellSelectCustomerModal/RightPanel/Add/PhoneField/index.d.ts +1 -0
  71. package/es/components/pisellSelectCustomerModal/RightPanel/index.d.ts +1 -0
  72. package/es/components/pisellSelectCustomerModal/index.d.ts +1 -0
  73. package/es/components/productExtension/index.d.ts +1 -0
  74. package/es/components/productSelect/components/TabProduct/index.d.ts +1 -0
  75. package/es/components/productSelect/components/productGroup/index.d.ts +1 -0
  76. package/es/components/ruleSetting/index.d.ts +1 -0
  77. package/es/components/schedules/components/ScheduleList/RenderScheduleItem/index.d.ts +1 -0
  78. package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/SchedulesModule/AddSchedules/index.d.ts +1 -0
  79. package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/SchedulesModule/index.d.ts +1 -0
  80. package/es/components/shoppingCart/components/Cart/Product.d.ts +1 -0
  81. package/es/components/shoppingCart/components/Cart/index.d.ts +1 -0
  82. package/es/components/taxSelect/index.d.ts +1 -0
  83. package/es/components/ticketBooking/components/addServiceVariant/index.d.ts +1 -0
  84. package/es/components/ticketBooking/components/menuBar/index.d.ts +1 -0
  85. package/es/components/workSpaceList/components/SearchWorkspaceAndBase/index.d.ts +1 -0
  86. package/es/plus/saasCreateOrganization/index.d.ts +1 -0
  87. package/lib/businessModel/SalesModel/index.d.ts +1 -0
  88. package/lib/components/Sales/Event/Detail.js +3 -2
  89. package/lib/components/Sales/Summary/utils.d.ts +1 -1
  90. package/lib/components/appointmentBooking/components/Content/index.d.ts +1 -0
  91. package/lib/components/appointmentBooking/components/Header/index.d.ts +1 -0
  92. package/lib/components/appointmentBooking/components/Voucher/index.d.ts +1 -0
  93. package/lib/components/appointmentBooking/deposit/index.d.ts +1 -0
  94. package/lib/components/appointmentBooking/index.d.ts +1 -0
  95. package/lib/components/booking/components/footer/index.d.ts +1 -0
  96. package/lib/components/booking/deposit/index.d.ts +1 -0
  97. package/lib/components/booking/hooks/useQuotation.d.ts +1 -0
  98. package/lib/components/booking/info/addServiceVariant/index.d.ts +1 -0
  99. package/lib/components/booking/info/header/index.d.ts +1 -0
  100. package/lib/components/booking/info/hooks/useInfoHolder.d.ts +1 -0
  101. package/lib/components/booking/info/index.d.ts +1 -0
  102. package/lib/components/booking/info/service/Lists.d.ts +1 -0
  103. package/lib/components/booking/info/service/addService/index.d.ts +1 -0
  104. package/lib/components/booking/info/service/addTimeModal/index.d.ts +1 -0
  105. package/lib/components/booking/info/service/editService/BookingList/index.d.ts +1 -0
  106. package/lib/components/booking/info/service/serviceItem/index.d.ts +1 -0
  107. package/lib/components/booking/info/service/serviceList/index.d.ts +1 -0
  108. package/lib/components/booking/info/service2/Lists.d.ts +1 -0
  109. package/lib/components/booking/info2/service/addTimeModal/index.d.ts +1 -0
  110. package/lib/components/booking/info2/service/serviceItem/index.d.ts +1 -0
  111. package/lib/components/booking/info2/service/serviceList/index.d.ts +1 -0
  112. package/lib/components/booking/notes/addNote/index.d.ts +1 -0
  113. package/lib/components/booking/utils.d.ts +2 -2
  114. package/lib/components/eftpos/surcharge/index.d.ts +1 -0
  115. package/lib/components/eftposPay/amount.d.ts +1 -1
  116. package/lib/components/eftposPay/app.d.ts +1 -0
  117. package/lib/components/eftposPay/device.d.ts +2 -1
  118. package/lib/components/eftposPay/hooks.d.ts +1 -1
  119. package/lib/components/eftposPay/index.d.ts +1 -0
  120. package/lib/components/eftposPay/linkly/index.d.ts +1 -0
  121. package/lib/components/eftposPay/store/index.d.ts +2 -2
  122. package/lib/components/eventBooking/components/Provider/Cart/ContinueButton/index.d.ts +1 -0
  123. package/lib/components/eventBooking/components/Provider/Cart/Item/Total.d.ts +1 -0
  124. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +1 -0
  125. package/lib/components/eventBooking/components/scheduleCalendar/calendarItem.d.ts +1 -0
  126. package/lib/components/eventBooking/index.d.ts +1 -0
  127. package/lib/components/pay/toC/PaymentMethods/ApplePay/index.js +27 -7
  128. package/lib/components/pay/toC/PaymentMethods/GooglePay/index.js +32 -8
  129. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/ThreedsLoading/index.d.ts +1 -0
  130. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/Finish/index.d.ts +1 -0
  131. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/SDK.d.ts +1 -0
  132. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/components/PageLoading/index.d.ts +1 -0
  133. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/PaymentRequestForm.d.ts +1 -0
  134. package/lib/components/pay/toC/PaymentMethods/SuperPayAliPayH5/index.js +30 -4
  135. package/lib/components/pay/toC/PaymentMethods/components/PaymentReturnContent/index.d.ts +15 -0
  136. package/lib/components/pay/toC/PaymentMethods/components/PaymentReturnContent/index.js +88 -0
  137. package/lib/components/pay/toC/PaymentMethods/components/PaymentReturnContent/index.less +34 -0
  138. package/lib/components/pay/toC/PaymentMethods/hooks/index.d.ts +19 -0
  139. package/lib/components/pay/toC/PaymentMethods/hooks/index.js +90 -0
  140. package/lib/components/pay/toC/index.js +2 -1
  141. package/lib/components/pay/toC/locales.d.ts +9 -0
  142. package/lib/components/pay/toC/locales.js +12 -3
  143. package/lib/components/pay/toC/model.d.ts +1 -0
  144. package/lib/components/pay/toC/serve.d.ts +5 -0
  145. package/lib/components/pay/toC/serve.js +3 -0
  146. package/lib/components/pisellSelectCustomerModal/RightPanel/Add/PhoneField/index.d.ts +1 -0
  147. package/lib/components/pisellSelectCustomerModal/RightPanel/index.d.ts +1 -0
  148. package/lib/components/pisellSelectCustomerModal/index.d.ts +1 -0
  149. package/lib/components/productExtension/index.d.ts +1 -0
  150. package/lib/components/productSelect/components/TabProduct/index.d.ts +1 -0
  151. package/lib/components/productSelect/components/productGroup/index.d.ts +1 -0
  152. package/lib/components/ruleSetting/index.d.ts +1 -0
  153. package/lib/components/schedules/components/ScheduleList/RenderScheduleItem/index.d.ts +1 -0
  154. package/lib/components/schedules/products/ProductDetailDrawer/ProductDetail/SchedulesModule/AddSchedules/index.d.ts +1 -0
  155. package/lib/components/schedules/products/ProductDetailDrawer/ProductDetail/SchedulesModule/index.d.ts +1 -0
  156. package/lib/components/shoppingCart/components/Cart/Product.d.ts +1 -0
  157. package/lib/components/shoppingCart/components/Cart/index.d.ts +1 -0
  158. package/lib/components/taxSelect/index.d.ts +1 -0
  159. package/lib/components/ticketBooking/components/addServiceVariant/index.d.ts +1 -0
  160. package/lib/components/ticketBooking/components/menuBar/index.d.ts +1 -0
  161. package/lib/components/workSpaceList/components/SearchWorkspaceAndBase/index.d.ts +1 -0
  162. package/lib/plus/saasCreateOrganization/index.d.ts +1 -0
  163. package/package.json +4 -4
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  declare const Linkly: ({ api, onChange }: any) => JSX.Element;
2
3
  export default Linkly;
@@ -174,7 +174,7 @@ export declare const updateCustom: (payload: {
174
174
  export declare const updateStatus: (status: 'loading' | 'warn' | 'fail' | 'success' | 'question') => {
175
175
  type: EActionTypes;
176
176
  payload: {
177
- status: "loading" | "success" | "warn" | "fail" | "question";
177
+ status: "loading" | "warn" | "success" | "fail" | "question";
178
178
  };
179
179
  };
180
180
  /**
@@ -308,7 +308,7 @@ export declare const backUpFree: (payload: Partial<State>) => {
308
308
  net?: boolean | undefined;
309
309
  component?: string | undefined;
310
310
  form?: string | undefined;
311
- status?: "loading" | "success" | "warn" | "fail" | "pedding" | "resove" | "reject" | "question" | undefined;
311
+ status?: "loading" | "warn" | "success" | "fail" | "pedding" | "resove" | "reject" | "question" | undefined;
312
312
  warn?: string | undefined;
313
313
  steps?: {
314
314
  /** 用于重置当前步骤 */
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import './index.less';
2
3
  declare const ContinueButton: () => JSX.Element;
3
4
  export default ContinueButton;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import './index.less';
2
3
  declare const Total: ({ className, isFooter }: any) => JSX.Element;
3
4
  export default Total;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  declare type CallToBookProps = {
2
3
  show: boolean;
3
4
  type: string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { CalendarDataItem } from '../../type';
2
3
  declare type CalendarItemProps = {
3
4
  month: string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import './index.less';
2
3
  declare const EventBooking: () => JSX.Element;
3
4
  export default EventBooking;
@@ -35,15 +35,17 @@ module.exports = __toCommonJS(ApplePay_exports);
35
35
  var import_react = __toESM(require("react"));
36
36
  var import_materials = require("@pisell/materials");
37
37
  var import_ThreedsLoading = __toESM(require("../MWCreditCard/TDSPay/ThreedsLoading"));
38
+ var import_PaymentReturnContent = __toESM(require("../components/PaymentReturnContent"));
38
39
  var import_model = require("../../model");
39
40
  var import_utils = require("@pisell/utils");
40
41
  var import_payGroup = require("../../payGroup");
41
42
  var import_useEngineContext = __toESM(require("../../../../../hooks/useEngineContext"));
42
43
  var import_usePaymentLogger = __toESM(require("../../../../../hooks/usePaymentLogger"));
44
+ var import_hooks = require("../hooks");
43
45
  var import_index = require("./index.less");
44
46
  var import_utils2 = require("../../utils");
45
47
  var ApplePay = (props, ref) => {
46
- var _a, _b;
48
+ var _a, _b, _c, _d;
47
49
  const { state } = (0, import_react.useContext)(import_model.Context);
48
50
  const [open, setOpen] = (0, import_react.useState)(false);
49
51
  const context = (0, import_useEngineContext.default)();
@@ -52,8 +54,12 @@ var ApplePay = (props, ref) => {
52
54
  orderId: ((_b = state.payGroup) == null ? void 0 : _b.order_id) || "unknown",
53
55
  step: "2"
54
56
  });
57
+ const { isReturned, handleRedirect, resetState } = (0, import_hooks.usePaymentRedirect)({
58
+ orderId: (_c = state.payGroup) == null ? void 0 : _c.order_id,
59
+ paymentType: "applePay"
60
+ });
55
61
  const init = async ({ payGroup }) => {
56
- var _a2, _b2, _c, _d, _e, _f, _g;
62
+ var _a2, _b2, _c2, _d2, _e, _f, _g;
57
63
  paymentLogger.addLog({
58
64
  key: "ApplePay初始化开始",
59
65
  value: ""
@@ -81,14 +87,14 @@ var ApplePay = (props, ref) => {
81
87
  value: ""
82
88
  });
83
89
  try {
84
- const locale = ((_c = dvaStore.core) == null ? void 0 : _c.translateLocale) || "en";
85
- const shopId = (_f = (_e = (_d = dvaStore.core) == null ? void 0 : _d.core) == null ? void 0 : _e.shop) == null ? void 0 : _f.id;
90
+ const locale = ((_c2 = dvaStore.core) == null ? void 0 : _c2.translateLocale) || "en";
91
+ const shopId = (_f = (_e = (_d2 = dvaStore.core) == null ? void 0 : _d2.core) == null ? void 0 : _e.shop) == null ? void 0 : _f.id;
86
92
  const currentURL = window.location.href;
87
93
  const linkElement = document.createElement("a");
88
94
  linkElement.href = currentURL;
89
95
  const shop_domain = linkElement.hostname;
90
96
  const _href = `${config.pay}${(0, import_utils2.formatFranchiseeRoute)(
91
- `/apple-pay?order_id=${(_g = state.payGroup) == null ? void 0 : _g.order_id}&shop_id=${shopId}&locale=${locale}&shop_domain=${shop_domain}&total_amount=${values.amount}&payment_group_id=${values.payment_group_id}`,
97
+ `/apple-pay?order_id=${(_g = state.payGroup) == null ? void 0 : _g.order_id}&shop_id=${shopId}&locale=${locale}&shop_domain=${shop_domain}&total_amount=${values.amount}&payment_group_id=${values.payment_group_id}&front_order_uuid=${state.front_order_uuid}`,
92
98
  state.history
93
99
  )}`;
94
100
  paymentLogger.addLog({
@@ -96,7 +102,7 @@ var ApplePay = (props, ref) => {
96
102
  value: ""
97
103
  });
98
104
  paymentLogger.sendLogs("ApplePay跳转成功");
99
- window.location.href = _href;
105
+ await handleRedirect(_href);
100
106
  } catch (err) {
101
107
  paymentLogger.addLog({
102
108
  key: "ApplePay处理错误",
@@ -118,6 +124,10 @@ var ApplePay = (props, ref) => {
118
124
  init
119
125
  })
120
126
  );
127
+ const handleReturn = () => {
128
+ setOpen(false);
129
+ resetState();
130
+ };
121
131
  return /* @__PURE__ */ import_react.default.createElement(
122
132
  import_materials.PisellModal,
123
133
  {
@@ -128,11 +138,21 @@ var ApplePay = (props, ref) => {
128
138
  closable: false,
129
139
  bodyStyle: { padding: 0 }
130
140
  },
131
- /* @__PURE__ */ import_react.default.createElement("div", { className: "" }, /* @__PURE__ */ import_react.default.createElement(
141
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "" }, !isReturned && // 跳转前展示 Loading
142
+ /* @__PURE__ */ import_react.default.createElement(
132
143
  import_ThreedsLoading.default,
133
144
  {
134
145
  title: import_utils.locales.getText("tocPay.text.connectingApplePay")
135
146
  }
147
+ ), isReturned && // 跳转后返回时展示新组件内容
148
+ /* @__PURE__ */ import_react.default.createElement(
149
+ import_PaymentReturnContent.default,
150
+ {
151
+ handleReturn,
152
+ state,
153
+ orderId: (_d = state.payGroup) == null ? void 0 : _d.order_id,
154
+ unique_payment_number: state == null ? void 0 : state.front_order_uuid
155
+ }
136
156
  ))
137
157
  );
138
158
  };
@@ -41,8 +41,10 @@ var import_payGroup = require("../../payGroup");
41
41
  var import_useEngineContext = __toESM(require("../../../../../hooks/useEngineContext"));
42
42
  var import_usePaymentLogger = __toESM(require("../../../../../hooks/usePaymentLogger"));
43
43
  var import_utils2 = require("../../utils");
44
+ var import_hooks = require("../hooks");
45
+ var import_PaymentReturnContent = __toESM(require("../components/PaymentReturnContent"));
44
46
  var GooglePay = (props, ref) => {
45
- var _a, _b, _c;
47
+ var _a, _b, _c, _d, _e;
46
48
  const { state } = (0, import_react.useContext)(import_model.Context);
47
49
  const [open, setOpen] = (0, import_react.useState)(false);
48
50
  const context = (0, import_useEngineContext.default)();
@@ -52,12 +54,17 @@ var GooglePay = (props, ref) => {
52
54
  orderId: ((_c = state.payGroup) == null ? void 0 : _c.order_id) || "unknown",
53
55
  step: "2"
54
56
  });
57
+ const { isReturned, handleRedirect, resetState } = (0, import_hooks.usePaymentRedirect)({
58
+ orderId: (_d = state.payGroup) == null ? void 0 : _d.order_id,
59
+ paymentType: "googlePay"
60
+ });
55
61
  const init = async ({ payGroup }) => {
56
- var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k;
62
+ var _a2, _b2, _c2, _d2, _e2, _f, _g, _h, _i, _j, _k;
57
63
  paymentLogger.addLog({
58
64
  key: "GooglePay初始化开始",
59
65
  value: ""
60
66
  });
67
+ setOpen(true);
61
68
  const utils = context.appHelper.utils || {};
62
69
  const dvaStore = (_b2 = (_a2 = utils == null ? void 0 : utils.getStore) == null ? void 0 : _a2.call(utils)) == null ? void 0 : _b2.getState();
63
70
  const values = (0, import_payGroup.getPayGroupParamsFromStorage)(payGroup.order_id);
@@ -79,15 +86,19 @@ var GooglePay = (props, ref) => {
79
86
  key: "GooglePay获取支付参数成功",
80
87
  value: ""
81
88
  });
82
- if (((_d = (_c2 = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _c2.isAppEnv) == null ? void 0 : _d.call(_c2)) && ((_f = (_e = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _e.isAndroid_ios) == null ? void 0 : _f.call(_e)) === "android") {
89
+ if (((_d2 = (_c2 = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _c2.isAppEnv) == null ? void 0 : _d2.call(_c2)) && ((_f = (_e2 = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _e2.isAndroid_ios) == null ? void 0 : _f.call(_e2)) === "android") {
83
90
  paymentLogger.addLog({
84
91
  key: "GooglePay使用Android客户端支付",
85
92
  value: ""
86
93
  });
87
94
  paymentLogger.sendLogs("GooglePay客户端支付");
88
- return (0, import_utils2.clientPayment)({ order_id: payGroup.order_id, type: "google_pay", values, interaction });
95
+ return (0, import_utils2.clientPayment)({
96
+ order_id: payGroup.order_id,
97
+ type: "google_pay",
98
+ values,
99
+ interaction
100
+ });
89
101
  }
90
- setOpen(true);
91
102
  try {
92
103
  const locale = ((_g = dvaStore.core) == null ? void 0 : _g.translateLocale) || "en";
93
104
  const shopId = (_j = (_i = (_h = dvaStore.core) == null ? void 0 : _h.core) == null ? void 0 : _i.shop) == null ? void 0 : _j.id;
@@ -96,7 +107,7 @@ var GooglePay = (props, ref) => {
96
107
  linkElement.href = currentURL;
97
108
  const shop_domain = linkElement.hostname;
98
109
  const _href = `${config.pay}${(0, import_utils2.formatFranchiseeRoute)(
99
- `/google-pay?order_id=${(_k = state.payGroup) == null ? void 0 : _k.order_id}&shop_id=${shopId}&locale=${locale}&shop_domain=${shop_domain}&total_amount=${values.amount}&payment_group_id=${values.payment_group_id}`,
110
+ `/google-pay?order_id=${(_k = state.payGroup) == null ? void 0 : _k.order_id}&shop_id=${shopId}&locale=${locale}&shop_domain=${shop_domain}&total_amount=${values.amount}&payment_group_id=${values.payment_group_id}&front_order_uuid=${state.front_order_uuid}`,
100
111
  state.history
101
112
  )}`;
102
113
  paymentLogger.addLog({
@@ -104,7 +115,7 @@ var GooglePay = (props, ref) => {
104
115
  value: ""
105
116
  });
106
117
  paymentLogger.sendLogs("GooglePay跳转成功");
107
- window.location.href = _href;
118
+ await handleRedirect(_href);
108
119
  } catch (err) {
109
120
  paymentLogger.addLog({
110
121
  key: "GooglePay处理错误",
@@ -126,6 +137,10 @@ var GooglePay = (props, ref) => {
126
137
  init
127
138
  })
128
139
  );
140
+ const handleReturn = () => {
141
+ setOpen(false);
142
+ resetState();
143
+ };
129
144
  return /* @__PURE__ */ import_react.default.createElement(
130
145
  import_materials.PisellModal,
131
146
  {
@@ -136,11 +151,20 @@ var GooglePay = (props, ref) => {
136
151
  closable: false,
137
152
  bodyStyle: { padding: 0 }
138
153
  },
139
- /* @__PURE__ */ import_react.default.createElement("div", { className: "" }, /* @__PURE__ */ import_react.default.createElement(
154
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "" }, !isReturned && /* @__PURE__ */ import_react.default.createElement(
140
155
  import_ThreedsLoading.default,
141
156
  {
142
157
  title: import_utils.locales.getText("tocPay.text.connectingGooglePay")
143
158
  }
159
+ ), isReturned && // 跳转后返回时展示新组件内容
160
+ /* @__PURE__ */ import_react.default.createElement(
161
+ import_PaymentReturnContent.default,
162
+ {
163
+ handleReturn,
164
+ state,
165
+ orderId: (_e = state.payGroup) == null ? void 0 : _e.order_id,
166
+ unique_payment_number: state.front_order_uuid
167
+ }
144
168
  ))
145
169
  );
146
170
  };
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import './index.less';
2
3
  declare const ThreedsLoading: ({ title, showSuccessBackButton, onSuccessBack }: any) => JSX.Element;
3
4
  export default ThreedsLoading;
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  declare const StripePayment: () => JSX.Element;
2
3
  export default StripePayment;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  declare const StripeSDK: ({ public_key, client_secret, children, lang, }: {
2
3
  public_key: string;
3
4
  client_secret?: string | undefined;
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  declare const PageLoading: () => JSX.Element;
2
3
  export default PageLoading;
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  declare const PaymentRequestForm: () => JSX.Element | null;
2
3
  export default PaymentRequestForm;
@@ -43,18 +43,25 @@ var import_index = require("./index.less");
43
43
  var import_useEngineContext = __toESM(require("../../../../../hooks/useEngineContext"));
44
44
  var import_usePaymentLogger = __toESM(require("../../../../../hooks/usePaymentLogger"));
45
45
  var import_utils2 = require("../../utils");
46
+ var import_hooks = require("../hooks");
47
+ var import_PaymentReturnContent = __toESM(require("../components/PaymentReturnContent"));
46
48
  var SuperPayAliPayH5 = (props, ref) => {
47
- var _a, _b;
49
+ var _a, _b, _c, _d;
48
50
  const { state } = (0, import_react.useContext)(import_model.Context);
49
51
  const { onChange } = props;
50
52
  const [open, setOpen] = (0, import_react.useState)(false);
51
53
  const [showSuccessBackButton, setShowSuccessBackButton] = (0, import_react.useState)(false);
54
+ const [statePayNumber, setStatePayNumber] = (0, import_react.useState)("");
52
55
  const context = (0, import_useEngineContext.default)();
53
56
  const { interaction } = (_a = context.appHelper) == null ? void 0 : _a.utils;
54
57
  const paymentLogger = (0, import_usePaymentLogger.default)({
55
58
  orderId: ((_b = state.payGroup) == null ? void 0 : _b.order_id) || "unknown",
56
59
  step: "2"
57
60
  });
61
+ const { isReturned, handleRedirect, resetState } = (0, import_hooks.usePaymentRedirect)({
62
+ orderId: (_c = state.payGroup) == null ? void 0 : _c.order_id,
63
+ paymentType: "aliPay"
64
+ });
58
65
  const init = async ({ payGroup }) => {
59
66
  var _a2, _b2;
60
67
  paymentLogger.addLog({
@@ -68,7 +75,12 @@ var SuperPayAliPayH5 = (props, ref) => {
68
75
  value: "检测到App环境,调用客户端支付"
69
76
  });
70
77
  paymentLogger.sendLogs("SuperPayAliPayH5App环境支付");
71
- return (0, import_utils2.clientPayment)({ order_id: payGroup.order_id, type: "aliPay", values, interaction });
78
+ return (0, import_utils2.clientPayment)({
79
+ order_id: payGroup.order_id,
80
+ type: "aliPay",
81
+ values,
82
+ interaction
83
+ });
72
84
  }
73
85
  setOpen(true);
74
86
  if (!values) {
@@ -97,13 +109,14 @@ var SuperPayAliPayH5 = (props, ref) => {
97
109
  value: ""
98
110
  });
99
111
  (0, import_payGroup.setPayNumber)(payGroup == null ? void 0 : payGroup.order_id, data == null ? void 0 : data.pay_number);
112
+ setStatePayNumber(data == null ? void 0 : data.pay_number);
100
113
  setShowSuccessBackButton(true);
101
114
  paymentLogger.addLog({
102
115
  key: "SuperPayAliPayH5准备跳转支付宝",
103
116
  value: ""
104
117
  });
105
118
  paymentLogger.sendLogs("SuperPayAliPayH5跳转成功");
106
- window.location.href = data == null ? void 0 : data.pay_url;
119
+ await handleRedirect(data == null ? void 0 : data.pay_url);
107
120
  } else {
108
121
  paymentLogger.addLog({
109
122
  key: "SuperPayAliPayH5支付链接为空",
@@ -144,6 +157,10 @@ var SuperPayAliPayH5 = (props, ref) => {
144
157
  key: "success"
145
158
  });
146
159
  };
160
+ const handleReturn = () => {
161
+ setOpen(false);
162
+ resetState();
163
+ };
147
164
  return /* @__PURE__ */ import_react.default.createElement(
148
165
  import_materials.PisellModal,
149
166
  {
@@ -154,13 +171,22 @@ var SuperPayAliPayH5 = (props, ref) => {
154
171
  closable: false,
155
172
  bodyStyle: { padding: 0 }
156
173
  },
157
- /* @__PURE__ */ import_react.default.createElement("div", { className: "" }, /* @__PURE__ */ import_react.default.createElement(
174
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "" }, !isReturned && /* @__PURE__ */ import_react.default.createElement(
158
175
  import_ThreedsLoading.default,
159
176
  {
160
177
  title: import_utils.locales.getText("tocPay.text.redirectingToAlipay"),
161
178
  onSuccessBack: handleSuccessBack,
162
179
  showSuccessBackButton
163
180
  }
181
+ ), isReturned && /* @__PURE__ */ import_react.default.createElement(
182
+ import_PaymentReturnContent.default,
183
+ {
184
+ pay_number: statePayNumber,
185
+ handleReturn,
186
+ state,
187
+ orderId: (_d = state.payGroup) == null ? void 0 : _d.order_id,
188
+ unique_payment_number: state.front_order_uuid
189
+ }
164
190
  ))
165
191
  );
166
192
  };
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ export interface PaymentReturnContentProps {
4
+ orderId?: string;
5
+ unique_payment_number?: string;
6
+ state?: any;
7
+ handleReturn?: () => void;
8
+ pay_number?: string;
9
+ }
10
+ /**
11
+ * 支付返回后展示的内容组件
12
+ * 当用户从外部支付页面返回时展示此组件
13
+ */
14
+ declare const PaymentReturnContent: React.FC<PaymentReturnContentProps>;
15
+ export default PaymentReturnContent;
@@ -0,0 +1,88 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/components/pay/toC/PaymentMethods/components/PaymentReturnContent/index.tsx
30
+ var PaymentReturnContent_exports = {};
31
+ __export(PaymentReturnContent_exports, {
32
+ default: () => PaymentReturnContent_default
33
+ });
34
+ module.exports = __toCommonJS(PaymentReturnContent_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_materials = require("@pisell/materials");
37
+ var import_utils = require("@pisell/utils");
38
+ var import_ahooks = require("ahooks");
39
+ var import_serve = require("../../../serve");
40
+ var import_usePrefix = __toESM(require("../../../../../../hooks/usePrefix"));
41
+ var import_index = require("./index.less");
42
+ var PaymentReturnContent = ({
43
+ orderId,
44
+ unique_payment_number,
45
+ state,
46
+ handleReturn,
47
+ pay_number
48
+ }) => {
49
+ const prefix = (0, import_usePrefix.default)();
50
+ const getPaymentIsPaid = (0, import_ahooks.useMemoizedFn)(async () => {
51
+ if (!unique_payment_number && !pay_number) {
52
+ return true;
53
+ }
54
+ const { data } = await (0, import_serve.getPaymentResult)({
55
+ order_id: orderId,
56
+ pay_number,
57
+ unique_payment_number: pay_number ? void 0 : unique_payment_number
58
+ });
59
+ return (data == null ? void 0 : data.payment_status) === "paid";
60
+ });
61
+ const handleViewOrder = async () => {
62
+ var _a;
63
+ const isPaid = await getPaymentIsPaid();
64
+ if (!isPaid) {
65
+ (0, import_materials.PisellToast)({
66
+ content: import_utils.locales.getText("tocPay.text.paymentFailed")
67
+ });
68
+ return;
69
+ }
70
+ (_a = state.payCallback) == null ? void 0 : _a.call(state, {
71
+ key: "success"
72
+ });
73
+ };
74
+ const handleGoBack = async () => {
75
+ var _a;
76
+ const isPaid = await getPaymentIsPaid();
77
+ if (!isPaid) {
78
+ handleReturn == null ? void 0 : handleReturn();
79
+ return;
80
+ } else {
81
+ (_a = state.payCallback) == null ? void 0 : _a.call(state, {
82
+ key: "success"
83
+ });
84
+ }
85
+ };
86
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "payment-return-content" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "payment-return-content-img" }, /* @__PURE__ */ import_react.default.createElement("img", { src: `${prefix}/payment-content.png`, alt: "success" })), /* @__PURE__ */ import_react.default.createElement("div", { className: "payment-return-content-buttons" }, /* @__PURE__ */ import_react.default.createElement(import_materials.Button, { block: true, className: "payment-return-content-order-button", onClick: handleViewOrder }, import_utils.locales.getText("tocPay.text.paymentCompletedAndViewOrder")), /* @__PURE__ */ import_react.default.createElement(import_materials.Button, { block: true, onClick: handleGoBack }, import_utils.locales.getText("tocPay.text.returnAndSelectOtherPaymentMethod"))));
87
+ };
88
+ var PaymentReturnContent_default = PaymentReturnContent;
@@ -0,0 +1,34 @@
1
+ .payment-return-content {
2
+ padding: 100px 46px 0;
3
+
4
+ .payment-return-content-img {
5
+ width: 100%;
6
+ margin-bottom: 60px;
7
+ min-height: 270px;
8
+ img {
9
+ width: 100%;
10
+ height: 100%;
11
+ }
12
+ }
13
+
14
+ .payment-return-content-buttons {
15
+ display: flex;
16
+ flex-direction: column;
17
+ gap: 24px;
18
+ button {
19
+ border-radius: 40px;
20
+ span {
21
+ width: 100%;
22
+ text-overflow: ellipsis;
23
+ overflow: hidden;
24
+ }
25
+ }
26
+ .payment-return-content-order-button {
27
+ background: #7F56DA;
28
+ color: var(--Primary-700, #6941C6);
29
+ border: 1px solid var(--Primary-200, #E9D7FE);
30
+ background: var(--Primary-50, #F9F5FF);
31
+ }
32
+ }
33
+ }
34
+
@@ -0,0 +1,19 @@
1
+ export interface UsePaymentRedirectOptions {
2
+ orderId?: string;
3
+ paymentType: string;
4
+ onAfterReturn?: () => void;
5
+ }
6
+ export interface UsePaymentRedirectReturn {
7
+ isReturned: boolean;
8
+ handleRedirect: (url: string) => Promise<void>;
9
+ resetState: () => void;
10
+ }
11
+ /**
12
+ * 支付跳转 Hook
13
+ * 用于处理跳转到外部支付页面的逻辑,包括:
14
+ * 1. 保存跳转标记到 history state
15
+ * 2. 跳转到外部支付页面
16
+ * 3. 监听页面返回事件
17
+ * 4. 返回后更新状态
18
+ */
19
+ export declare const usePaymentRedirect: (options: UsePaymentRedirectOptions) => UsePaymentRedirectReturn;
@@ -0,0 +1,90 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/components/pay/toC/PaymentMethods/hooks/index.tsx
20
+ var hooks_exports = {};
21
+ __export(hooks_exports, {
22
+ usePaymentRedirect: () => usePaymentRedirect
23
+ });
24
+ module.exports = __toCommonJS(hooks_exports);
25
+ var import_ahooks = require("ahooks");
26
+ var import_react = require("react");
27
+ var usePaymentRedirect = (options) => {
28
+ const { orderId, paymentType, onAfterReturn } = options;
29
+ const [isReturned, setIsReturned] = (0, import_react.useState)(false);
30
+ const handleRedirect = (0, import_ahooks.useMemoizedFn)(
31
+ async (url) => {
32
+ try {
33
+ const currentState = window.history.state || {};
34
+ window.history.replaceState(
35
+ {
36
+ ...currentState,
37
+ paymentRedirected: true,
38
+ paymentType,
39
+ orderId,
40
+ timestamp: Date.now()
41
+ },
42
+ "",
43
+ window.location.href
44
+ );
45
+ window.location.href = url;
46
+ } catch (error) {
47
+ throw error;
48
+ }
49
+ }
50
+ );
51
+ const resetState = (0, import_ahooks.useMemoizedFn)(() => {
52
+ setIsReturned(false);
53
+ });
54
+ (0, import_react.useEffect)(() => {
55
+ const handlePageShow = (event) => {
56
+ if (!orderId) return;
57
+ const historyState = window.history.state;
58
+ if ((historyState == null ? void 0 : historyState.paymentRedirected) && (historyState == null ? void 0 : historyState.paymentType) === paymentType && (historyState == null ? void 0 : historyState.orderId) === orderId) {
59
+ console.log(
60
+ `检测到从 ${paymentType} 返回, event.persisted:`,
61
+ event.persisted
62
+ );
63
+ setIsReturned(true);
64
+ if (onAfterReturn) {
65
+ onAfterReturn();
66
+ }
67
+ const newState = { ...historyState };
68
+ delete newState.paymentRedirected;
69
+ delete newState.paymentType;
70
+ delete newState.timestamp;
71
+ delete newState.orderId;
72
+ window.history.replaceState(newState, "", window.location.href);
73
+ }
74
+ };
75
+ handlePageShow({ persisted: false });
76
+ window.addEventListener("pageshow", handlePageShow);
77
+ return () => {
78
+ window.removeEventListener("pageshow", handlePageShow);
79
+ };
80
+ }, [orderId, paymentType]);
81
+ return {
82
+ isReturned,
83
+ handleRedirect,
84
+ resetState
85
+ };
86
+ };
87
+ // Annotate the CommonJS export names for ESM import in node:
88
+ 0 && (module.exports = {
89
+ usePaymentRedirect
90
+ });
@@ -83,7 +83,8 @@ var ToCPay = (props, ref) => {
83
83
  status: "init",
84
84
  // 将支付回调储存在store, 方便其他模块调用
85
85
  payCallback: props.callback,
86
- history: (_a2 = context.appHelper.utils) == null ? void 0 : _a2.history
86
+ history: (_a2 = context.appHelper.utils) == null ? void 0 : _a2.history,
87
+ front_order_uuid: (0, import_utils.getUniqueId)("front_order_uuid_")
87
88
  // 支付组
88
89
  // payGroup: {
89
90
  // order_id: initProps?.order?.order_id,