@pisell/pisellos 0.10.32 → 0.10.34
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.
- package/dist/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/modules/OpenData/index.d.ts +1 -1
- package/dist/modules/OpenData/index.js +19 -11
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/server/utils/small-ticket.d.ts +5 -1
- package/dist/server/utils/small-ticket.js +146 -81
- package/dist/solution/BookingTicket/index.d.ts +6 -0
- package/dist/solution/BookingTicket/index.js +548 -485
- package/lib/modules/OpenData/index.d.ts +1 -1
- package/lib/modules/OpenData/index.js +9 -1
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/server/utils/small-ticket.d.ts +5 -1
- package/lib/server/utils/small-ticket.js +78 -18
- package/lib/solution/BookingTicket/index.d.ts +6 -0
- package/lib/solution/BookingTicket/index.js +32 -3
- package/package.json +1 -1
|
@@ -1,9 +0,0 @@
|
|
|
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";
|
|
@@ -33,7 +33,7 @@ export declare class OpenDataModule extends BaseModule implements Module {
|
|
|
33
33
|
getOpenData(): OpenDataConfig | null;
|
|
34
34
|
getInvoiceLayoutConfig(): InvoiceLayoutConfig;
|
|
35
35
|
getInvoiceTemplateSettings(): InvoiceTemplateSettings;
|
|
36
|
-
ensureInvoiceTemplateSettings(target: string): Promise<InvoiceTemplateSettings>;
|
|
36
|
+
ensureInvoiceTemplateSettings(target: string, openDataConfig?: OpenDataConfig): Promise<InvoiceTemplateSettings>;
|
|
37
37
|
private commitInvoiceTemplateSettings;
|
|
38
38
|
private resolveInvoiceTemplateSettings;
|
|
39
39
|
private buildInvoiceTemplateCacheKey;
|
|
@@ -233,39 +233,47 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
233
233
|
}, {
|
|
234
234
|
key: "ensureInvoiceTemplateSettings",
|
|
235
235
|
value: function () {
|
|
236
|
-
var _ensureInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(target) {
|
|
236
|
+
var _ensureInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(target, openDataConfig) {
|
|
237
237
|
var normalizedTarget, config, fetchRevision, resolved;
|
|
238
238
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
239
239
|
while (1) switch (_context3.prev = _context3.next) {
|
|
240
240
|
case 0:
|
|
241
241
|
normalizedTarget = String(target || '').trim();
|
|
242
|
+
if (openDataConfig && openDataConfig !== this.store.data) {
|
|
243
|
+
// 部分解决方案会在初始化参数中直接收到已经拉取完成的 OpenData。
|
|
244
|
+
// 将它纳入模块状态后再解析 Document,避免为了 Invoice 重复请求 setting,
|
|
245
|
+
// 同时让后续同步 getter 能校验同一份 document id 与 target。
|
|
246
|
+
this.fetchRevision += 1;
|
|
247
|
+
this.store.data = openDataConfig;
|
|
248
|
+
this.store.lastFetchedAt = Date.now();
|
|
249
|
+
}
|
|
242
250
|
config = this.store.data;
|
|
243
251
|
if (!(!normalizedTarget || !config)) {
|
|
244
|
-
_context3.next =
|
|
252
|
+
_context3.next = 5;
|
|
245
253
|
break;
|
|
246
254
|
}
|
|
247
255
|
return _context3.abrupt("return", getDefaultInvoiceTemplateSettings());
|
|
248
|
-
case
|
|
256
|
+
case 5:
|
|
249
257
|
fetchRevision = this.fetchRevision;
|
|
250
|
-
_context3.next =
|
|
258
|
+
_context3.next = 8;
|
|
251
259
|
return this.resolveInvoiceTemplateSettings(config, normalizedTarget);
|
|
252
|
-
case
|
|
260
|
+
case 8:
|
|
253
261
|
resolved = _context3.sent;
|
|
254
262
|
if (!(fetchRevision !== this.fetchRevision || this.store.data !== config)) {
|
|
255
|
-
_context3.next =
|
|
263
|
+
_context3.next = 11;
|
|
256
264
|
break;
|
|
257
265
|
}
|
|
258
266
|
return _context3.abrupt("return", getDefaultInvoiceTemplateSettings());
|
|
259
|
-
case
|
|
267
|
+
case 11:
|
|
260
268
|
this.commitInvoiceTemplateSettings(normalizedTarget, resolved);
|
|
261
269
|
return _context3.abrupt("return", normalizeRawInvoiceTemplateSettings(resolved.settings));
|
|
262
|
-
case
|
|
270
|
+
case 13:
|
|
263
271
|
case "end":
|
|
264
272
|
return _context3.stop();
|
|
265
273
|
}
|
|
266
274
|
}, _callee3, this);
|
|
267
275
|
}));
|
|
268
|
-
function ensureInvoiceTemplateSettings(_x4) {
|
|
276
|
+
function ensureInvoiceTemplateSettings(_x4, _x5) {
|
|
269
277
|
return _ensureInvoiceTemplateSettings.apply(this, arguments);
|
|
270
278
|
}
|
|
271
279
|
return ensureInvoiceTemplateSettings;
|
|
@@ -367,7 +375,7 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
367
375
|
}
|
|
368
376
|
}, _callee4, this);
|
|
369
377
|
}));
|
|
370
|
-
function resolveInvoiceTemplateSettings(
|
|
378
|
+
function resolveInvoiceTemplateSettings(_x6, _x7) {
|
|
371
379
|
return _resolveInvoiceTemplateSettings.apply(this, arguments);
|
|
372
380
|
}
|
|
373
381
|
return resolveInvoiceTemplateSettings;
|
|
@@ -424,7 +432,7 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
424
432
|
}
|
|
425
433
|
}, _callee5, this);
|
|
426
434
|
}));
|
|
427
|
-
function fetchInvoiceTemplateDocument(
|
|
435
|
+
function fetchInvoiceTemplateDocument(_x8) {
|
|
428
436
|
return _fetchInvoiceTemplateDocument.apply(this, arguments);
|
|
429
437
|
}
|
|
430
438
|
return fetchInvoiceTemplateDocument;
|
|
@@ -535,7 +535,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
535
535
|
generateIdempotencyToken(): string;
|
|
536
536
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
537
537
|
createOrder(params: CommitOrderParams['query']): {
|
|
538
|
-
type: "
|
|
538
|
+
type: "virtual" | "appointment_booking";
|
|
539
539
|
platform: string;
|
|
540
540
|
sales_channel: string;
|
|
541
541
|
order_sales_channel: string;
|
|
@@ -33,9 +33,12 @@ export interface SmallTicketProduct {
|
|
|
33
33
|
product_title: string;
|
|
34
34
|
product_quantity: number;
|
|
35
35
|
selling_price: string;
|
|
36
|
+
total_selling_price: string;
|
|
36
37
|
original_price: string;
|
|
37
|
-
base_price
|
|
38
|
+
base_price: string;
|
|
38
39
|
total_original_price: string;
|
|
40
|
+
options_total_price?: string;
|
|
41
|
+
package_items_total_price?: string;
|
|
39
42
|
extension_list: any[];
|
|
40
43
|
product_uid?: string | number;
|
|
41
44
|
booking_uid?: string | number;
|
|
@@ -44,6 +47,7 @@ export interface SmallTicketProduct {
|
|
|
44
47
|
name: string;
|
|
45
48
|
num?: number;
|
|
46
49
|
price?: string;
|
|
50
|
+
total_price: string;
|
|
47
51
|
value?: string;
|
|
48
52
|
}>;
|
|
49
53
|
variant?: string;
|