@pisell/private-materials 6.4.2 → 6.4.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.
@@ -63,6 +63,7 @@ var import_constants = require("./constants");
63
63
  var import_lodash = require("lodash");
64
64
  var import_utils2 = require("./utils");
65
65
  var import_usePaymentLogger = __toESM(require("./hooks/usePaymentLogger"));
66
+ var import_antd = require("antd");
66
67
  var CheckoutHooks = {
67
68
  OnStateAmountChanged: "checkout:onStateAmountChanged",
68
69
  OnBalanceDueAmountChanged: "checkout:onBalanceDueAmountChanged",
@@ -89,7 +90,8 @@ var PaymentContent = (0, import_react.forwardRef)(
89
90
  moduleConfig: parentModuleConfig,
90
91
  onShowCashPaymentChange,
91
92
  showSuccessToast,
92
- dynamicMaxHeight = "600px"
93
+ dynamicMaxHeight = "600px",
94
+ onOrderSyncFailed
93
95
  }, ref) => {
94
96
  var _a;
95
97
  const context = (0, import_useEngineContext.default)();
@@ -366,13 +368,18 @@ var PaymentContent = (0, import_react.forwardRef)(
366
368
  const orderSubmitEndUnsubscribe = core.effects.on(
367
369
  CheckoutHooks.OnOrderSubmitEnd,
368
370
  (res) => {
369
- var _a2;
371
+ var _a2, _b;
370
372
  if (res.success) {
371
373
  (_a2 = Toast == null ? void 0 : Toast.hide) == null ? void 0 : _a2.call(Toast);
372
374
  } else {
373
- Toast == null ? void 0 : Toast.fail(
374
- import_utils.locales.getText("pisell2.checkout.order-sync-failed") || "Order sync failed"
375
- );
375
+ (_b = Toast == null ? void 0 : Toast.hide) == null ? void 0 : _b.call(Toast);
376
+ if (onOrderSyncFailed) {
377
+ onOrderSyncFailed();
378
+ } else {
379
+ Toast == null ? void 0 : Toast.fail(
380
+ import_utils.locales.getText("pisell2.checkout.order-sync-failed") || "Order sync failed"
381
+ );
382
+ }
376
383
  }
377
384
  }
378
385
  );
@@ -531,9 +538,7 @@ var PaymentContent = (0, import_react.forwardRef)(
531
538
  logger == null ? void 0 : logger.addLog({
532
539
  type: "info",
533
540
  title: "handleSelectWalletChange checkoutModule updateVoucherPaymentItemsAsync",
534
- metadata: {
535
- voucherItems
536
- }
541
+ metadata: {}
537
542
  });
538
543
  await checkoutModule.updateVoucherPaymentItemsAsync(voucherItems);
539
544
  if (walletPassRef.current) {
@@ -886,7 +891,17 @@ var PaymentModal = ({
886
891
  const [totalAmount, setTotalAmount] = (0, import_react.useState)(0);
887
892
  const [actualShowCashPayment, setActualShowCashPayment] = (0, import_react.useState)(true);
888
893
  const [windowHeight, setWindowHeight] = (0, import_react.useState)(0);
894
+ const [showRetryModal, setShowRetryModal] = (0, import_react.useState)(false);
889
895
  const Toast = (0, import_useToast.default)();
896
+ const handleRetry = async () => {
897
+ const checkoutModule = pisellos == null ? void 0 : pisellos.getModule("checkout");
898
+ const res = await (checkoutModule == null ? void 0 : checkoutModule.manualSyncOrderAsync());
899
+ console.log(res);
900
+ if (res.success) {
901
+ setShowRetryModal(false);
902
+ showSuccessToast == null ? void 0 : showSuccessToast(res);
903
+ }
904
+ };
890
905
  (0, import_react.useEffect)(() => {
891
906
  const updateHeight = () => {
892
907
  if (typeof window !== "undefined") {
@@ -1555,7 +1570,8 @@ var PaymentModal = ({
1555
1570
  moduleConfig,
1556
1571
  onShowCashPaymentChange: handleShowCashPaymentChange,
1557
1572
  showSuccessToast,
1558
- dynamicMaxHeight
1573
+ dynamicMaxHeight,
1574
+ onOrderSyncFailed: () => setShowRetryModal(true)
1559
1575
  }
1560
1576
  )
1561
1577
  ), noteModalOpen && (0, import_react_dom.createPortal)(
@@ -1571,6 +1587,23 @@ var PaymentModal = ({
1571
1587
  }
1572
1588
  )),
1573
1589
  document.body
1590
+ ), /* @__PURE__ */ import_react.default.createElement(
1591
+ import_materials.PisellContainer,
1592
+ {
1593
+ renderType: "modal",
1594
+ props: {
1595
+ open: showRetryModal,
1596
+ title: import_utils.locales.getText("pisell2.checkout.tips"),
1597
+ footer: null,
1598
+ closable: false,
1599
+ maskClosable: false,
1600
+ keyboard: false,
1601
+ onCancel: () => {
1602
+ }
1603
+ // 禁用关闭
1604
+ }
1605
+ },
1606
+ /* @__PURE__ */ import_react.default.createElement("div", { style: { textAlign: "center", padding: "20px" } }, /* @__PURE__ */ import_react.default.createElement("div", { style: { marginBottom: "16px", fontSize: "16px" } }, import_utils.locales.getText("pisell2.checkout.sync-retry-hint") || "请点击重试按钮重新同步订单"), /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { type: "primary", size: "large", onClick: handleRetry, style: { width: "100%", marginTop: "80px" } }, import_utils.locales.getText("retry") || "重试"))
1574
1607
  ));
1575
1608
  };
1576
1609
  var PaymentModal_default = PaymentModal;
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  declare const PaymentPlugin: () => JSX.Element;
3
2
  export default PaymentPlugin;
@@ -1,4 +1,6 @@
1
1
  .additional-module {
2
+ padding-bottom: 16px; // 底部间距
3
+
2
4
  // 标题样式
3
5
  &-title {
4
6
  font-size: 24px;
@@ -258,10 +258,7 @@ var useWalletPass = (props) => {
258
258
  logger == null ? void 0 : logger.addLog({
259
259
  type: "info",
260
260
  title: "useWalletPass_onOrderCreated onSelectChange 开始调用",
261
- metadata: {
262
- recommendList,
263
- select
264
- }
261
+ metadata: {}
265
262
  });
266
263
  onSelectChange == null ? void 0 : onSelectChange(select);
267
264
  } else {
@@ -413,10 +410,7 @@ var useWalletPass = (props) => {
413
410
  logger == null ? void 0 : logger.addLog({
414
411
  type: "info",
415
412
  title: "useWalletPass_handleFetchUserIdentificationCodes onSelectChange 开始调用",
416
- metadata: {
417
- prepare_payments,
418
- select
419
- }
413
+ metadata: {}
420
414
  });
421
415
  onSelectChange == null ? void 0 : onSelectChange(select);
422
416
  fetchUserIdentificationCodes({
@@ -91,7 +91,6 @@
91
91
  .additional-module-container {
92
92
  flex-shrink: 0; // 不允许缩小
93
93
  min-height: 60px; // 确保额外模块有足够的显示空间
94
- padding-bottom: 16px; // 底部间距
95
94
  position: absolute;
96
95
  bottom: 0;
97
96
  width: calc(100% - 80px);
@@ -147,6 +147,9 @@ declare const _default: {
147
147
  'wallet-pass-module-customer-name-walk-in': string;
148
148
  'pisell2.amount-summary.amount-cannot-be-zero': string;
149
149
  'pisell2.checkout.order-sync-failed': string;
150
+ 'pisell2.checkout.sync-retry-hint': string;
151
+ 'pisell2.checkout.tips': string;
152
+ retry: string;
150
153
  };
151
154
  'zh-CN': {
152
155
  'order.total': string;
@@ -296,6 +299,9 @@ declare const _default: {
296
299
  'wallet-pass-module-customer-name-walk-in': string;
297
300
  'pisell2.amount-summary.amount-cannot-be-zero': string;
298
301
  'pisell2.checkout.order-sync-failed': string;
302
+ 'pisell2.checkout.sync-retry-hint': string;
303
+ 'pisell2.checkout.tips': string;
304
+ retry: string;
299
305
  };
300
306
  'zh-HK': {
301
307
  'order.total': string;
@@ -445,6 +451,9 @@ declare const _default: {
445
451
  'wallet-pass-module-customer-name-walk-in': string;
446
452
  'pisell2.amount-summary.amount-cannot-be-zero': string;
447
453
  'pisell2.checkout.order-sync-failed': string;
454
+ 'pisell2.checkout.sync-retry-hint': string;
455
+ 'pisell2.checkout.tips': string;
456
+ retry: string;
448
457
  };
449
458
  };
450
459
  export default _default;
@@ -202,7 +202,10 @@ var locales_default = {
202
202
  // Amount validation errors
203
203
  "pisell2.amount-summary.amount-cannot-be-zero": "The amount cannot be 0",
204
204
  // Order sync errors
205
- "pisell2.checkout.order-sync-failed": "Order sync failed, please check your network"
205
+ "pisell2.checkout.order-sync-failed": "Order sync failed, please check your network",
206
+ "pisell2.checkout.sync-retry-hint": "Network error, please click the retry button to resync the order",
207
+ "pisell2.checkout.tips": "Tips",
208
+ "retry": "Retry"
206
209
  },
207
210
  "zh-CN": {
208
211
  // Order and Payment
@@ -387,7 +390,10 @@ var locales_default = {
387
390
  // Amount validation errors
388
391
  "pisell2.amount-summary.amount-cannot-be-zero": "金额不能为0",
389
392
  // Order sync errors
390
- "pisell2.checkout.order-sync-failed": "订单同步失败,请检查网络"
393
+ "pisell2.checkout.order-sync-failed": "订单同步失败,请检查网络",
394
+ "pisell2.checkout.sync-retry-hint": "网络异常,请点击重试按钮重新同步订单",
395
+ "pisell2.checkout.tips": "提示",
396
+ "retry": "重试"
391
397
  },
392
398
  "zh-HK": {
393
399
  // Order and Payment
@@ -572,6 +578,9 @@ var locales_default = {
572
578
  // Amount validation errors
573
579
  "pisell2.amount-summary.amount-cannot-be-zero": "金額不能為0",
574
580
  // Order sync errors
575
- "pisell2.checkout.order-sync-failed": "訂單同步失敗,請檢查網絡"
581
+ "pisell2.checkout.order-sync-failed": "訂單同步失敗,請檢查網絡",
582
+ "pisell2.checkout.sync-retry-hint": "網絡異常,請點擊重試按鈕重新同步訂單",
583
+ "pisell2.checkout.tips": "提示",
584
+ "retry": "重試"
576
585
  }
577
586
  };
@@ -92,7 +92,7 @@ var index = ({
92
92
  return (0, import_ProductList.createGridComponents)(layout);
93
93
  }, [layout]);
94
94
  const context = (0, import_useEngineContext.default)();
95
- (0, import_react.useEffect)(() => {
95
+ (0, import_react.useLayoutEffect)(() => {
96
96
  var _a, _b;
97
97
  import_utils.locales.init(
98
98
  import_locales.default,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "6.4.2",
3
+ "version": "6.4.3",
4
4
  "scripts": {
5
5
  "dev": "father dev",
6
6
  "build": "father build",