@pisell/pisellos 0.10.22 → 0.10.23

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.
@@ -0,0 +1,9 @@
1
+ // 导出评估器
2
+ export { PromotionEvaluator } from "./evaluator";
3
+
4
+ // 导出适配器
5
+ export { PromotionAdapter } from "./adapter";
6
+ export { default } from "./adapter";
7
+
8
+ // 导出策略配置示例常量
9
+ export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY, ITEM_REWARD_STRATEGY } from "./examples";
@@ -28,6 +28,7 @@ export declare class OpenDataModule extends BaseModule implements Module {
28
28
  * openDataModule.updateOtherParams({ openCache: true, cacheId: 'cache-2' })
29
29
  */
30
30
  updateOtherParams(params: Record<string, any>): void;
31
+ private shouldSkipInvoiceTemplateDocument;
31
32
  fetchOpenData(params: OpenDataFetchParams): Promise<OpenDataConfig>;
32
33
  getOpenData(): OpenDataConfig | null;
33
34
  getInvoiceLayoutConfig(): InvoiceLayoutConfig;
@@ -128,6 +128,12 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
128
128
  this.cacheId = this.otherParams.cacheId;
129
129
  this.fatherModule = this.otherParams.fatherModule;
130
130
  }
131
+ }, {
132
+ key: "shouldSkipInvoiceTemplateDocument",
133
+ value: function shouldSkipInvoiceTemplateDocument() {
134
+ var _this$otherParams;
135
+ return String(((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.platform) || '').trim().toLowerCase() === 'h5';
136
+ }
131
137
  }, {
132
138
  key: "fetchOpenData",
133
139
  value: function () {
@@ -205,6 +211,9 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
205
211
  key: "getInvoiceTemplateSettings",
206
212
  value: function getInvoiceTemplateSettings() {
207
213
  var _this$store$data2;
214
+ if (this.shouldSkipInvoiceTemplateDocument()) {
215
+ return getDefaultInvoiceTemplateSettings();
216
+ }
208
217
  if (isRecord(this.store.invoiceTemplateSettings)) {
209
218
  var _this$store$data;
210
219
  var documentId = resolveInvoiceDocumentId((_this$store$data = this.store.data) === null || _this$store$data === void 0 ? void 0 : _this$store$data['documents.invoice_template']);
@@ -278,10 +287,20 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
278
287
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
279
288
  while (1) switch (_context4.prev = _context4.next) {
280
289
  case 0:
290
+ if (!this.shouldSkipInvoiceTemplateDocument()) {
291
+ _context4.next = 2;
292
+ break;
293
+ }
294
+ return _context4.abrupt("return", {
295
+ settings: getDefaultInvoiceTemplateSettings(),
296
+ documentId: null,
297
+ cacheKey: null
298
+ });
299
+ case 2:
281
300
  rawTemplate = config['documents.invoice_template'];
282
301
  documentId = resolveInvoiceDocumentId(rawTemplate);
283
302
  if (documentId) {
284
- _context4.next = 4;
303
+ _context4.next = 6;
285
304
  break;
286
305
  }
287
306
  return _context4.abrupt("return", {
@@ -289,10 +308,10 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
289
308
  documentId: null,
290
309
  cacheKey: null
291
310
  });
292
- case 4:
311
+ case 6:
293
312
  cacheKey = this.buildInvoiceTemplateCacheKey(target, documentId);
294
313
  if (!(this.store.invoiceTemplateTarget === target && this.store.invoiceTemplateDocumentId === documentId && this.store.invoiceTemplateCacheKey === cacheKey && isRecord(this.store.invoiceTemplateSettings))) {
295
- _context4.next = 7;
314
+ _context4.next = 9;
296
315
  break;
297
316
  }
298
317
  return _context4.abrupt("return", {
@@ -300,10 +319,10 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
300
319
  documentId: documentId,
301
320
  cacheKey: cacheKey
302
321
  });
303
- case 7:
322
+ case 9:
304
323
  cachedSettings = this.invoiceTemplateDocumentCache.get(cacheKey);
305
324
  if (!cachedSettings) {
306
- _context4.next = 10;
325
+ _context4.next = 12;
307
326
  break;
308
327
  }
309
328
  return _context4.abrupt("return", {
@@ -311,7 +330,7 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
311
330
  documentId: documentId,
312
331
  cacheKey: cacheKey
313
332
  });
314
- case 10:
333
+ case 12:
315
334
  request = this.invoiceTemplateDocumentInFlight.get(cacheKey);
316
335
  if (!request) {
317
336
  cacheRevision = this.invoiceTemplateCacheRevision;
@@ -331,9 +350,9 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
331
350
  });
332
351
  this.invoiceTemplateDocumentInFlight.set(cacheKey, request);
333
352
  }
334
- _context4.next = 14;
353
+ _context4.next = 16;
335
354
  return request;
336
- case 14:
355
+ case 16:
337
356
  _context4.t0 = _context4.sent;
338
357
  _context4.t1 = documentId;
339
358
  _context4.t2 = cacheKey;
@@ -342,7 +361,7 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
342
361
  documentId: _context4.t1,
343
362
  cacheKey: _context4.t2
344
363
  });
345
- case 18:
364
+ case 20:
346
365
  case "end":
347
366
  return _context4.stop();
348
367
  }
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
326
326
  date: string;
327
327
  status: string;
328
328
  week: string;
329
- weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
329
+ weekNum: 0 | 1 | 2 | 5 | 4 | 3 | 6;
330
330
  }[]>;
331
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
332
332
  private getScheduleDataByIds;
@@ -345,7 +345,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
345
345
  count: number;
346
346
  left: number;
347
347
  summaryCount: number;
348
- status: "sold_out" | "lots_of_space" | "filling_up_fast";
348
+ status: "lots_of_space" | "filling_up_fast" | "sold_out";
349
349
  }[];
350
350
  /**
351
351
  * 找到多个资源的公共可用时间段
@@ -339,7 +339,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
339
339
  * 获取当前的客户搜索条件
340
340
  * @returns 当前搜索条件
341
341
  */
342
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
342
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
343
343
  /**
344
344
  * 获取客户列表状态(包含滚动加载相关状态)
345
345
  * @returns 客户状态
@@ -73,6 +73,7 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
73
73
  key: "initialize",
74
74
  value: function () {
75
75
  var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core) {
76
+ var _this$otherParams;
76
77
  var options,
77
78
  appPlugin,
78
79
  _args = arguments;
@@ -117,7 +118,8 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
117
118
  initialState: {},
118
119
  otherParams: {
119
120
  fatherModule: this.name,
120
- openCache: false
121
+ openCache: false,
122
+ platform: (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.platform
121
123
  }
122
124
  });
123
125
  _context.next = 18;
@@ -524,8 +526,8 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
524
526
  }, {
525
527
  key: "getTimelineBucketMinutes",
526
528
  value: function getTimelineBucketMinutes() {
527
- var _this$otherParams;
528
- var dynamicBucket = Number((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.timelineBucketMinutes);
529
+ var _this$otherParams2;
530
+ var dynamicBucket = Number((_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.timelineBucketMinutes);
529
531
  if (!Number.isFinite(dynamicBucket) || dynamicBucket <= 0) return this.defaultTimelineBucketMinutes;
530
532
  return Math.floor(dynamicBucket);
531
533
  }
@@ -1,46 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "BUY_X_GET_Y_FREE_STRATEGY", {
7
- enumerable: true,
8
- get: function () {
9
- return _examples.BUY_X_GET_Y_FREE_STRATEGY;
10
- }
11
- });
12
- Object.defineProperty(exports, "ITEM_REWARD_STRATEGY", {
13
- enumerable: true,
14
- get: function () {
15
- return _examples.ITEM_REWARD_STRATEGY;
16
- }
17
- });
18
- Object.defineProperty(exports, "PromotionAdapter", {
19
- enumerable: true,
20
- get: function () {
21
- return _adapter.PromotionAdapter;
22
- }
23
- });
24
- Object.defineProperty(exports, "PromotionEvaluator", {
25
- enumerable: true,
26
- get: function () {
27
- return _evaluator.PromotionEvaluator;
28
- }
29
- });
30
- Object.defineProperty(exports, "X_ITEMS_FOR_Y_PRICE_STRATEGY", {
31
- enumerable: true,
32
- get: function () {
33
- return _examples.X_ITEMS_FOR_Y_PRICE_STRATEGY;
34
- }
35
- });
36
- Object.defineProperty(exports, "default", {
37
- enumerable: true,
38
- get: function () {
39
- return _adapter.default;
40
- }
41
- });
42
- var _evaluator = require("./evaluator");
43
- var _adapter = _interopRequireWildcard(require("./adapter"));
44
- var _examples = require("./examples");
45
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
46
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
1
+ "use strict";
@@ -28,6 +28,7 @@ export declare class OpenDataModule extends BaseModule implements Module {
28
28
  * openDataModule.updateOtherParams({ openCache: true, cacheId: 'cache-2' })
29
29
  */
30
30
  updateOtherParams(params: Record<string, any>): void;
31
+ private shouldSkipInvoiceTemplateDocument;
31
32
  fetchOpenData(params: OpenDataFetchParams): Promise<OpenDataConfig>;
32
33
  getOpenData(): OpenDataConfig | null;
33
34
  getInvoiceLayoutConfig(): InvoiceLayoutConfig;
@@ -152,6 +152,9 @@ class OpenDataModule extends _BaseModule.BaseModule {
152
152
  this.cacheId = this.otherParams.cacheId;
153
153
  this.fatherModule = this.otherParams.fatherModule;
154
154
  }
155
+ shouldSkipInvoiceTemplateDocument() {
156
+ return String(this.otherParams?.platform || '').trim().toLowerCase() === 'h5';
157
+ }
155
158
  async fetchOpenData(params) {
156
159
  const fetchRevision = ++this.fetchRevision;
157
160
  const getData = this.appPlugin?.getData?.();
@@ -190,6 +193,9 @@ class OpenDataModule extends _BaseModule.BaseModule {
190
193
  return (0, _utils.normalizeInvoiceLayoutFromTemplateSettings)(this.getInvoiceTemplateSettings());
191
194
  }
192
195
  getInvoiceTemplateSettings() {
196
+ if (this.shouldSkipInvoiceTemplateDocument()) {
197
+ return (0, _utils.getDefaultInvoiceTemplateSettings)();
198
+ }
193
199
  if (isRecord(this.store.invoiceTemplateSettings)) {
194
200
  const documentId = resolveInvoiceDocumentId(this.store.data?.['documents.invoice_template']);
195
201
  if (documentId) {
@@ -226,6 +232,13 @@ class OpenDataModule extends _BaseModule.BaseModule {
226
232
  this.store.invoiceTemplateCacheKey = resolved.cacheKey;
227
233
  }
228
234
  async resolveInvoiceTemplateSettings(config, target) {
235
+ if (this.shouldSkipInvoiceTemplateDocument()) {
236
+ return {
237
+ settings: (0, _utils.getDefaultInvoiceTemplateSettings)(),
238
+ documentId: null,
239
+ cacheKey: null
240
+ };
241
+ }
229
242
  const rawTemplate = config['documents.invoice_template'];
230
243
  const documentId = resolveInvoiceDocumentId(rawTemplate);
231
244
  if (!documentId) {
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
326
326
  date: string;
327
327
  status: string;
328
328
  week: string;
329
- weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
329
+ weekNum: 0 | 1 | 2 | 5 | 4 | 3 | 6;
330
330
  }[]>;
331
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
332
332
  private getScheduleDataByIds;
@@ -345,7 +345,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
345
345
  count: number;
346
346
  left: number;
347
347
  summaryCount: number;
348
- status: "sold_out" | "lots_of_space" | "filling_up_fast";
348
+ status: "lots_of_space" | "filling_up_fast" | "sold_out";
349
349
  }[];
350
350
  /**
351
351
  * 找到多个资源的公共可用时间段
@@ -339,7 +339,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
339
339
  * 获取当前的客户搜索条件
340
340
  * @returns 当前搜索条件
341
341
  */
342
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
342
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
343
343
  /**
344
344
  * 获取客户列表状态(包含滚动加载相关状态)
345
345
  * @returns 客户状态
@@ -94,7 +94,8 @@ class SalesImpl extends _BaseModule.BaseModule {
94
94
  initialState: {},
95
95
  otherParams: {
96
96
  fatherModule: this.name,
97
- openCache: false
97
+ openCache: false,
98
+ platform: this.otherParams?.platform
98
99
  }
99
100
  });
100
101
  await this.core.effects.emit(`${this.name}:onInited`, {});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "0.10.22",
4
+ "version": "0.10.23",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",