@pisell/pisellos 3.0.5 → 3.0.7

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 (148) hide show
  1. package/dist/modules/Account/index.d.ts +2 -6
  2. package/dist/modules/Account/index.js +21 -103
  3. package/dist/modules/Account/types.d.ts +12 -1
  4. package/dist/modules/AccountList/index.d.ts +20 -1
  5. package/dist/modules/AccountList/index.js +243 -75
  6. package/dist/modules/AccountList/types.d.ts +33 -1
  7. package/dist/modules/AccountList/types.js +8 -0
  8. package/dist/modules/AccountList/utils.d.ts +9 -0
  9. package/dist/modules/AccountList/utils.js +25 -0
  10. package/dist/modules/BaseModule.d.ts +2 -2
  11. package/dist/modules/BaseModule.js +1 -1
  12. package/dist/modules/Cart/index.d.ts +8 -5
  13. package/dist/modules/Cart/index.js +101 -25
  14. package/dist/modules/Cart/types.d.ts +82 -5
  15. package/dist/modules/Cart/types.js +22 -0
  16. package/dist/modules/Cart/utils.d.ts +106 -13
  17. package/dist/modules/Cart/utils.js +289 -76
  18. package/dist/modules/Date/index.d.ts +6 -6
  19. package/dist/modules/Date/index.js +41 -58
  20. package/dist/modules/Date/types.d.ts +22 -6
  21. package/dist/modules/Date/utils.d.ts +4 -3
  22. package/dist/modules/Date/utils.js +81 -30
  23. package/dist/modules/Discount/index.d.ts +4 -4
  24. package/dist/modules/Discount/index.js +11 -11
  25. package/dist/modules/Order/index.d.ts +11 -5
  26. package/dist/modules/Order/index.js +47 -18
  27. package/dist/modules/Order/types.d.ts +10 -3
  28. package/dist/modules/Order/utils.d.ts +10 -0
  29. package/dist/modules/Order/utils.js +15 -0
  30. package/dist/modules/Product/index.d.ts +14 -1
  31. package/dist/modules/Product/index.js +35 -0
  32. package/dist/modules/Product/types.d.ts +27 -3
  33. package/dist/modules/ProductList/index.js +11 -5
  34. package/dist/modules/Resource/types.d.ts +1 -0
  35. package/dist/modules/Resource/utils.js +1 -1
  36. package/dist/modules/Rules/index.d.ts +3 -3
  37. package/dist/modules/Rules/index.js +97 -29
  38. package/dist/modules/Rules/types.d.ts +5 -1
  39. package/dist/modules/Schedule/index.d.ts +18 -0
  40. package/dist/modules/Schedule/index.js +111 -0
  41. package/dist/modules/Schedule/type.d.ts +157 -0
  42. package/dist/modules/Schedule/type.js +1 -0
  43. package/dist/modules/Schedule/types.d.ts +182 -0
  44. package/dist/modules/Schedule/types.js +1 -0
  45. package/dist/modules/Schedule/utils.d.ts +67 -0
  46. package/dist/modules/Schedule/utils.js +729 -0
  47. package/dist/modules/Step/index.d.ts +14 -3
  48. package/dist/modules/Step/index.js +54 -2
  49. package/dist/modules/Summary/index.d.ts +12 -5
  50. package/dist/modules/Summary/index.js +33 -7
  51. package/dist/modules/Summary/types.d.ts +23 -2
  52. package/dist/modules/Summary/utils.d.ts +14 -4
  53. package/dist/modules/Summary/utils.js +46 -4
  54. package/dist/modules/index.d.ts +10 -0
  55. package/dist/modules/index.js +11 -1
  56. package/dist/plugins/index.d.ts +3 -3
  57. package/dist/plugins/request.d.ts +3 -3
  58. package/dist/plugins/request.js +30 -30
  59. package/dist/plugins/shopStore.d.ts +1 -1
  60. package/dist/solution/BookingByStep/index.d.ts +97 -24
  61. package/dist/solution/BookingByStep/index.js +1024 -322
  62. package/dist/solution/BookingByStep/types.d.ts +3 -10
  63. package/dist/solution/BookingByStep/types.js +11 -15
  64. package/dist/solution/BookingByStep/utils/products.d.ts +1 -1
  65. package/dist/solution/BookingByStep/utils/products.js +3 -0
  66. package/dist/solution/BookingByStep/utils/resources.d.ts +60 -6
  67. package/dist/solution/BookingByStep/utils/resources.js +293 -52
  68. package/dist/solution/ShopDiscount/index.d.ts +4 -4
  69. package/dist/solution/ShopDiscount/index.js +29 -24
  70. package/dist/solution/ShopDiscount/types.d.ts +3 -2
  71. package/dist/solution/ShopDiscount/types.js +1 -0
  72. package/dist/solution/ShopDiscount/utils.js +1 -1
  73. package/lib/core/index.js +7 -2
  74. package/lib/modules/Account/index.d.ts +2 -6
  75. package/lib/modules/Account/index.js +15 -30
  76. package/lib/modules/Account/types.d.ts +12 -1
  77. package/lib/modules/AccountList/index.d.ts +20 -1
  78. package/lib/modules/AccountList/index.js +122 -13
  79. package/lib/modules/AccountList/types.d.ts +33 -1
  80. package/lib/modules/AccountList/utils.d.ts +9 -0
  81. package/lib/modules/AccountList/utils.js +39 -0
  82. package/lib/modules/BaseModule.d.ts +2 -2
  83. package/lib/modules/BaseModule.js +14 -3
  84. package/lib/modules/Cart/index.d.ts +8 -5
  85. package/lib/modules/Cart/index.js +81 -8
  86. package/lib/modules/Cart/types.d.ts +82 -5
  87. package/lib/modules/Cart/types.js +20 -2
  88. package/lib/modules/Cart/utils.d.ts +106 -13
  89. package/lib/modules/Cart/utils.js +188 -45
  90. package/lib/modules/Date/index.d.ts +6 -6
  91. package/lib/modules/Date/index.js +13 -28
  92. package/lib/modules/Date/types.d.ts +22 -6
  93. package/lib/modules/Date/utils.d.ts +4 -3
  94. package/lib/modules/Date/utils.js +47 -13
  95. package/lib/modules/Discount/index.d.ts +4 -4
  96. package/lib/modules/Discount/index.js +9 -2
  97. package/lib/modules/Guests/index.js +4 -1
  98. package/lib/modules/Order/index.d.ts +11 -5
  99. package/lib/modules/Order/index.js +24 -3
  100. package/lib/modules/Order/types.d.ts +10 -3
  101. package/lib/modules/Order/utils.d.ts +10 -0
  102. package/lib/modules/Order/utils.js +45 -0
  103. package/lib/modules/Payment/index.js +1 -6
  104. package/lib/modules/Product/index.d.ts +14 -1
  105. package/lib/modules/Product/index.js +19 -0
  106. package/lib/modules/Product/types.d.ts +27 -3
  107. package/lib/modules/ProductList/index.js +21 -7
  108. package/lib/modules/Resource/index.js +4 -1
  109. package/lib/modules/Resource/types.d.ts +1 -0
  110. package/lib/modules/Resource/utils.js +7 -4
  111. package/lib/modules/Rules/index.d.ts +3 -3
  112. package/lib/modules/Rules/index.js +100 -25
  113. package/lib/modules/Rules/types.d.ts +5 -1
  114. package/lib/modules/Schedule/index.d.ts +18 -0
  115. package/lib/modules/Schedule/index.js +81 -0
  116. package/lib/modules/Schedule/type.d.ts +157 -0
  117. package/lib/modules/Schedule/type.js +17 -0
  118. package/lib/modules/Schedule/types.d.ts +182 -0
  119. package/lib/modules/Schedule/types.js +17 -0
  120. package/lib/modules/Schedule/utils.d.ts +67 -0
  121. package/lib/modules/Schedule/utils.js +600 -0
  122. package/lib/modules/Step/index.d.ts +14 -3
  123. package/lib/modules/Step/index.js +38 -1
  124. package/lib/modules/Summary/index.d.ts +12 -5
  125. package/lib/modules/Summary/index.js +15 -1
  126. package/lib/modules/Summary/types.d.ts +23 -2
  127. package/lib/modules/Summary/utils.d.ts +14 -4
  128. package/lib/modules/Summary/utils.js +30 -1
  129. package/lib/modules/index.d.ts +10 -0
  130. package/lib/modules/index.js +21 -1
  131. package/lib/plugins/index.d.ts +3 -3
  132. package/lib/plugins/request.d.ts +3 -3
  133. package/lib/plugins/request.js +48 -11
  134. package/lib/plugins/shopStore.d.ts +1 -1
  135. package/lib/solution/BookingByStep/index.d.ts +97 -24
  136. package/lib/solution/BookingByStep/index.js +693 -145
  137. package/lib/solution/BookingByStep/types.d.ts +3 -10
  138. package/lib/solution/BookingByStep/types.js +37 -14
  139. package/lib/solution/BookingByStep/utils/products.d.ts +1 -1
  140. package/lib/solution/BookingByStep/utils/products.js +3 -0
  141. package/lib/solution/BookingByStep/utils/resources.d.ts +60 -6
  142. package/lib/solution/BookingByStep/utils/resources.js +286 -54
  143. package/lib/solution/BuyTickets/index.js +34 -20
  144. package/lib/solution/ShopDiscount/index.d.ts +4 -4
  145. package/lib/solution/ShopDiscount/index.js +14 -2
  146. package/lib/solution/ShopDiscount/types.d.ts +3 -2
  147. package/lib/solution/ShopDiscount/types.js +1 -0
  148. package/package.json +4 -2
@@ -53,22 +53,21 @@ var BuyTicketsImpl = class extends import_BaseModule.BaseModule {
53
53
  }
54
54
  // 通过 ids 获取产品,在当前解决方案下,获取到的就是主商品
55
55
  async loadProductsByIds(ids) {
56
- const productsData = await this.request.post(
57
- "/product/query",
58
- {
59
- ids,
60
- open_quotation: 1,
61
- open_bundle: 1,
62
- with: ["bundleGroup.bundleItem"],
63
- status: "published",
64
- num: 10,
65
- skip: 1
66
- }
67
- );
56
+ const productsData = await this.request.post("/product/query", {
57
+ ids,
58
+ open_quotation: 1,
59
+ open_bundle: 1,
60
+ with: ["bundleGroup.bundleItem"],
61
+ status: "published",
62
+ num: 10,
63
+ skip: 1
64
+ });
68
65
  const mainProducts = new import_modules.ProductList(`product-kiosk-main-list`);
69
- this.core.registerModule(mainProducts, { initialState: {
70
- list: productsData.data.list
71
- } });
66
+ this.core.registerModule(mainProducts, {
67
+ initialState: {
68
+ list: productsData.data.list
69
+ }
70
+ });
72
71
  this.store.mainProducts = mainProducts;
73
72
  await this.core.effects.emit(import_types.BuyTicketsHooks.onMainProductsLoaded, {});
74
73
  }
@@ -84,7 +83,10 @@ var BuyTicketsImpl = class extends import_BaseModule.BaseModule {
84
83
  var _a;
85
84
  const mainData = await this.store.mainProducts.getProducts() || [];
86
85
  const otherData = await ((_a = this.store.otherProducts) == null ? void 0 : _a.getProducts()) || [];
87
- await this.core.effects.emit(import_types.BuyTicketsHooks.OnGetProducts, [...mainData, ...otherData]);
86
+ await this.core.effects.emit(import_types.BuyTicketsHooks.OnGetProducts, [
87
+ ...mainData,
88
+ ...otherData
89
+ ]);
88
90
  return [...mainData, ...otherData];
89
91
  }
90
92
  // 根据 id 获取商品详情,他会尝试先去主列表里找,找不到再去子列表,还找不到就报错
@@ -100,19 +102,31 @@ var BuyTicketsImpl = class extends import_BaseModule.BaseModule {
100
102
  }
101
103
  // 商品列表页提交
102
104
  async listSubmit(data) {
103
- const res = await this.core.effects.emit(import_types.BuyTicketsHooks.onListSubmit, { ...data, products: this.getProducts() });
105
+ const res = await this.core.effects.emit(import_types.BuyTicketsHooks.onListSubmit, {
106
+ ...data,
107
+ products: this.getProducts()
108
+ });
104
109
  if (res.status === false)
105
110
  return res;
106
- this.window.localStorage.setItem("buyTickets:listSubmit", JSON.stringify({ ...data, products: this.getProducts() }));
111
+ this.window.localStorage.setItem(
112
+ "buyTickets:listSubmit",
113
+ JSON.stringify({ ...data, products: this.getProducts() })
114
+ );
107
115
  console.log("listSubmit 应该走逻辑层的 API 发请求了");
108
116
  }
109
117
  // 购物车提交
110
118
  async cartSubmit(data) {
111
- await this.core.effects.emit(import_types.BuyTicketsHooks.onCartSubmit, { ...data, products: this.getProducts() });
119
+ await this.core.effects.emit(import_types.BuyTicketsHooks.onCartSubmit, {
120
+ ...data,
121
+ products: this.getProducts()
122
+ });
112
123
  }
113
124
  // 结算提交
114
125
  async checkoutSubmit(data) {
115
- await this.core.effects.emit(import_types.BuyTicketsHooks.onCheckoutSubmit, { ...data, products: this.getProducts() });
126
+ await this.core.effects.emit(import_types.BuyTicketsHooks.onCheckoutSubmit, {
127
+ ...data,
128
+ products: this.getProducts()
129
+ });
116
130
  }
117
131
  };
118
132
  // Annotate the CommonJS export names for ESM import in node:
@@ -1,7 +1,7 @@
1
- import { Module, PisellCore } from "../../types";
2
- import { BaseModule } from "../../modules/BaseModule";
3
- import { Customer } from "./types";
4
- import { Discount } from "../../modules/Discount/types";
1
+ import { Module, PisellCore } from '../../types';
2
+ import { BaseModule } from '../../modules/BaseModule';
3
+ import { Customer } from './types';
4
+ import { Discount } from '../../modules/Discount/types';
5
5
  export declare class ShopDiscountImpl extends BaseModule implements Module {
6
6
  protected defaultName: string;
7
7
  protected defaultVersion: string;
@@ -288,7 +288,13 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
288
288
  });
289
289
  }
290
290
  });
291
- const newDiscountList = (0, import_utils.uniqueById)([...editModeDiscountList, ...discountList.filter((item) => !item.isDisabled)], "product_id");
291
+ const newDiscountList = (0, import_utils.uniqueById)(
292
+ [
293
+ ...editModeDiscountList,
294
+ ...discountList.filter((item) => !item.isDisabled)
295
+ ],
296
+ "product_id"
297
+ );
292
298
  (_a = this.store.discount) == null ? void 0 : _a.setDiscountList(newDiscountList);
293
299
  this.emitDiscountListChange(newDiscountList);
294
300
  return newDiscountList;
@@ -307,6 +313,10 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
307
313
  if (result == null ? void 0 : result.data) {
308
314
  const { wallet_pass_list, ...customer } = result.data;
309
315
  this.setCustomer(customer);
316
+ await this.core.effects.emit(
317
+ import_types.ShopDiscountHooks.onScanCustomerChange,
318
+ customer
319
+ );
310
320
  }
311
321
  } catch (error) {
312
322
  console.error("[ShopDiscount] 获取客户钱包信息出错:", error);
@@ -322,7 +332,9 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
322
332
  action: "create",
323
333
  with_good_pass: 1
324
334
  }));
325
- const scanDiscount = (_c = this.getDiscountList()) == null ? void 0 : _c.filter((item) => item.isScan);
335
+ const scanDiscount = (_c = this.getDiscountList()) == null ? void 0 : _c.filter(
336
+ (item) => item.isScan
337
+ );
326
338
  const newDiscountList = [...scanDiscount, ...goodPassList || []];
327
339
  this.setDiscountList(newDiscountList || []);
328
340
  if ((_d = this.store.productList) == null ? void 0 : _d.length) {
@@ -1,10 +1,11 @@
1
- import { DiscountModule } from "../../modules/Discount";
2
- import { RulesModule } from "../../modules/Rules";
1
+ import { DiscountModule } from '../../modules/Discount';
2
+ import { RulesModule } from '../../modules/Rules';
3
3
  export declare enum ShopDiscountHooks {
4
4
  onInited = "shopDiscount:onInited",
5
5
  onDestroy = "shopDiscount:onDestroy",
6
6
  onLoadDiscountList = "shopDiscount:onLoadDiscountList",
7
7
  onCustomerChange = "shopDiscount:onCustomerChange",
8
+ onScanCustomerChange = "shopDiscount:onScanCustomerChange",
8
9
  onDiscountListChange = "shopDiscount:onDiscountListChange",
9
10
  onRulesListChange = "shopDiscount:onRulesListChange",
10
11
  onLoadPrepareCalcResult = "shopDiscount:onLoadPrepareCalcResult"
@@ -27,6 +27,7 @@ var ShopDiscountHooks = /* @__PURE__ */ ((ShopDiscountHooks2) => {
27
27
  ShopDiscountHooks2["onDestroy"] = "shopDiscount:onDestroy";
28
28
  ShopDiscountHooks2["onLoadDiscountList"] = "shopDiscount:onLoadDiscountList";
29
29
  ShopDiscountHooks2["onCustomerChange"] = "shopDiscount:onCustomerChange";
30
+ ShopDiscountHooks2["onScanCustomerChange"] = "shopDiscount:onScanCustomerChange";
30
31
  ShopDiscountHooks2["onDiscountListChange"] = "shopDiscount:onDiscountListChange";
31
32
  ShopDiscountHooks2["onRulesListChange"] = "shopDiscount:onRulesListChange";
32
33
  ShopDiscountHooks2["onLoadPrepareCalcResult"] = "shopDiscount:onLoadPrepareCalcResult";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "3.0.5",
4
+ "version": "3.0.7",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -14,6 +14,7 @@
14
14
  "dev": "father dev --watch",
15
15
  "test": "vitest",
16
16
  "lint": "eslint src --ext .ts",
17
+ "format": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,md}\"",
17
18
  "changeset": "changeset",
18
19
  "version": "changeset version",
19
20
  "release": "changeset publish --registry=https://registry.npmjs.com/ && npm run sync && git push",
@@ -54,6 +55,7 @@
54
55
  "axios": "1.7.2",
55
56
  "eslint": "^8.37.0",
56
57
  "father": "^4.1.0",
58
+ "prettier": "^3.5.3",
57
59
  "ts-node": "^10.9.1",
58
60
  "typedoc": "^0.28.2",
59
61
  "typescript": "^5.0.3",
@@ -65,4 +67,4 @@
65
67
  "publishConfig": {
66
68
  "access": "public"
67
69
  }
68
- }
70
+ }