@pisell/pisellos 2.2.260 → 2.2.262

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 (107) hide show
  1. package/dist/model/strategy/adapter/dataVariant/adapter.d.ts +1 -0
  2. package/dist/model/strategy/adapter/dataVariant/adapter.js +15 -0
  3. package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +2 -0
  4. package/dist/model/strategy/adapter/dataVariant/evaluator.js +25 -0
  5. package/dist/model/strategy/adapter/dataVariant/examples.js +1 -6
  6. package/dist/model/strategy/adapter/dataVariant/type.d.ts +2 -0
  7. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  8. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +23 -13
  9. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +2 -1
  10. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +1 -1
  11. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +32 -1
  12. package/dist/modules/Discount/index.d.ts +5 -2
  13. package/dist/modules/Discount/index.js +30 -7
  14. package/dist/modules/Discount/types.d.ts +4 -0
  15. package/dist/modules/Order/index.d.ts +45 -2
  16. package/dist/modules/Order/index.js +1552 -926
  17. package/dist/modules/Order/types.d.ts +36 -2
  18. package/dist/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
  19. package/dist/modules/Order/utils/bundleDiscountHydration.js +144 -0
  20. package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
  21. package/dist/modules/Order/utils/orderCollectionIdentity.js +405 -0
  22. package/dist/modules/Order/utils.d.ts +8 -3
  23. package/dist/modules/Order/utils.js +136 -56
  24. package/dist/modules/Rules/index.d.ts +4 -10
  25. package/dist/modules/Rules/index.js +63 -12
  26. package/dist/modules/Rules/types.d.ts +12 -2
  27. package/dist/modules/SalesSummary/index.d.ts +7 -3
  28. package/dist/modules/SalesSummary/index.js +67 -39
  29. package/dist/modules/SalesSummary/types.d.ts +1 -0
  30. package/dist/modules/SalesSummary/utils.js +2 -1
  31. package/dist/modules/SurchargeList/index.d.ts +6 -4
  32. package/dist/modules/SurchargeList/index.js +62 -39
  33. package/dist/modules/SurchargeList/types.d.ts +6 -2
  34. package/dist/server/index.d.ts +8 -0
  35. package/dist/server/index.js +1365 -911
  36. package/dist/server/modules/order/index.d.ts +32 -7
  37. package/dist/server/modules/order/index.js +551 -464
  38. package/dist/server/modules/order/types.d.ts +4 -0
  39. package/dist/server/modules/products/index.d.ts +5 -1
  40. package/dist/server/modules/products/index.js +384 -315
  41. package/dist/server/modules/products/types.d.ts +4 -0
  42. package/dist/solution/BaseSales/index.d.ts +42 -2
  43. package/dist/solution/BaseSales/index.js +1416 -775
  44. package/dist/solution/BaseSales/types.d.ts +7 -1
  45. package/dist/solution/BaseSales/types.js +3 -2
  46. package/dist/solution/BaseSales/utils/cartPromotion.js +19 -7
  47. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +3 -3
  48. package/dist/solution/BaseSales/utils/parseSalesResponse.js +6 -8
  49. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +20 -4
  50. package/dist/solution/BookingByStep/index.d.ts +1 -1
  51. package/dist/solution/BookingTicket/index.d.ts +8 -0
  52. package/dist/solution/BookingTicket/index.js +212 -31
  53. package/dist/solution/ShopDiscount/index.js +15 -14
  54. package/lib/model/strategy/adapter/dataVariant/adapter.d.ts +1 -0
  55. package/lib/model/strategy/adapter/dataVariant/adapter.js +10 -0
  56. package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +2 -0
  57. package/lib/model/strategy/adapter/dataVariant/evaluator.js +20 -1
  58. package/lib/model/strategy/adapter/dataVariant/examples.js +0 -2
  59. package/lib/model/strategy/adapter/dataVariant/type.d.ts +2 -0
  60. package/lib/model/strategy/adapter/promotion/index.js +0 -49
  61. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +16 -1
  62. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +1 -0
  63. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +1 -1
  64. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +23 -2
  65. package/lib/modules/Discount/index.d.ts +5 -2
  66. package/lib/modules/Discount/index.js +23 -3
  67. package/lib/modules/Discount/types.d.ts +4 -0
  68. package/lib/modules/Order/index.d.ts +45 -2
  69. package/lib/modules/Order/index.js +720 -116
  70. package/lib/modules/Order/types.d.ts +36 -2
  71. package/lib/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
  72. package/lib/modules/Order/utils/bundleDiscountHydration.js +139 -0
  73. package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
  74. package/lib/modules/Order/utils/orderCollectionIdentity.js +415 -0
  75. package/lib/modules/Order/utils.d.ts +8 -3
  76. package/lib/modules/Order/utils.js +104 -18
  77. package/lib/modules/Rules/index.d.ts +4 -10
  78. package/lib/modules/Rules/index.js +61 -9
  79. package/lib/modules/Rules/types.d.ts +12 -2
  80. package/lib/modules/SalesSummary/index.d.ts +7 -3
  81. package/lib/modules/SalesSummary/index.js +28 -11
  82. package/lib/modules/SalesSummary/types.d.ts +1 -0
  83. package/lib/modules/SalesSummary/utils.js +2 -0
  84. package/lib/modules/SurchargeList/index.d.ts +6 -4
  85. package/lib/modules/SurchargeList/index.js +41 -21
  86. package/lib/modules/SurchargeList/types.d.ts +6 -2
  87. package/lib/server/index.d.ts +8 -0
  88. package/lib/server/index.js +336 -11
  89. package/lib/server/modules/order/index.d.ts +32 -7
  90. package/lib/server/modules/order/index.js +298 -189
  91. package/lib/server/modules/order/types.d.ts +4 -0
  92. package/lib/server/modules/products/index.d.ts +5 -1
  93. package/lib/server/modules/products/index.js +21 -0
  94. package/lib/server/modules/products/types.d.ts +4 -0
  95. package/lib/solution/BaseSales/index.d.ts +42 -2
  96. package/lib/solution/BaseSales/index.js +535 -108
  97. package/lib/solution/BaseSales/types.d.ts +7 -1
  98. package/lib/solution/BaseSales/types.js +2 -1
  99. package/lib/solution/BaseSales/utils/cartPromotion.js +13 -1
  100. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +3 -3
  101. package/lib/solution/BaseSales/utils/parseSalesResponse.js +4 -5
  102. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +14 -6
  103. package/lib/solution/BookingByStep/index.d.ts +1 -1
  104. package/lib/solution/BookingTicket/index.d.ts +8 -0
  105. package/lib/solution/BookingTicket/index.js +134 -8
  106. package/lib/solution/ShopDiscount/index.js +2 -1
  107. package/package.json +1 -1
@@ -30,6 +30,7 @@ var salesSummaryDataKeys = {
30
30
  taxTitle: 'tax_title',
31
31
  taxCountryCode: 'tax_country_code'
32
32
  };
33
+ var DEFAULT_SURCHARGE_CHANNEL = 'online-store';
33
34
  export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
34
35
  _inherits(SalesSummaryModule, _BaseModule);
35
36
  var _super = _createSuper(SalesSummaryModule);
@@ -43,13 +44,15 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
43
44
  _defineProperty(_assertThisInitialized(_this), "store", void 0);
44
45
  _defineProperty(_assertThisInitialized(_this), "request", void 0);
45
46
  _defineProperty(_assertThisInitialized(_this), "surchargeListModuleName", 'surchargeList');
47
+ _defineProperty(_assertThisInitialized(_this), "otherParams", {});
48
+ _defineProperty(_assertThisInitialized(_this), "surchargeListChannel", DEFAULT_SURCHARGE_CHANNEL);
46
49
  return _this;
47
50
  }
48
51
  _createClass(SalesSummaryModule, [{
49
52
  key: "initialize",
50
53
  value: function () {
51
54
  var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core, options) {
52
- var _options$initialState, _options$initialState2, _options$otherParams;
55
+ var _options$initialState, _options$initialState2, _this$otherParams;
53
56
  return _regeneratorRuntime().wrap(function _callee$(_context) {
54
57
  while (1) switch (_context.prev = _context.next) {
55
58
  case 0:
@@ -57,24 +60,25 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
57
60
  this.store = options.store;
58
61
  this.appPlugin = this.core.getPlugin('app');
59
62
  this.request = this.core.getPlugin('request');
63
+ this.otherParams = options.otherParams || {};
60
64
  this.store.surchargeList = ((_options$initialState = options.initialState) === null || _options$initialState === void 0 ? void 0 : _options$initialState.surchargeList) || [];
61
65
  this.store.summary = ((_options$initialState2 = options.initialState) === null || _options$initialState2 === void 0 ? void 0 : _options$initialState2.summary) || createEmptySalesSummary();
62
- this.surchargeListModuleName = ((_options$otherParams = options.otherParams) === null || _options$otherParams === void 0 ? void 0 : _options$otherParams.surchargeListModuleName) || 'surchargeList';
66
+ this.surchargeListModuleName = ((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.surchargeListModuleName) || 'surchargeList';
63
67
  if (this.appPlugin) {
64
- _context.next = 9;
68
+ _context.next = 10;
65
69
  break;
66
70
  }
67
71
  throw new Error('SalesSummaryModule 需要 app 插件支持');
68
- case 9:
72
+ case 10:
69
73
  if (this.request) {
70
- _context.next = 11;
74
+ _context.next = 12;
71
75
  break;
72
76
  }
73
77
  throw new Error('SalesSummaryModule 需要 request 插件支持');
74
- case 11:
75
- _context.next = 13;
78
+ case 12:
79
+ _context.next = 14;
76
80
  return this.getSurchargeList();
77
- case 13:
81
+ case 14:
78
82
  case "end":
79
83
  return _context.stop();
80
84
  }
@@ -86,30 +90,32 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
86
90
  return initialize;
87
91
  }()
88
92
  /**
89
- * 更新父级解决方案透传的运行态参数,并在 surcharge 模块名变化时刷新附加费列表。
93
+ * 更新父级解决方案透传的运行态参数,并在 surcharge 模块名或渠道变化时刷新附加费列表。
90
94
  *
91
95
  * @example
92
- * await salesSummaryModule.updateOtherParams({ surchargeListModuleName: 'custom_surchargeList' });
96
+ * await salesSummaryModule.updateOtherParams({ channel: 'pos', surchargeListModuleName: 'custom_surchargeList' });
93
97
  */
94
98
  }, {
95
99
  key: "updateOtherParams",
96
100
  value: (function () {
97
101
  var _updateOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
98
- var nextSurchargeListModuleName;
102
+ var previousChannel, nextSurchargeListModuleName, nextChannel, shouldReload;
99
103
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
100
104
  while (1) switch (_context2.prev = _context2.next) {
101
105
  case 0:
106
+ previousChannel = this.resolveChannel();
102
107
  nextSurchargeListModuleName = (params === null || params === void 0 ? void 0 : params.surchargeListModuleName) || 'surchargeList';
103
- if (!(nextSurchargeListModuleName === this.surchargeListModuleName)) {
104
- _context2.next = 3;
108
+ nextChannel = this.resolveChannel(params);
109
+ shouldReload = nextSurchargeListModuleName !== this.surchargeListModuleName || nextChannel !== previousChannel;
110
+ this.otherParams = params || {};
111
+ this.surchargeListModuleName = nextSurchargeListModuleName;
112
+ if (!shouldReload) {
113
+ _context2.next = 9;
105
114
  break;
106
115
  }
107
- return _context2.abrupt("return");
108
- case 3:
109
- this.surchargeListModuleName = nextSurchargeListModuleName;
110
- _context2.next = 6;
111
- return this.getSurchargeList();
112
- case 6:
116
+ _context2.next = 9;
117
+ return this.getSurchargeList(nextChannel);
118
+ case 9:
113
119
  case "end":
114
120
  return _context2.stop();
115
121
  }
@@ -120,49 +126,63 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
120
126
  }
121
127
  return updateOtherParams;
122
128
  }())
129
+ }, {
130
+ key: "resolveChannel",
131
+ value: function resolveChannel() {
132
+ var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.otherParams;
133
+ return (params === null || params === void 0 ? void 0 : params.channel) || DEFAULT_SURCHARGE_CHANNEL;
134
+ }
123
135
  }, {
124
136
  key: "getSurchargeList",
125
137
  value: function () {
126
138
  var _getSurchargeList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
127
- var surchargeListModule, surchargeList;
139
+ var channel,
140
+ surchargeListModule,
141
+ surchargeList,
142
+ _args3 = arguments;
128
143
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
129
144
  while (1) switch (_context3.prev = _context3.next) {
130
145
  case 0:
131
- _context3.prev = 0;
146
+ channel = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : this.resolveChannel();
147
+ _context3.prev = 1;
132
148
  surchargeListModule = this.core.getModule(this.surchargeListModuleName);
133
149
  if (!(surchargeListModule !== null && surchargeListModule !== void 0 && surchargeListModule.getSurchargeList)) {
134
- _context3.next = 7;
150
+ _context3.next = 9;
135
151
  break;
136
152
  }
137
- _context3.next = 5;
138
- return surchargeListModule.getSurchargeList();
139
- case 5:
153
+ _context3.next = 6;
154
+ return surchargeListModule.getSurchargeList({
155
+ channel: channel
156
+ });
157
+ case 6:
140
158
  this.store.surchargeList = _context3.sent;
159
+ this.surchargeListChannel = channel;
141
160
  return _context3.abrupt("return");
142
- case 7:
143
- _context3.next = 9;
161
+ case 9:
162
+ _context3.next = 11;
144
163
  return this.request.get('/order/custom-surcharge/available/v2', {
145
- // TODO 真实的渠道
146
- channel: 'online-store',
164
+ channel: channel,
147
165
  is_assemble_product_data: 1,
148
166
  is_assemble_schedule_data: 1,
149
167
  with: ['relationSchedule']
150
168
  });
151
- case 9:
169
+ case 11:
152
170
  surchargeList = _context3.sent;
153
171
  this.store.surchargeList = (surchargeList === null || surchargeList === void 0 ? void 0 : surchargeList.data) || [];
154
- _context3.next = 17;
172
+ this.surchargeListChannel = channel;
173
+ _context3.next = 21;
155
174
  break;
156
- case 13:
157
- _context3.prev = 13;
158
- _context3.t0 = _context3["catch"](0);
175
+ case 16:
176
+ _context3.prev = 16;
177
+ _context3.t0 = _context3["catch"](1);
159
178
  console.warn('[SalesSummaryModule] 加载附加费配置失败', _context3.t0);
160
179
  this.store.surchargeList = [];
161
- case 17:
180
+ this.surchargeListChannel = channel;
181
+ case 21:
162
182
  case "end":
163
183
  return _context3.stop();
164
184
  }
165
- }, _callee3, this, [[0, 13]]);
185
+ }, _callee3, this, [[1, 16]]);
166
186
  }));
167
187
  function getSurchargeList() {
168
188
  return _getSurchargeList.apply(this, arguments);
@@ -194,11 +214,19 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
194
214
  value: function () {
195
215
  var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
196
216
  var _this$store$surcharge, _ref;
197
- var _params$products, products, isPriceIncludeTax, taxRate, shopDiscount, taxConfig, summarySchedule, needScheduleIds, scheduleList, scheduleById, _iterator, _step, item, summary, summaryWithTaxMeta;
217
+ var _params$products, products, isPriceIncludeTax, taxRate, shopDiscount, channel, summaryChannel, taxConfig, summarySchedule, needScheduleIds, scheduleList, scheduleById, _iterator, _step, item, summary, summaryWithTaxMeta;
198
218
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
199
219
  while (1) switch (_context4.prev = _context4.next) {
200
220
  case 0:
201
- _params$products = params.products, products = _params$products === void 0 ? [] : _params$products, isPriceIncludeTax = params.isPriceIncludeTax, taxRate = params.taxRate, shopDiscount = params.shopDiscount;
221
+ _params$products = params.products, products = _params$products === void 0 ? [] : _params$products, isPriceIncludeTax = params.isPriceIncludeTax, taxRate = params.taxRate, shopDiscount = params.shopDiscount, channel = params.channel;
222
+ summaryChannel = channel || this.resolveChannel();
223
+ if (!(summaryChannel !== this.surchargeListChannel)) {
224
+ _context4.next = 5;
225
+ break;
226
+ }
227
+ _context4.next = 5;
228
+ return this.getSurchargeList(summaryChannel);
229
+ case 5:
202
230
  taxConfig = this.getTaxConfig();
203
231
  summarySchedule = this.core.getModule("".concat(this.name.split('_')[0], "_schedule"));
204
232
  needScheduleIds = (((_this$store$surcharge = this.store.surchargeList) === null || _this$store$surcharge === void 0 || (_this$store$surcharge = _this$store$surcharge.map(function (item) {
@@ -237,7 +265,7 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
237
265
  });
238
266
  this.store.summary = summaryWithTaxMeta;
239
267
  return _context4.abrupt("return", summaryWithTaxMeta);
240
- case 11:
268
+ case 15:
241
269
  case "end":
242
270
  return _context4.stop();
243
271
  }
@@ -63,5 +63,6 @@ export interface SalesSummaryModuleAPI {
63
63
  isPriceIncludeTax?: number;
64
64
  taxRate?: number;
65
65
  shopDiscount?: string | number;
66
+ channel?: string;
66
67
  }): Promise<SalesSummaryData>;
67
68
  }
@@ -329,11 +329,12 @@ function buildSurchargeQuantityTotals(nodes) {
329
329
  }
330
330
  function getFallbackAllProductSurchargeIds(surchargeList) {
331
331
  return (surchargeList || []).reduce(function (ids, config) {
332
- var _config$open_product, _config$is_all;
332
+ var _config$open_product, _config$is_all, _config$open_schedule;
333
333
  var id = getSurchargeConfigId(config);
334
334
  if (id === undefined) return ids;
335
335
  if (Number((_config$open_product = config.open_product) !== null && _config$open_product !== void 0 ? _config$open_product : 0) === 0) return ids;
336
336
  if (Number((_config$is_all = config.is_all) !== null && _config$is_all !== void 0 ? _config$is_all : 0) !== 1) return ids;
337
+ if (Number((_config$open_schedule = config.open_schedule) !== null && _config$open_schedule !== void 0 ? _config$open_schedule : 0) === 1 && config.schedule_type !== 'all') return ids;
337
338
  ids.push(id);
338
339
  return ids;
339
340
  }, []);
@@ -1,16 +1,18 @@
1
1
  import { Module, ModuleOptions, PisellCore } from '../../types';
2
2
  import { BaseModule } from '../BaseModule';
3
- import { SurchargeListItem, SurchargeListModuleAPI } from './types';
3
+ import { SurchargeListItem, SurchargeListModuleAPI, SurchargeListQuery } from './types';
4
4
  export * from './types';
5
5
  export declare class SurchargeListModule extends BaseModule implements Module, SurchargeListModuleAPI {
6
6
  protected defaultName: string;
7
7
  protected defaultVersion: string;
8
8
  private request;
9
9
  private store;
10
- private loadingPromise;
10
+ private loadingPromises;
11
+ private requestVersion;
11
12
  constructor(name?: string, version?: string);
12
13
  initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
13
- getSurchargeList(): Promise<SurchargeListItem[]>;
14
- refreshSurchargeList(): Promise<SurchargeListItem[]>;
14
+ private resolveChannel;
15
+ getSurchargeList(query?: SurchargeListQuery): Promise<SurchargeListItem[]>;
16
+ refreshSurchargeList(query?: SurchargeListQuery): Promise<SurchargeListItem[]>;
15
17
  private loadSurchargeList;
16
18
  }
@@ -17,6 +17,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
17
17
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
18
18
  import { BaseModule } from "../BaseModule";
19
19
  export * from "./types";
20
+ var DEFAULT_SURCHARGE_CHANNEL = 'online-store';
20
21
  export var SurchargeListModule = /*#__PURE__*/function (_BaseModule) {
21
22
  _inherits(SurchargeListModule, _BaseModule);
22
23
  var _super = _createSuper(SurchargeListModule);
@@ -28,14 +29,15 @@ export var SurchargeListModule = /*#__PURE__*/function (_BaseModule) {
28
29
  _defineProperty(_assertThisInitialized(_this), "defaultVersion", '1.0.0');
29
30
  _defineProperty(_assertThisInitialized(_this), "request", void 0);
30
31
  _defineProperty(_assertThisInitialized(_this), "store", void 0);
31
- _defineProperty(_assertThisInitialized(_this), "loadingPromise", null);
32
+ _defineProperty(_assertThisInitialized(_this), "loadingPromises", new Map());
33
+ _defineProperty(_assertThisInitialized(_this), "requestVersion", 0);
32
34
  return _this;
33
35
  }
34
36
  _createClass(SurchargeListModule, [{
35
37
  key: "initialize",
36
38
  value: function () {
37
39
  var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core, options) {
38
- var _options$initialState, _options$initialState2, _options$initialState3;
40
+ var _options$initialState, _options$initialState2, _options$initialState3, _options$otherParams, _options$initialState4;
39
41
  var hasInitialSurchargeList;
40
42
  return _regeneratorRuntime().wrap(function _callee$(_context) {
41
43
  while (1) switch (_context.prev = _context.next) {
@@ -45,13 +47,14 @@ export var SurchargeListModule = /*#__PURE__*/function (_BaseModule) {
45
47
  this.request = this.core.getPlugin('request');
46
48
  hasInitialSurchargeList = Array.isArray((_options$initialState = options.initialState) === null || _options$initialState === void 0 ? void 0 : _options$initialState.surchargeList);
47
49
  this.store.surchargeList = hasInitialSurchargeList ? (_options$initialState2 = options.initialState) === null || _options$initialState2 === void 0 ? void 0 : _options$initialState2.surchargeList : [];
48
- this.store.isLoaded = Boolean((_options$initialState3 = options.initialState) === null || _options$initialState3 === void 0 ? void 0 : _options$initialState3.isLoaded) || hasInitialSurchargeList;
50
+ this.store.channel = ((_options$initialState3 = options.initialState) === null || _options$initialState3 === void 0 ? void 0 : _options$initialState3.channel) || ((_options$otherParams = options.otherParams) === null || _options$otherParams === void 0 ? void 0 : _options$otherParams.channel) || DEFAULT_SURCHARGE_CHANNEL;
51
+ this.store.isLoaded = Boolean((_options$initialState4 = options.initialState) === null || _options$initialState4 === void 0 ? void 0 : _options$initialState4.isLoaded) || hasInitialSurchargeList;
49
52
  if (this.request) {
50
- _context.next = 8;
53
+ _context.next = 9;
51
54
  break;
52
55
  }
53
56
  throw new Error('SurchargeListModule 需要 request 插件支持');
54
- case 8:
57
+ case 9:
55
58
  case "end":
56
59
  return _context.stop();
57
60
  }
@@ -62,34 +65,43 @@ export var SurchargeListModule = /*#__PURE__*/function (_BaseModule) {
62
65
  }
63
66
  return initialize;
64
67
  }()
68
+ }, {
69
+ key: "resolveChannel",
70
+ value: function resolveChannel(query) {
71
+ return (query === null || query === void 0 ? void 0 : query.channel) || DEFAULT_SURCHARGE_CHANNEL;
72
+ }
65
73
  }, {
66
74
  key: "getSurchargeList",
67
75
  value: function () {
68
- var _getSurchargeList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
76
+ var _getSurchargeList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(query) {
77
+ var channel, loadingPromise, nextPromise;
69
78
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
70
79
  while (1) switch (_context2.prev = _context2.next) {
71
80
  case 0:
72
- if (!this.store.isLoaded) {
73
- _context2.next = 2;
81
+ channel = this.resolveChannel(query);
82
+ if (!(this.store.isLoaded && this.store.channel === channel)) {
83
+ _context2.next = 3;
74
84
  break;
75
85
  }
76
86
  return _context2.abrupt("return", this.store.surchargeList);
77
- case 2:
78
- if (!this.loadingPromise) {
79
- _context2.next = 4;
87
+ case 3:
88
+ loadingPromise = this.loadingPromises.get(channel);
89
+ if (!loadingPromise) {
90
+ _context2.next = 6;
80
91
  break;
81
92
  }
82
- return _context2.abrupt("return", this.loadingPromise);
83
- case 4:
84
- this.loadingPromise = this.loadSurchargeList();
85
- return _context2.abrupt("return", this.loadingPromise);
93
+ return _context2.abrupt("return", loadingPromise);
86
94
  case 6:
95
+ nextPromise = this.loadSurchargeList(channel);
96
+ this.loadingPromises.set(channel, nextPromise);
97
+ return _context2.abrupt("return", nextPromise);
98
+ case 9:
87
99
  case "end":
88
100
  return _context2.stop();
89
101
  }
90
102
  }, _callee2, this);
91
103
  }));
92
- function getSurchargeList() {
104
+ function getSurchargeList(_x3) {
93
105
  return _getSurchargeList.apply(this, arguments);
94
106
  }
95
107
  return getSurchargeList;
@@ -97,19 +109,22 @@ export var SurchargeListModule = /*#__PURE__*/function (_BaseModule) {
97
109
  }, {
98
110
  key: "refreshSurchargeList",
99
111
  value: function () {
100
- var _refreshSurchargeList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
112
+ var _refreshSurchargeList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(query) {
113
+ var channel, nextPromise;
101
114
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
102
115
  while (1) switch (_context3.prev = _context3.next) {
103
116
  case 0:
104
- this.loadingPromise = this.loadSurchargeList();
105
- return _context3.abrupt("return", this.loadingPromise);
106
- case 2:
117
+ channel = this.resolveChannel(query);
118
+ nextPromise = this.loadSurchargeList(channel);
119
+ this.loadingPromises.set(channel, nextPromise);
120
+ return _context3.abrupt("return", nextPromise);
121
+ case 4:
107
122
  case "end":
108
123
  return _context3.stop();
109
124
  }
110
125
  }, _callee3, this);
111
126
  }));
112
- function refreshSurchargeList() {
127
+ function refreshSurchargeList(_x4) {
113
128
  return _refreshSurchargeList.apply(this, arguments);
114
129
  }
115
130
  return refreshSurchargeList;
@@ -117,42 +132,50 @@ export var SurchargeListModule = /*#__PURE__*/function (_BaseModule) {
117
132
  }, {
118
133
  key: "loadSurchargeList",
119
134
  value: function () {
120
- var _loadSurchargeList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
121
- var surchargeList;
135
+ var _loadSurchargeList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(channel) {
136
+ var currentRequestVersion, surchargeList, nextSurchargeList;
122
137
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
123
138
  while (1) switch (_context4.prev = _context4.next) {
124
139
  case 0:
125
- _context4.prev = 0;
126
- _context4.next = 3;
140
+ currentRequestVersion = ++this.requestVersion;
141
+ _context4.prev = 1;
142
+ _context4.next = 4;
127
143
  return this.request.get('/order/custom-surcharge/available/v2', {
128
- channel: 'online-store',
144
+ channel: channel,
129
145
  is_assemble_product_data: 1,
130
146
  is_assemble_schedule_data: 1,
131
147
  with: ['relationSchedule']
132
148
  });
133
- case 3:
149
+ case 4:
134
150
  surchargeList = _context4.sent;
135
- this.store.surchargeList = (surchargeList === null || surchargeList === void 0 ? void 0 : surchargeList.data) || [];
136
- this.store.isLoaded = true;
137
- return _context4.abrupt("return", this.store.surchargeList);
138
- case 9:
139
- _context4.prev = 9;
140
- _context4.t0 = _context4["catch"](0);
151
+ nextSurchargeList = (surchargeList === null || surchargeList === void 0 ? void 0 : surchargeList.data) || [];
152
+ if (currentRequestVersion === this.requestVersion) {
153
+ this.store.surchargeList = nextSurchargeList;
154
+ this.store.channel = channel;
155
+ this.store.isLoaded = true;
156
+ }
157
+ return _context4.abrupt("return", nextSurchargeList);
158
+ case 10:
159
+ _context4.prev = 10;
160
+ _context4.t0 = _context4["catch"](1);
141
161
  console.warn('[SurchargeListModule] 加载附加费配置失败', _context4.t0);
142
- this.store.surchargeList = [];
143
- this.store.isLoaded = true;
144
- return _context4.abrupt("return", this.store.surchargeList);
162
+ if (currentRequestVersion === this.requestVersion) {
163
+ this.store.surchargeList = [];
164
+ this.store.channel = channel;
165
+ this.store.isLoaded = true;
166
+ }
167
+ return _context4.abrupt("return", []);
145
168
  case 15:
146
169
  _context4.prev = 15;
147
- this.loadingPromise = null;
170
+ this.loadingPromises.delete(channel);
148
171
  return _context4.finish(15);
149
172
  case 18:
150
173
  case "end":
151
174
  return _context4.stop();
152
175
  }
153
- }, _callee4, this, [[0, 9, 15, 18]]);
176
+ }, _callee4, this, [[1, 10, 15, 18]]);
154
177
  }));
155
- function loadSurchargeList() {
178
+ function loadSurchargeList(_x5) {
156
179
  return _loadSurchargeList.apply(this, arguments);
157
180
  }
158
181
  return loadSurchargeList;
@@ -4,8 +4,12 @@ export interface SurchargeListItem {
4
4
  export interface SurchargeListState {
5
5
  surchargeList: SurchargeListItem[];
6
6
  isLoaded: boolean;
7
+ channel?: string;
8
+ }
9
+ export interface SurchargeListQuery {
10
+ channel?: string;
7
11
  }
8
12
  export interface SurchargeListModuleAPI {
9
- getSurchargeList(): Promise<SurchargeListItem[]>;
10
- refreshSurchargeList(): Promise<SurchargeListItem[]>;
13
+ getSurchargeList(query?: SurchargeListQuery): Promise<SurchargeListItem[]>;
14
+ refreshSurchargeList(query?: SurchargeListQuery): Promise<SurchargeListItem[]>;
11
15
  }
@@ -475,6 +475,9 @@ declare class Server {
475
475
  private shouldLookupLocalPrintOrder;
476
476
  private getLocalPrintOrderLookup;
477
477
  private handleLocalPrintOrder;
478
+ private handleMachinecodeBatchMeta;
479
+ private resolveMachinecodeBatchMetadataLookup;
480
+ private syncMachinecodeRedeemStatusToLocalOrder;
478
481
  private handleOrderCheckoutSubmit;
479
482
  private handleSyncCheckoutSubmit;
480
483
  private handlePendingSyncCheckoutOrder;
@@ -486,6 +489,11 @@ declare class Server {
486
489
  private sumPaidOrderPayments;
487
490
  private toAmountNumber;
488
491
  private buildSmallTicketProductMap;
492
+ private collectSalesDetailProductIds;
493
+ private buildSalesDetailProductSnapshotMap;
494
+ private withProductCatalogSnapshots;
495
+ private withBundleCatalogSnapshots;
496
+ private withSalesDetailProductSnapshots;
489
497
  private withPendingSyncProductTitles;
490
498
  private buildProductTitleSnapshot;
491
499
  private getProductTitleSnapshotCurrentLocale;