@pisell/pisellos 0.0.205 → 0.0.207

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 (48) hide show
  1. package/dist/effects/index.d.ts +1 -1
  2. package/dist/modules/Order/utils.js +8 -2
  3. package/dist/modules/Rules/types.d.ts +1 -1
  4. package/dist/modules/Schedule/type.d.ts +7 -7
  5. package/dist/modules/Schedule/types.d.ts +9 -9
  6. package/dist/solution/BookingByStep/utils/resources.d.ts +1 -1
  7. package/dist/solution/ShopDiscount/types.d.ts +1 -1
  8. package/dist/types/index.d.ts +1 -1
  9. package/lib/core/index.js +27 -28
  10. package/lib/effects/index.d.ts +1 -1
  11. package/lib/effects/index.js +3 -7
  12. package/lib/modules/Account/index.js +9 -10
  13. package/lib/modules/AccountList/index.js +14 -11
  14. package/lib/modules/BaseModule.js +6 -3
  15. package/lib/modules/Cart/index.js +14 -9
  16. package/lib/modules/Cart/utils/cartProduct.js +3 -6
  17. package/lib/modules/Date/index.js +8 -4
  18. package/lib/modules/Date/types.js +1 -0
  19. package/lib/modules/Discount/index.js +11 -6
  20. package/lib/modules/Guests/index.js +10 -15
  21. package/lib/modules/Order/index.js +4 -2
  22. package/lib/modules/Order/utils.js +3 -2
  23. package/lib/modules/Payment/cash.js +1 -1
  24. package/lib/modules/Payment/eftpos.js +1 -1
  25. package/lib/modules/Payment/index.js +98 -86
  26. package/lib/modules/Payment/wallet.js +1 -1
  27. package/lib/modules/Product/index.js +6 -5
  28. package/lib/modules/ProductList/index.js +5 -4
  29. package/lib/modules/Resource/index.js +8 -12
  30. package/lib/modules/Rules/index.js +10 -13
  31. package/lib/modules/Rules/types.d.ts +1 -1
  32. package/lib/modules/Schedule/index.js +8 -5
  33. package/lib/modules/Schedule/type.d.ts +7 -7
  34. package/lib/modules/Schedule/types.d.ts +9 -9
  35. package/lib/modules/Schedule/utils.js +2 -4
  36. package/lib/modules/Step/index.js +7 -4
  37. package/lib/modules/Summary/index.js +9 -4
  38. package/lib/plugins/request.js +34 -33
  39. package/lib/plugins/window.js +101 -113
  40. package/lib/solution/BookingByStep/index.js +44 -69
  41. package/lib/solution/BookingByStep/utils/resources.d.ts +1 -1
  42. package/lib/solution/BookingByStep/utils/resources.js +4 -8
  43. package/lib/solution/BookingByStep/utils/timeslots.js +6 -12
  44. package/lib/solution/BuyTickets/index.js +15 -15
  45. package/lib/solution/ShopDiscount/index.js +15 -11
  46. package/lib/solution/ShopDiscount/types.d.ts +1 -1
  47. package/lib/types/index.d.ts +1 -1
  48. package/package.json +1 -1
@@ -25,13 +25,13 @@ module.exports = __toCommonJS(Guests_exports);
25
25
  var import_BaseModule = require("../BaseModule");
26
26
  var import_types = require("./types");
27
27
  var GuestListModule = class extends import_BaseModule.BaseModule {
28
+ defaultName = "guestList";
29
+ defaultVersion = "1.0.0";
30
+ state = {
31
+ list: []
32
+ };
28
33
  constructor(name, version) {
29
34
  super(name, version);
30
- this.defaultName = "guestList";
31
- this.defaultVersion = "1.0.0";
32
- this.state = {
33
- list: []
34
- };
35
35
  }
36
36
  async initialize(core, options) {
37
37
  this.core = core;
@@ -46,8 +46,7 @@ var GuestListModule = class extends import_BaseModule.BaseModule {
46
46
  }
47
47
  async updateGuest(id, updates) {
48
48
  const index = this.state.list.findIndex((g) => g.id === id);
49
- if (index === -1)
50
- return;
49
+ if (index === -1) return;
51
50
  this.state.list[index] = {
52
51
  ...this.state.list[index],
53
52
  ...updates
@@ -60,8 +59,7 @@ var GuestListModule = class extends import_BaseModule.BaseModule {
60
59
  }
61
60
  async removeGuest(id) {
62
61
  const index = this.state.list.findIndex((g) => g.id === id);
63
- if (index === -1)
64
- return;
62
+ if (index === -1) return;
65
63
  const [removed] = this.state.list.splice(index, 1);
66
64
  await this.core.effects.emit(import_types.GuestHooks.OnGuestRemove, removed);
67
65
  await this.core.effects.emit(import_types.GuestHooks.OnGuestChange, this.state.list);
@@ -74,19 +72,16 @@ var GuestListModule = class extends import_BaseModule.BaseModule {
74
72
  }
75
73
  async addItemToGuest(guestId, item) {
76
74
  const guest = this.state.list.find((g) => g.id === guestId);
77
- if (!guest)
78
- return;
75
+ if (!guest) return;
79
76
  guest.items.push(item);
80
77
  await this.core.effects.emit(import_types.GuestHooks.OnGuestUpdate, guest);
81
78
  await this.core.effects.emit(import_types.GuestHooks.OnGuestChange, this.state.list);
82
79
  }
83
80
  async removeItemFromGuest(guestId, itemId) {
84
81
  const guest = this.state.list.find((g) => g.id === guestId);
85
- if (!guest)
86
- return;
82
+ if (!guest) return;
87
83
  const index = guest.items.findIndex((i) => i.id === itemId);
88
- if (index === -1)
89
- return;
84
+ if (index === -1) return;
90
85
  guest.items.splice(index, 1);
91
86
  await this.core.effects.emit(import_types.GuestHooks.OnGuestUpdate, guest);
92
87
  await this.core.effects.emit(import_types.GuestHooks.OnGuestChange, this.state.list);
@@ -26,10 +26,12 @@ var import_BaseModule = require("../BaseModule");
26
26
  var import_utils = require("./utils");
27
27
  var import_utils2 = require("../Product/utils");
28
28
  var OrderModule = class extends import_BaseModule.BaseModule {
29
+ defaultName = "order";
30
+ defaultVersion = "1.0.0";
31
+ store;
32
+ request;
29
33
  constructor(name, version) {
30
34
  super(name, version);
31
- this.defaultName = "order";
32
- this.defaultVersion = "1.0.0";
33
35
  }
34
36
  async initialize(core, options) {
35
37
  this.core = core;
@@ -48,11 +48,12 @@ var mergeRelationForms = (relationForms) => {
48
48
  acc[form_id] = { form_id, form_record_ids: [] };
49
49
  }
50
50
  const ids = Array.isArray(form_record_ids) ? form_record_ids : [form_record_ids];
51
- acc[form_id].form_record_ids.push(...ids);
51
+ const validIds = ids.filter((id) => id != null);
52
+ acc[form_id].form_record_ids.push(...validIds);
52
53
  acc[form_id].form_record_ids = [...new Set(acc[form_id].form_record_ids)];
53
54
  return acc;
54
55
  }, {})
55
- );
56
+ ).filter((item) => item.form_record_ids.length > 0);
56
57
  };
57
58
  // Annotate the CommonJS export names for ESM import in node:
58
59
  0 && (module.exports = {
@@ -29,7 +29,7 @@ var CashPaymentImpl = class {
29
29
  async processCashPayment(amount, orderUuid) {
30
30
  const cashMethod = await this.paymentModule.getCashPaymentMethod();
31
31
  if (!cashMethod) {
32
- throw new Error("现金支付方式未找到");
32
+ throw new Error("\u73B0\u91D1\u652F\u4ED8\u65B9\u5F0F\u672A\u627E\u5230");
33
33
  }
34
34
  const paymentItem = {
35
35
  amount: amount.toString(),
@@ -29,7 +29,7 @@ var EftposPaymentImpl = class {
29
29
  async processEftposPayment(amount, orderUuid) {
30
30
  const eftposMethod = await this.paymentModule.getEftposPaymentMethod();
31
31
  if (!eftposMethod) {
32
- throw new Error("Eftpos支付方式未找到");
32
+ throw new Error("Eftpos\u652F\u4ED8\u65B9\u5F0F\u672A\u627E\u5230");
33
33
  }
34
34
  const paymentItem = {
35
35
  amount: amount.toString(),