@pisell/pisellos 2.2.151 → 2.2.153

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.
@@ -17,14 +17,18 @@ export declare class DiscountModule extends BaseModule implements Module, Discou
17
17
  setOriginalDiscountList(originalDiscountList: Discount[]): Promise<void>;
18
18
  getOriginalDiscountList(): Discount[];
19
19
  loadPrepareConfig(params: {
20
- action?: 'create';
20
+ action?: 'create' | 'edit';
21
21
  with_good_pass: 0 | 1;
22
22
  with_discount_card: 0 | 1;
23
23
  customer_id: number;
24
24
  with_wallet_pass_holder: 0 | 1;
25
25
  request_timezone: string;
26
+ order_id?: number;
27
+ }): Promise<Discount[]>;
28
+ batchSearch(code: string, options?: {
29
+ customerId?: number;
30
+ orderId?: number;
26
31
  }): Promise<Discount[]>;
27
- batchSearch(code: string, customerId?: number): Promise<Discount[]>;
28
32
  filterEnabledDiscountList(discountList: Discount[]): Discount[];
29
33
  private checkUsageCreditsLimit;
30
34
  uniqueByProductId(discountList: Discount[]): Discount[];
@@ -1,4 +1,6 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
2
4
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
3
5
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
6
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
@@ -176,13 +178,14 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
176
178
  }, {
177
179
  key: "batchSearch",
178
180
  value: function () {
179
- var _batchSearch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(code, customerId) {
180
- var result, resultDiscountList;
181
+ var _batchSearch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(code, options) {
182
+ var _ref, customerId, orderId, result, resultDiscountList;
181
183
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
182
184
  while (1) switch (_context5.prev = _context5.next) {
183
185
  case 0:
184
- _context5.next = 2;
185
- return this.request.get("/machinecode/batch-search", {
186
+ _ref = options || {}, customerId = _ref.customerId, orderId = _ref.orderId;
187
+ _context5.next = 3;
188
+ return this.request.get("/machinecode/batch-search", _objectSpread(_objectSpread({
186
189
  code: code,
187
190
  translate_flag: 1,
188
191
  tags: ['good_pass', 'product_discount_card'],
@@ -190,14 +193,17 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
190
193
  relation_product: 1,
191
194
  with: ['extensionData', 'customScheduleSnapshot', 'holder.detail'],
192
195
  order_behavior_count: 1,
193
- order_behavior_count_customer_id: customerId || 1,
196
+ order_behavior_count_customer_id: customerId || 1
197
+ }, orderId ? {
198
+ order_behavior_count_order_id: orderId
199
+ } : {}), {}, {
194
200
  request_timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
195
- });
196
- case 2:
201
+ }));
202
+ case 3:
197
203
  result = _context5.sent;
198
204
  resultDiscountList = this.filterEnabledDiscountList((result === null || result === void 0 ? void 0 : result.data) || []) || [];
199
205
  return _context5.abrupt("return", resultDiscountList);
200
- case 5:
206
+ case 6:
201
207
  case "end":
202
208
  return _context5.stop();
203
209
  }
@@ -171,7 +171,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
171
171
  private logSubmitBackendRejected;
172
172
  syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
173
173
  createOrder(params: CommitOrderParams['query']): {
174
- type: "appointment_booking" | "virtual";
174
+ type: "virtual" | "appointment_booking";
175
175
  platform: string;
176
176
  sales_channel: string;
177
177
  order_sales_channel: string;
@@ -243,7 +243,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
243
243
  while (1) switch (_context3.prev = _context3.next) {
244
244
  case 0:
245
245
  _context3.next = 2;
246
- return (_this$store$discount4 = this.store.discount) === null || _this$store$discount4 === void 0 ? void 0 : _this$store$discount4.batchSearch(code, customerId);
246
+ return (_this$store$discount4 = this.store.discount) === null || _this$store$discount4 === void 0 ? void 0 : _this$store$discount4.batchSearch(code, {
247
+ customerId: customerId
248
+ });
247
249
  case 2:
248
250
  _context3.t0 = _context3.sent;
249
251
  if (_context3.t0) {
@@ -115,6 +115,12 @@ declare class Server {
115
115
  * 不影响当前界面展示,适用于切回前台、定时刷新等场景
116
116
  */
117
117
  refreshProductsInBackground(): Promise<void>;
118
+ /**
119
+ * 后台静默刷新订单数据
120
+ * 重新拉取全量 SSE 接口,更新本地数据后触发 onOrdersSyncCompleted
121
+ * 不影响当前界面展示,适用于切回前台、定时刷新等场景
122
+ */
123
+ refreshOrdersInBackground(): Promise<void>;
118
124
  /**
119
125
  * 清空所有server模块的IndexedDB缓存
120
126
  * @returns Promise<void>