@pisell/pisellos 2.1.38 → 2.1.40

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 (79) hide show
  1. package/dist/effects/index.d.ts +1 -0
  2. package/dist/effects/index.js +29 -6
  3. package/dist/modules/Account/index.js +2 -3
  4. package/dist/modules/BaseModule.d.ts +3 -0
  5. package/dist/modules/BaseModule.js +15 -0
  6. package/dist/modules/Customer/index.js +10 -11
  7. package/dist/modules/Customer/types.d.ts +2 -2
  8. package/dist/modules/Customer/types.js +2 -2
  9. package/dist/modules/Discount/index.js +1 -1
  10. package/dist/modules/Guests/index.js +9 -9
  11. package/dist/modules/Order/index.js +5 -5
  12. package/dist/modules/Order/types.d.ts +1 -0
  13. package/dist/modules/Payment/index.js +17 -17
  14. package/dist/modules/Payment/walletpass.js +4 -1
  15. package/dist/modules/Product/index.d.ts +1 -1
  16. package/dist/modules/ProductList/index.js +2 -3
  17. package/dist/modules/Resource/index.js +1 -1
  18. package/dist/modules/Rules/index.js +2 -3
  19. package/dist/plugins/request.d.ts +1 -0
  20. package/dist/solution/BookingByStep/index.d.ts +6 -2
  21. package/dist/solution/BookingByStep/index.js +33 -9
  22. package/dist/solution/BookingTicket/index.d.ts +4 -0
  23. package/dist/solution/BookingTicket/index.js +17 -8
  24. package/dist/solution/BookingTicket/utils/scan/index.d.ts +4 -0
  25. package/dist/solution/BookingTicket/utils/scan/index.js +25 -16
  26. package/dist/solution/BuyTickets/index.js +7 -8
  27. package/dist/solution/Checkout/index.js +35 -35
  28. package/dist/solution/RegisterAndLogin/config.d.ts +87 -0
  29. package/dist/solution/RegisterAndLogin/config.js +792 -0
  30. package/dist/solution/RegisterAndLogin/index.d.ts +189 -0
  31. package/dist/solution/RegisterAndLogin/index.js +2667 -0
  32. package/dist/solution/RegisterAndLogin/types.d.ts +444 -0
  33. package/dist/solution/RegisterAndLogin/types.js +231 -0
  34. package/dist/solution/RegisterAndLogin/utils.d.ts +95 -0
  35. package/dist/solution/RegisterAndLogin/utils.js +322 -0
  36. package/dist/solution/ShopDiscount/index.js +36 -19
  37. package/dist/solution/index.d.ts +1 -0
  38. package/dist/solution/index.js +1 -0
  39. package/dist/types/index.d.ts +1 -0
  40. package/lib/effects/index.d.ts +1 -0
  41. package/lib/effects/index.js +13 -0
  42. package/lib/modules/Account/index.js +2 -3
  43. package/lib/modules/BaseModule.d.ts +3 -0
  44. package/lib/modules/BaseModule.js +9 -0
  45. package/lib/modules/Customer/index.js +10 -11
  46. package/lib/modules/Customer/types.d.ts +2 -2
  47. package/lib/modules/Customer/types.js +2 -2
  48. package/lib/modules/Discount/index.js +1 -1
  49. package/lib/modules/Guests/index.js +9 -9
  50. package/lib/modules/Order/index.js +6 -3
  51. package/lib/modules/Order/types.d.ts +1 -0
  52. package/lib/modules/Payment/index.js +16 -16
  53. package/lib/modules/Payment/walletpass.js +3 -1
  54. package/lib/modules/Product/index.d.ts +1 -1
  55. package/lib/modules/ProductList/index.js +2 -3
  56. package/lib/modules/Resource/index.js +1 -1
  57. package/lib/modules/Rules/index.js +2 -3
  58. package/lib/plugins/request.d.ts +1 -0
  59. package/lib/solution/BookingByStep/index.d.ts +6 -2
  60. package/lib/solution/BookingByStep/index.js +10 -3
  61. package/lib/solution/BookingTicket/index.d.ts +4 -0
  62. package/lib/solution/BookingTicket/index.js +12 -6
  63. package/lib/solution/BookingTicket/utils/scan/index.d.ts +4 -0
  64. package/lib/solution/BookingTicket/utils/scan/index.js +7 -1
  65. package/lib/solution/BuyTickets/index.js +7 -8
  66. package/lib/solution/Checkout/index.js +34 -34
  67. package/lib/solution/RegisterAndLogin/config.d.ts +87 -0
  68. package/lib/solution/RegisterAndLogin/config.js +594 -0
  69. package/lib/solution/RegisterAndLogin/index.d.ts +189 -0
  70. package/lib/solution/RegisterAndLogin/index.js +1593 -0
  71. package/lib/solution/RegisterAndLogin/types.d.ts +444 -0
  72. package/lib/solution/RegisterAndLogin/types.js +78 -0
  73. package/lib/solution/RegisterAndLogin/utils.d.ts +95 -0
  74. package/lib/solution/RegisterAndLogin/utils.js +279 -0
  75. package/lib/solution/ShopDiscount/index.js +19 -11
  76. package/lib/solution/index.d.ts +1 -0
  77. package/lib/solution/index.js +2 -0
  78. package/lib/types/index.d.ts +1 -0
  79. package/package.json +1 -1
@@ -24,7 +24,6 @@ __export(BuyTickets_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(BuyTickets_exports);
26
26
  var import_modules = require("../../modules/");
27
- var import_types = require("./types");
28
27
  var import_BaseModule = require("../../modules/BaseModule");
29
28
  __reExport(BuyTickets_exports, require("./types"), module.exports);
30
29
  var BuyTicketsImpl = class extends import_BaseModule.BaseModule {
@@ -49,7 +48,7 @@ var BuyTicketsImpl = class extends import_BaseModule.BaseModule {
49
48
  if (this.otherParams.prodctIds) {
50
49
  await this.loadProductsByIds(this.otherParams.prodctIds);
51
50
  }
52
- await this.core.effects.emit(import_types.BuyTicketsHooks.onInited, {});
51
+ await this.core.effects.emit(`${this.name}:onInited`, {});
53
52
  }
54
53
  // 通过 ids 获取产品,在当前解决方案下,获取到的就是主商品
55
54
  async loadProductsByIds(ids) {
@@ -69,13 +68,13 @@ var BuyTicketsImpl = class extends import_BaseModule.BaseModule {
69
68
  }
70
69
  });
71
70
  this.store.mainProducts = mainProducts;
72
- await this.core.effects.emit(import_types.BuyTicketsHooks.onMainProductsLoaded, {});
71
+ await this.core.effects.emit(`${this.name}:onMainProductsLoaded`, {});
73
72
  }
74
73
  // 通过 ids 获取产品,在当前解决方案下,获取到的就是其他商品
75
74
  async loadProductsByCategory(categoryId) {
76
75
  }
77
76
  async destroy() {
78
- await this.core.effects.emit(import_types.BuyTicketsHooks.onDestroy, {});
77
+ await this.core.effects.emit(`${this.name}:onDestroy`, {});
79
78
  console.log("[BuyTickets] 已销毁");
80
79
  }
81
80
  // 获取当前绑定的所有商品
@@ -83,7 +82,7 @@ var BuyTicketsImpl = class extends import_BaseModule.BaseModule {
83
82
  var _a;
84
83
  const mainData = await this.store.mainProducts.getProducts() || [];
85
84
  const otherData = await ((_a = this.store.otherProducts) == null ? void 0 : _a.getProducts()) || [];
86
- await this.core.effects.emit(import_types.BuyTicketsHooks.OnGetProducts, [
85
+ await this.core.effects.emit(`${this.name}:onGetProducts`, [
87
86
  ...mainData,
88
87
  ...otherData
89
88
  ]);
@@ -102,7 +101,7 @@ var BuyTicketsImpl = class extends import_BaseModule.BaseModule {
102
101
  }
103
102
  // 商品列表页提交
104
103
  async listSubmit(data) {
105
- const res = await this.core.effects.emit(import_types.BuyTicketsHooks.onListSubmit, {
104
+ const res = await this.core.effects.emit(`${this.name}:onListSubmit`, {
106
105
  ...data,
107
106
  products: this.getProducts()
108
107
  });
@@ -116,14 +115,14 @@ var BuyTicketsImpl = class extends import_BaseModule.BaseModule {
116
115
  }
117
116
  // 购物车提交
118
117
  async cartSubmit(data) {
119
- await this.core.effects.emit(import_types.BuyTicketsHooks.onCartSubmit, {
118
+ await this.core.effects.emit(`${this.name}:onCartSubmit`, {
120
119
  ...data,
121
120
  products: this.getProducts()
122
121
  });
123
122
  }
124
123
  // 结算提交
125
124
  async checkoutSubmit(data) {
126
- await this.core.effects.emit(import_types.BuyTicketsHooks.onCheckoutSubmit, {
125
+ await this.core.effects.emit(`${this.name}:onCheckoutSubmit`, {
127
126
  ...data,
128
127
  products: this.getProducts()
129
128
  });
@@ -81,7 +81,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
81
81
  await this.preloadPaymentMethods();
82
82
  await this.cleanupExpiredOrdersAsync();
83
83
  console.log("[Checkout] 初始化完成");
84
- await this.core.effects.emit(import_types.CheckoutHooks.OnCheckoutInitialized, {
84
+ await this.core.effects.emit(`${this.name}:onCheckoutInitialized`, {
85
85
  timestamp: Date.now()
86
86
  });
87
87
  this.logInfo("CheckoutModule initialized successfully");
@@ -265,7 +265,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
265
265
  this.logInfo("initWalletData currentOrder found", {
266
266
  currentOrder: this.store.currentOrder
267
267
  });
268
- await this.core.effects.emit(import_types.CheckoutHooks.OnWalletDataInitialized, {
268
+ await this.core.effects.emit(`${this.name}:onWalletDataInitialized`, {
269
269
  orderUuid: (_g = this.store.currentOrder) == null ? void 0 : _g.uuid,
270
270
  customerId: walletBusinessData.customer_id,
271
271
  walletBusinessData: {
@@ -397,7 +397,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
397
397
  }
398
398
  });
399
399
  this.store.currentOrder = paymentOrder;
400
- this.core.effects.emit(import_types.CheckoutHooks.OnOrderCreated, {
400
+ this.core.effects.emit(`${this.name}:onOrderCreated`, {
401
401
  order: paymentOrder,
402
402
  timestamp: Date.now()
403
403
  });
@@ -427,7 +427,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
427
427
  import_types.CheckoutErrorType.OrderCreationFailed
428
428
  );
429
429
  this.logError("本地订单创建失败:", error);
430
- this.core.effects.emit(import_types.CheckoutHooks.OnOrderCreationFailed, {
430
+ this.core.effects.emit(`${this.name}:onOrderCreationFailed`, {
431
431
  error: this.store.lastError,
432
432
  timestamp: Date.now()
433
433
  });
@@ -528,7 +528,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
528
528
  totalAmount: updated.total_amount,
529
529
  expectAmount: updated.expect_amount
530
530
  });
531
- await this.core.effects.emit(import_types.CheckoutHooks.OnOrderCreated, {
531
+ await this.core.effects.emit(`${this.name}:onOrderCreated`, {
532
532
  order: updated,
533
533
  timestamp: Date.now()
534
534
  });
@@ -594,7 +594,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
594
594
  );
595
595
  }
596
596
  this.payment.wallet.clearAllCache();
597
- await this.core.effects.emit(import_types.CheckoutHooks.OnCheckoutCompleted, {
597
+ await this.core.effects.emit(`${this.name}:onCheckoutCompleted`, {
598
598
  orderId: order.id,
599
599
  timestamp: Date.now()
600
600
  });
@@ -705,7 +705,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
705
705
  );
706
706
  if (updatedOrder) {
707
707
  this.store.currentOrder = updatedOrder;
708
- await this.core.effects.emit(import_types.CheckoutHooks.OnOrderCreated, {
708
+ await this.core.effects.emit(`${this.name}:onOrderCreated`, {
709
709
  order: updatedOrder,
710
710
  timestamp: Date.now()
711
711
  });
@@ -746,7 +746,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
746
746
  newAmount: formattedAmount
747
747
  });
748
748
  this.store.stateAmount = formattedAmount;
749
- await this.core.effects.emit(import_types.CheckoutHooks.OnStateAmountChanged, {
749
+ await this.core.effects.emit(`${this.name}:onStateAmountChanged`, {
750
750
  oldAmount,
751
751
  newAmount: formattedAmount,
752
752
  timestamp: Date.now()
@@ -898,7 +898,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
898
898
  }
899
899
  }
900
900
  }
901
- this.core.effects.emit(import_types.CheckoutHooks.OnPaymentItemAdded, {
901
+ this.core.effects.emit(`${this.name}:onPaymentItemAdded`, {
902
902
  orderUuid: this.store.currentOrder.uuid,
903
903
  paymentMethodCode: paymentItem.code,
904
904
  paymentMethodName: paymentItem.name,
@@ -975,7 +975,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
975
975
  this.store.currentOrder = updatedOrder;
976
976
  }
977
977
  await this.updateStateAmountToRemaining(false);
978
- await this.core.effects.emit(import_types.CheckoutHooks.OnPaymentStarted, {
978
+ await this.core.effects.emit(`${this.name}:onPaymentStarted`, {
979
979
  orderUuid: this.store.currentOrder.uuid,
980
980
  paymentMethodCode: paymentItem.code,
981
981
  amount: `-${paymentItem.amount}`,
@@ -1070,7 +1070,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1070
1070
  this.store.currentOrder = updatedOrder;
1071
1071
  }
1072
1072
  await this.updateStateAmountToRemaining(false);
1073
- await this.core.effects.emit(import_types.CheckoutHooks.OnPaymentStarted, {
1073
+ await this.core.effects.emit(`${this.name}:onPaymentStarted`, {
1074
1074
  orderUuid: this.store.currentOrder.uuid,
1075
1075
  paymentMethodCode: "VOUCHER_BATCH",
1076
1076
  amount: voucherPaymentItems.reduce((sum, item) => sum + parseFloat(String(item.amount)), 0).toFixed(2),
@@ -1132,7 +1132,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1132
1132
  }
1133
1133
  this.clearCalculationCache();
1134
1134
  this.updateStateAmountToRemaining(false);
1135
- await this.core.effects.emit(import_types.CheckoutHooks.OnOrderCreated, {
1135
+ await this.core.effects.emit(`${this.name}:onOrderCreated`, {
1136
1136
  order: this.store.currentOrder,
1137
1137
  timestamp: Date.now()
1138
1138
  });
@@ -1224,7 +1224,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1224
1224
  }
1225
1225
  this.clearCalculationCache();
1226
1226
  this.updateStateAmountToRemaining(false);
1227
- await this.core.effects.emit(import_types.CheckoutHooks.OnOrderCreated, {
1227
+ await this.core.effects.emit(`${this.name}:onOrderCreated`, {
1228
1228
  order: this.store.currentOrder,
1229
1229
  timestamp: Date.now()
1230
1230
  });
@@ -1411,7 +1411,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1411
1411
  this.store.currentCustomer = void 0;
1412
1412
  this.payment.wallet.clearAllCache();
1413
1413
  this.logInfo("订单状态清理完成,currentOrder已释放");
1414
- await this.core.effects.emit(import_types.CheckoutHooks.OnOrderCancelled, {
1414
+ await this.core.effects.emit(`${this.name}:onOrderCancelled`, {
1415
1415
  orderUuid: currentOrderUuid,
1416
1416
  orderId: currentOrderId,
1417
1417
  cancelReason,
@@ -1528,7 +1528,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1528
1528
  );
1529
1529
  }
1530
1530
  }
1531
- await this.core.effects.emit(import_types.CheckoutHooks.OnOrderNoteChanged, {
1531
+ await this.core.effects.emit(`${this.name}:onOrderNoteChanged`, {
1532
1532
  orderUuid: (_b = this.store.currentOrder) == null ? void 0 : _b.uuid,
1533
1533
  oldNote,
1534
1534
  newNote: note,
@@ -1553,7 +1553,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1553
1553
  async handleError(error, type) {
1554
1554
  const checkoutError = error instanceof Error && "type" in error ? error : (0, import_utils.createCheckoutError)(type, error.message, error);
1555
1555
  this.store.lastError = checkoutError;
1556
- await this.core.effects.emit(import_types.CheckoutHooks.OnError, {
1556
+ await this.core.effects.emit(`${this.name}:onError`, {
1557
1557
  error: checkoutError,
1558
1558
  context: {},
1559
1559
  timestamp: Date.now()
@@ -1566,7 +1566,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1566
1566
  async handlePaymentSuccess(data) {
1567
1567
  var _a;
1568
1568
  await this.updateStateAmountToRemaining();
1569
- await this.core.effects.emit(import_types.CheckoutHooks.OnPaymentSuccess, {
1569
+ await this.core.effects.emit(`${this.name}:onPaymentSuccess`, {
1570
1570
  orderUuid: data.orderUuid,
1571
1571
  paymentMethodCode: "",
1572
1572
  amount: ((_a = this.store.currentOrder) == null ? void 0 : _a.total_amount) || "0",
@@ -1587,7 +1587,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1587
1587
  error instanceof Error ? error : new Error(String(error)),
1588
1588
  import_types.CheckoutErrorType.PaymentFailed
1589
1589
  );
1590
- await this.core.effects.emit(import_types.CheckoutHooks.OnPaymentFailed, {
1590
+ await this.core.effects.emit(`${this.name}:onPaymentFailed`, {
1591
1591
  orderUuid: data.orderUuid,
1592
1592
  paymentMethodCode: "",
1593
1593
  amount: ((_a = this.store.currentOrder) == null ? void 0 : _a.total_amount) || "0",
@@ -1823,7 +1823,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1823
1823
  }
1824
1824
  /**
1825
1825
  * 计算已支付金额(从 Payment 模块获取最新数据)
1826
- *
1826
+ *
1827
1827
  * 注意:此方法保持独立性,可以单独调用。
1828
1828
  * 在 updateStateAmountToRemaining 等批量操作中会使用缓存优化。
1829
1829
  */
@@ -1875,7 +1875,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1875
1875
  }
1876
1876
  /**
1877
1877
  * 计算剩余未支付金额(从 Payment 模块获取最新数据)
1878
- *
1878
+ *
1879
1879
  * 注意:此方法保持独立性,可以单独调用。
1880
1880
  * 在 updateStateAmountToRemaining 等批量操作中会使用缓存优化。
1881
1881
  */
@@ -1895,7 +1895,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1895
1895
  }
1896
1896
  /**
1897
1897
  * 计算剩余未支付金额(排除定金计算,始终使用订单总金额)
1898
- *
1898
+ *
1899
1899
  * 注意:此方法保持独立性,可以单独调用。
1900
1900
  * 在 updateStateAmountToRemaining 等批量操作中会使用缓存优化。
1901
1901
  */
@@ -1923,7 +1923,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1923
1923
  const currentBalanceDueAmount = this.store.balanceDueAmount;
1924
1924
  if (remainingAmount !== currentBalanceDueAmount) {
1925
1925
  this.store.balanceDueAmount = remainingAmount;
1926
- await this.core.effects.emit(import_types.CheckoutHooks.OnBalanceDueAmountChanged, {
1926
+ await this.core.effects.emit(`${this.name}:onBalanceDueAmountChanged`, {
1927
1927
  oldAmount: currentBalanceDueAmount,
1928
1928
  newAmount: remainingAmount,
1929
1929
  timestamp: Date.now(),
@@ -1945,7 +1945,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1945
1945
  }
1946
1946
  /**
1947
1947
  * 更新 stateAmount 为当前剩余未支付金额
1948
- *
1948
+ *
1949
1949
  * 优化版本:批量获取数据,避免重复查询数据库
1950
1950
  */
1951
1951
  async updateStateAmountToRemaining(checkOrder = true) {
@@ -2047,7 +2047,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2047
2047
  }
2048
2048
  /**
2049
2049
  * 检查订单支付是否完成(优化版,复用已获取的数据)
2050
- *
2050
+ *
2051
2051
  * @param paymentItems 已获取的支付项数据
2052
2052
  * @param remainingAmount 已计算的剩余金额
2053
2053
  */
@@ -2117,7 +2117,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2117
2117
  * 检查订单支付是否完成
2118
2118
  *
2119
2119
  * 当剩余待付款金额 <= 0 时,触发订单支付完成事件
2120
- *
2120
+ *
2121
2121
  * 注意:此方法保持独立性,可以单独调用。
2122
2122
  * 在 updateStateAmountToRemaining 中会使用优化版本。
2123
2123
  */
@@ -2176,7 +2176,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2176
2176
  this.logInfo("所有支付项均为代金券类型,跳过订单同步");
2177
2177
  }
2178
2178
  }
2179
- await this.core.effects.emit(import_types.CheckoutHooks.OnOrderPaymentCompleted, {
2179
+ await this.core.effects.emit(`${this.name}:onOrderPaymentCompleted`, {
2180
2180
  orderUuid: this.store.currentOrder.uuid,
2181
2181
  orderId: this.store.currentOrder.order_id,
2182
2182
  totalAmount,
@@ -2325,7 +2325,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2325
2325
  }
2326
2326
  }
2327
2327
  const startTime = Date.now();
2328
- await this.core.effects.emit(import_types.CheckoutHooks.OnOrderSubmitStart, {
2328
+ await this.core.effects.emit(`${this.name}:onOrderSubmitStart`, {
2329
2329
  orderUuid: this.store.currentOrder.uuid,
2330
2330
  operation: isUpdateOperation ? "update" : "create",
2331
2331
  isManual,
@@ -2348,7 +2348,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2348
2348
  submitSuccess = false;
2349
2349
  submitError = error instanceof Error ? error.message : String(error);
2350
2350
  this.logError("下单接口调用失败:", submitError);
2351
- await this.core.effects.emit(import_types.CheckoutHooks.OnOrderSyncFailed, {
2351
+ await this.core.effects.emit(`${this.name}:onOrderSyncFailed`, {
2352
2352
  orderUuid: this.store.currentOrder.uuid,
2353
2353
  operation: isUpdateOperation ? "update" : "create",
2354
2354
  isManual,
@@ -2359,7 +2359,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2359
2359
  });
2360
2360
  throw error;
2361
2361
  } finally {
2362
- await this.core.effects.emit(import_types.CheckoutHooks.OnOrderSubmitEnd, {
2362
+ await this.core.effects.emit(`${this.name}:onOrderSubmitEnd`, {
2363
2363
  success: submitSuccess,
2364
2364
  orderUuid: this.store.currentOrder.uuid,
2365
2365
  operation: isUpdateOperation ? "update" : "create",
@@ -2374,7 +2374,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2374
2374
  const isSuccessResponse = responseStatus === true || responseStatus === 200 || responseStatus === "success" || responseStatus === 1 && (checkoutResponse == null ? void 0 : checkoutResponse.code) === 200;
2375
2375
  if (!isSuccessResponse) {
2376
2376
  const errorMessage = (checkoutResponse == null ? void 0 : checkoutResponse.message) || "订单同步失败,后端返回非成功状态";
2377
- await this.core.effects.emit(import_types.CheckoutHooks.OnOrderSyncFailed, {
2377
+ await this.core.effects.emit(`${this.name}:onOrderSyncFailed`, {
2378
2378
  orderUuid: this.store.currentOrder.uuid,
2379
2379
  operation: isUpdateOperation ? "update" : "create",
2380
2380
  isManual,
@@ -2459,7 +2459,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2459
2459
  }
2460
2460
  this.store.isOrderSynced = true;
2461
2461
  this.clearCalculationCache();
2462
- await this.core.effects.emit(import_types.CheckoutHooks.OnOrderSynced, {
2462
+ await this.core.effects.emit(`${this.name}:onOrderSynced`, {
2463
2463
  orderUuid: this.store.currentOrder.uuid,
2464
2464
  realOrderId,
2465
2465
  virtualOrderId: this.store.currentOrder.order_id,
@@ -2526,7 +2526,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2526
2526
  if (this.store.localOrderData) {
2527
2527
  this.store.localOrderData.shop_note = note;
2528
2528
  }
2529
- await this.core.effects.emit(import_types.CheckoutHooks.OnOrderNoteChanged, {
2529
+ await this.core.effects.emit(`${this.name}:onOrderNoteChanged`, {
2530
2530
  orderUuid: this.store.currentOrder.uuid,
2531
2531
  oldNote: previousNote,
2532
2532
  newNote: note,
@@ -2674,7 +2674,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2674
2674
  * 重置 store 状态
2675
2675
  *
2676
2676
  * 在创建新订单前调用,确保状态完全干净
2677
- *
2677
+ *
2678
2678
  * 🚀 性能优化:改为同步方法,事件发射不阻塞主流程
2679
2679
  */
2680
2680
  resetStoreState() {
@@ -2698,7 +2698,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
2698
2698
  console.log("[Checkout] Store 状态重置完成");
2699
2699
  if (prevOrderInfo) {
2700
2700
  setTimeout(() => {
2701
- this.core.effects.emit(import_types.CheckoutHooks.OnOrderCleared, {
2701
+ this.core.effects.emit(`${this.name}:onOrderCleared`, {
2702
2702
  previousOrder: prevOrderInfo,
2703
2703
  timestamp: Date.now()
2704
2704
  });
@@ -0,0 +1,87 @@
1
+ /**
2
+ * 注册登录解决方案配置
3
+ * 根据不同渠道配置不同的接口地址和参数
4
+ */
5
+ /**
6
+ * API 配置接口
7
+ */
8
+ export interface ApiConfig {
9
+ url: string;
10
+ method: 'GET' | 'POST' | 'PUT' | 'DELETE';
11
+ transformParams?: (params: any) => any;
12
+ transformResponse?: (response: any) => any;
13
+ options?: Record<string, any>;
14
+ }
15
+ /**
16
+ * 渠道配置接口
17
+ */
18
+ export interface ChannelConfig {
19
+ sendEmailVerificationCode: ApiConfig;
20
+ sendEmailLoginCode: ApiConfig;
21
+ sendSmsRegisterCode: ApiConfig;
22
+ sendEmailRegisterLink: ApiConfig;
23
+ verifyEmailRegistrationLink: ApiConfig;
24
+ emailPasswordLogin: ApiConfig;
25
+ emailCodeRegister: ApiConfig;
26
+ phoneCodeRegister: ApiConfig;
27
+ resendEmailRegisterLink: ApiConfig;
28
+ checkEmailLinkCode: ApiConfig;
29
+ sendSmsLoginCode: ApiConfig;
30
+ phoneCodeLogin: ApiConfig;
31
+ guestLogin: ApiConfig;
32
+ checkEmailExists: ApiConfig;
33
+ checkEmailCode: ApiConfig;
34
+ checkMobileCode: ApiConfig;
35
+ phonePasswordLogin: ApiConfig;
36
+ sendPasswordResetEmail: ApiConfig;
37
+ sendPasswordResetSms: ApiConfig;
38
+ sendResetPasswordLink: ApiConfig;
39
+ checkResetPasswordCode: ApiConfig;
40
+ resetPasswordByCode: ApiConfig;
41
+ resetPasswordByEmail: ApiConfig;
42
+ resetPasswordByPhone: ApiConfig;
43
+ verifyCode: ApiConfig;
44
+ register: ApiConfig;
45
+ login: ApiConfig;
46
+ oauthLogin: ApiConfig;
47
+ validateToken: ApiConfig;
48
+ logout: ApiConfig;
49
+ getCountries: ApiConfig;
50
+ facebookLogin: ApiConfig;
51
+ appleLogin: ApiConfig;
52
+ }
53
+ /**
54
+ * 渠道配置映射
55
+ */
56
+ export declare const channelConfigMap: Record<string, ChannelConfig>;
57
+ /**
58
+ * 获取渠道配置
59
+ */
60
+ export declare function getChannelConfig(channel: string): ChannelConfig;
61
+ /**
62
+ * API 调用器类
63
+ * 负责根据配置执行 API 调用
64
+ */
65
+ export declare class ApiCaller {
66
+ private request;
67
+ private config;
68
+ constructor(request: {
69
+ get: <T = any>(url: string, data?: any, options?: any) => Promise<T>;
70
+ post: <T = any>(url: string, data?: any, options?: any) => Promise<T>;
71
+ put: <T = any>(url: string, data?: any, options?: any) => Promise<T>;
72
+ delete: <T = any>(url: string, options?: any) => Promise<T>;
73
+ }, config: ChannelConfig);
74
+ /**
75
+ * 执行 API 调用
76
+ */
77
+ call<T = any>(apiName: keyof ChannelConfig, params?: any, additionalOptions?: any): Promise<T>;
78
+ }
79
+ /**
80
+ * 创建 API 调用器
81
+ */
82
+ export declare function createApiCaller(request: {
83
+ get: <T = any>(url: string, data?: any, options?: any) => Promise<T>;
84
+ post: <T = any>(url: string, data?: any, options?: any) => Promise<T>;
85
+ put: <T = any>(url: string, data?: any, options?: any) => Promise<T>;
86
+ delete: <T = any>(url: string, options?: any) => Promise<T>;
87
+ }, channel: string): ApiCaller;