@pisell/pisellos 2.2.328 → 2.2.329

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.
@@ -342,7 +342,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
342
342
  date: string;
343
343
  status: string;
344
344
  week: string;
345
- weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
345
+ weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
346
346
  }[]>;
347
347
  submitTimeSlot(timeSlots: TimeSliceItem): void;
348
348
  private getScheduleDataByIds;
@@ -389,7 +389,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
389
389
  };
390
390
  setOtherData(key: string, value: any): void;
391
391
  getOtherData(key: string): any;
392
- getProductTypeById(id: number): Promise<"duration" | "normal" | "session">;
392
+ getProductTypeById(id: number): Promise<"normal" | "duration" | "session">;
393
393
  /**
394
394
  * 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
395
395
  *
@@ -640,7 +640,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
640
640
  generateIdempotencyToken(): string;
641
641
  syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
642
642
  createOrder(params: CommitOrderParams['query']): {
643
- type: "appointment_booking" | "virtual";
643
+ type: "virtual" | "appointment_booking";
644
644
  platform: string;
645
645
  sales_channel: string;
646
646
  order_sales_channel: string;
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
49
49
  getCategories(): ProductCategory[];
50
50
  setOtherParams(key: string, value: any): void;
51
51
  getOtherParams(): any;
52
- getProductType(): "duration" | "normal" | "session";
52
+ getProductType(): "normal" | "duration" | "session";
53
53
  }
@@ -1724,6 +1724,34 @@ class OrderModule extends _BaseModule.BaseModule {
1724
1724
  * 将增量订单合并到 store
1725
1725
  */
1726
1726
  async mergeOrdersToStore(freshOrders, source) {
1727
+ if (this.isRemoteEchoMergeSource(source)) {
1728
+ const cancelledOrders = freshOrders.filter(order => order?.status === 'cancelled' && order.order_id != null);
1729
+ if (cancelledOrders.length) {
1730
+ const ids = new Set(cancelledOrders.map(order => this.getIdKey(order.order_id)));
1731
+ const cloudOrders = cancelledOrders.map(order => this.normalizeRemoteSyncedOrder(order));
1732
+ await this.runInOrderSQLiteSaveQueue(async () => {
1733
+ if (this.dbManager) {
1734
+ const stored = await this.dbManager.getAll(INDEXDB_STORE_NAME);
1735
+ const keys = new Set((stored || []).filter(order => order.order_id != null && ids.has(this.getIdKey(order.order_id))).map(order => this.getPersistedOrderStorageKey(order)).filter(Boolean));
1736
+ for (const key of keys) {
1737
+ await this.dbManager.delete(INDEXDB_STORE_NAME, key);
1738
+ this.recentSqliteWriteByStorageKey.delete(key);
1739
+ }
1740
+ await this.writeOrderRowsToSQLite(cloudOrders);
1741
+ this.recordRecentSqliteWrite(source, cloudOrders);
1742
+ }
1743
+ this.store.list = this.store.list.filter(order => order.order_id == null || !ids.has(this.getIdKey(order.order_id))).concat(cloudOrders);
1744
+ this.syncOrdersMap();
1745
+ });
1746
+ this.logInfo('取消订单已清理本地副本并采用云端数据', {
1747
+ source,
1748
+ order_ids: [...ids]
1749
+ });
1750
+ await this.emitOrdersChanged(cloudOrders, source);
1751
+ freshOrders = freshOrders.filter(order => order.order_id == null || !ids.has(this.getIdKey(order.order_id)));
1752
+ }
1753
+ }
1754
+ if (!freshOrders.length) return;
1727
1755
  const storeOrderCountBefore = this.store.list.length;
1728
1756
  this.logInfo('mergeOrdersToStore-开始', {
1729
1757
  freshOrderCount: freshOrders.length,
@@ -342,7 +342,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
342
342
  date: string;
343
343
  status: string;
344
344
  week: string;
345
- weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
345
+ weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
346
346
  }[]>;
347
347
  submitTimeSlot(timeSlots: TimeSliceItem): void;
348
348
  private getScheduleDataByIds;
@@ -389,7 +389,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
389
389
  };
390
390
  setOtherData(key: string, value: any): void;
391
391
  getOtherData(key: string): any;
392
- getProductTypeById(id: number): Promise<"duration" | "normal" | "session">;
392
+ getProductTypeById(id: number): Promise<"normal" | "duration" | "session">;
393
393
  /**
394
394
  * 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
395
395
  *
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.2.328",
4
+ "version": "2.2.329",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",