@pisell/pisellos 0.0.234 → 0.0.236

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 (33) hide show
  1. package/dist/modules/Order/index.d.ts +1 -1
  2. package/dist/modules/Payment/index.d.ts +3 -3
  3. package/dist/modules/Payment/index.js +74 -10
  4. package/dist/modules/Payment/types.d.ts +24 -3
  5. package/dist/modules/Payment/types.js +9 -1
  6. package/dist/modules/Payment/utils.js +1 -1
  7. package/dist/modules/Payment/walletpass.d.ts +5 -2
  8. package/dist/modules/Payment/walletpass.js +63 -11
  9. package/dist/solution/BookingTicket/index.d.ts +8 -0
  10. package/dist/solution/BookingTicket/index.js +27 -3
  11. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +6 -0
  12. package/dist/solution/BookingTicket/utils/scan/handleScan.js +43 -28
  13. package/dist/solution/Checkout/index.d.ts +73 -8
  14. package/dist/solution/Checkout/index.js +1540 -926
  15. package/dist/solution/Checkout/types.d.ts +79 -3
  16. package/dist/solution/Checkout/types.js +6 -0
  17. package/lib/modules/Order/index.d.ts +1 -1
  18. package/lib/modules/Payment/index.d.ts +3 -3
  19. package/lib/modules/Payment/index.js +30 -5
  20. package/lib/modules/Payment/types.d.ts +24 -3
  21. package/lib/modules/Payment/types.js +1 -1
  22. package/lib/modules/Payment/utils.js +1 -1
  23. package/lib/modules/Payment/walletpass.d.ts +5 -2
  24. package/lib/modules/Payment/walletpass.js +30 -2
  25. package/lib/solution/BookingTicket/index.d.ts +8 -0
  26. package/lib/solution/BookingTicket/index.js +23 -2
  27. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +6 -0
  28. package/lib/solution/BookingTicket/utils/scan/handleScan.js +21 -14
  29. package/lib/solution/Checkout/index.d.ts +73 -8
  30. package/lib/solution/Checkout/index.js +582 -200
  31. package/lib/solution/Checkout/types.d.ts +79 -3
  32. package/lib/solution/Checkout/types.js +2 -0
  33. package/package.json +1 -1
@@ -389,7 +389,11 @@ export declare enum CheckoutHooks {
389
389
  /** 订单备注变更 */
390
390
  OnOrderNoteChanged = "checkout:onOrderNoteChanged",
391
391
  /** 商店折扣变更 */
392
- OnShopDiscountChanged = "checkout:onShopDiscountChanged"
392
+ OnShopDiscountChanged = "checkout:onShopDiscountChanged",
393
+ /** 订单取消 */
394
+ OnOrderCancelled = "checkout:onOrderCancelled",
395
+ /** 订单状态已清理 */
396
+ OnOrderCleared = "checkout:onOrderCleared"
393
397
  }
394
398
  /**
395
399
  * 结账状态数据
@@ -610,11 +614,12 @@ export interface CheckoutModuleAPI extends Module {
610
614
  orderUuid?: string;
611
615
  }>;
612
616
  /**
613
- * 检查订单是否需要手动同步
617
+ * 检查订单是否需要手动同步(异步版本)
614
618
  *
615
619
  * 返回订单是否为纯代金券支付且待付金额<=0但未同步的状态
620
+ * 从 Payment 模块获取最新的支付项数据
616
621
  */
617
- needsManualSync(): boolean;
622
+ needsManualSyncAsync(): Promise<boolean>;
618
623
  /**
619
624
  * 更新订单备注
620
625
  *
@@ -633,6 +638,25 @@ export interface CheckoutModuleAPI extends Module {
633
638
  * @returns 当前订单的ID,如果没有订单则返回null
634
639
  */
635
640
  getCurrentOrderId(): string | null;
641
+ /**
642
+ * 获取当前订单是否已同步到后端
643
+ *
644
+ * @returns 当前订单是否已同步状态,如果没有订单则返回false
645
+ */
646
+ isCurrentOrderSynced(): boolean;
647
+ /**
648
+ * 取消当前本地订单
649
+ *
650
+ * 只能取消未同步到后端的本地订单,如果订单已同步则不能取消
651
+ *
652
+ * @param cancelReason 取消原因(可选)
653
+ * @returns 取消结果
654
+ */
655
+ cancelCurrentOrderAsync(cancelReason?: string): Promise<{
656
+ success: boolean;
657
+ message?: string;
658
+ orderId?: string;
659
+ }>;
636
660
  /**
637
661
  * 更新订单商店折扣
638
662
  *
@@ -675,6 +699,42 @@ export interface CheckoutModuleAPI extends Module {
675
699
  message?: string;
676
700
  orderId?: string | number;
677
701
  }>;
702
+ /**
703
+ * 发送客户支付链接邮件
704
+ *
705
+ * 向指定邮箱发送订单支付提醒邮件
706
+ *
707
+ * @param params 发送参数
708
+ * @returns 发送结果
709
+ */
710
+ sendCustomerPayLinkAsync(params: SendCustomerPayLinkParams): Promise<{
711
+ success: boolean;
712
+ message?: string;
713
+ }>;
714
+ /**
715
+ * 金额舍入
716
+ *
717
+ * 根据系统配置的舍入设置对金额进行舍入处理
718
+ *
719
+ * @param amount 原始金额
720
+ * @returns 舍入结果详情,包含原始金额、舍入后金额和舍入差额
721
+ */
722
+ roundAmountAsync(amount: number): Promise<{
723
+ originalAmount: string;
724
+ roundedAmount: string;
725
+ roundingDifference: string;
726
+ }>;
727
+ }
728
+ /**
729
+ * 发送客户支付链接参数
730
+ */
731
+ export interface SendCustomerPayLinkParams {
732
+ /** 订单ID列表 */
733
+ order_ids: string[];
734
+ /** 通知动作,固定为订单支付提醒 */
735
+ notify_action?: string;
736
+ /** 邮箱地址列表 */
737
+ emails: string[];
678
738
  }
679
739
  /**
680
740
  * 结账事件数据类型
@@ -748,4 +808,20 @@ export interface CheckoutEventData {
748
808
  newDiscount: number;
749
809
  timestamp: number;
750
810
  };
811
+ /** 订单取消事件 */
812
+ orderCancelled: {
813
+ orderUuid?: string;
814
+ orderId?: string;
815
+ cancelReason?: string;
816
+ wasSynced: boolean;
817
+ timestamp: number;
818
+ };
819
+ /** 订单状态清理事件 */
820
+ orderCleared: {
821
+ previousOrder?: {
822
+ uuid: string;
823
+ orderId: string;
824
+ } | null;
825
+ timestamp: number;
826
+ };
751
827
  }
@@ -69,6 +69,8 @@ var CheckoutHooks = /* @__PURE__ */ ((CheckoutHooks2) => {
69
69
  CheckoutHooks2["OnOrderSynced"] = "checkout:onOrderSynced";
70
70
  CheckoutHooks2["OnOrderNoteChanged"] = "checkout:onOrderNoteChanged";
71
71
  CheckoutHooks2["OnShopDiscountChanged"] = "checkout:onShopDiscountChanged";
72
+ CheckoutHooks2["OnOrderCancelled"] = "checkout:onOrderCancelled";
73
+ CheckoutHooks2["OnOrderCleared"] = "checkout:onOrderCleared";
72
74
  return CheckoutHooks2;
73
75
  })(CheckoutHooks || {});
74
76
  // Annotate the CommonJS export names for ESM import in node:
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "0.0.234",
4
+ "version": "0.0.236",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",