@pisell/pisellos 0.10.31 → 0.10.33
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/modules/OpenData/index.d.ts +1 -1
- package/dist/modules/OpenData/index.js +19 -11
- package/dist/modules/Order/index.d.ts +2 -1
- package/dist/modules/Order/index.js +18 -3
- package/dist/server/index.js +4 -5
- package/dist/server/utils/small-ticket.d.ts +5 -1
- package/dist/server/utils/small-ticket.js +180 -101
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +6 -0
- package/dist/solution/BookingTicket/index.js +548 -485
- package/dist/utils/os-private-payload.d.ts +5 -0
- package/dist/utils/os-private-payload.js +17 -0
- package/lib/modules/OpenData/index.d.ts +1 -1
- package/lib/modules/OpenData/index.js +9 -1
- package/lib/modules/Order/index.d.ts +2 -1
- package/lib/modules/Order/index.js +12 -1
- package/lib/server/index.js +4 -5
- package/lib/server/utils/small-ticket.d.ts +5 -1
- package/lib/server/utils/small-ticket.js +107 -34
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +6 -0
- package/lib/solution/BookingTicket/index.js +32 -3
- package/lib/utils/os-private-payload.d.ts +5 -0
- package/lib/utils/os-private-payload.js +22 -0
- package/package.json +1 -1
|
@@ -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;
|
|
@@ -566,6 +566,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
566
566
|
*/
|
|
567
567
|
createOrderByCheckout(params: CheckoutOrderParams): Promise<any>;
|
|
568
568
|
submitSalesOrder<T = any>(params: SubmitSalesOrderParams): Promise<T>;
|
|
569
|
+
private isSalesCheckoutHandledByOsServer;
|
|
569
570
|
/**
|
|
570
571
|
* 发送支付链接邮件。
|
|
571
572
|
*
|
|
@@ -35,6 +35,7 @@ import { OrderHooks } from "./types";
|
|
|
35
35
|
import { composeLinePrice, generateDuration, getAllDiscountList, mergeRelationForms, ensureCartItemOriginHolder, buildSubmitPayload, createDefaultTempOrder, createDefaultOrderRulesHooks, createEmptySummary, createUuidV4, formatDateTime, isTempOrder, normalizeOrderMetaList, normalizeBookingIsAll, normalizeBookingSubType, mapPaymentItemsToOrderPayments, normalizeOrderProductDiscountList, resolveEffectivePerUnitDiscount, ensureProductSku, getProductSkuOptions, normalizeProductSkuOptions, sumOptionUnitPrice, clearTempOrderHolderAssignments, getOrderProductLineUid, indexOrderProductsByUid, calculateOrderProductsDeposit, buildPointCardSnapshotFromWalletPassList, mergeOrderProductDisplayFields, resolveIsFormSubject, isMarkdownBundle } from "./utils";
|
|
36
36
|
import { isNormalProduct } from "../Product/utils";
|
|
37
37
|
import dayjs from 'dayjs';
|
|
38
|
+
import { stripOsPrivatePayloadFields } from "../../utils/os-private-payload";
|
|
38
39
|
import { ensureOrderPaymentNumber, mergeOrderPaymentRecord, resolveOrderPaymentIdentity } from "./payment-utils";
|
|
39
40
|
import { resolvePaymentNumberDevicePrefix, resolvePaymentNumberDevicePrefixFromDeviceId } from "../../utils/payment-number";
|
|
40
41
|
import { processCartPromotion, appendPromotionTags as _appendPromotionTags, getOrderProductUid as getPromotionUid, PRODUCT_LINE_MERGE_DISABLED_METADATA_KEY } from "../../solution/BaseSales/utils/cartPromotion";
|
|
@@ -6283,17 +6284,18 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6283
6284
|
key: "submitSalesOrder",
|
|
6284
6285
|
value: function () {
|
|
6285
6286
|
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(params) {
|
|
6286
|
-
var url, query, fetchUrl;
|
|
6287
|
+
var url, query, fetchUrl, requestQuery;
|
|
6287
6288
|
return _regeneratorRuntime().wrap(function _callee40$(_context43) {
|
|
6288
6289
|
while (1) switch (_context43.prev = _context43.next) {
|
|
6289
6290
|
case 0:
|
|
6290
6291
|
url = params.url, query = params.query;
|
|
6291
6292
|
fetchUrl = url || '/order/sales/checkout';
|
|
6292
|
-
|
|
6293
|
+
requestQuery = this.isSalesCheckoutHandledByOsServer(fetchUrl) ? query : stripOsPrivatePayloadFields(query);
|
|
6294
|
+
return _context43.abrupt("return", this.request.post(fetchUrl, requestQuery, {
|
|
6293
6295
|
osServer: true,
|
|
6294
6296
|
customToast: function customToast() {}
|
|
6295
6297
|
}));
|
|
6296
|
-
case
|
|
6298
|
+
case 4:
|
|
6297
6299
|
case "end":
|
|
6298
6300
|
return _context43.stop();
|
|
6299
6301
|
}
|
|
@@ -6304,6 +6306,19 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6304
6306
|
}
|
|
6305
6307
|
return submitSalesOrder;
|
|
6306
6308
|
}()
|
|
6309
|
+
}, {
|
|
6310
|
+
key: "isSalesCheckoutHandledByOsServer",
|
|
6311
|
+
value: function isSalesCheckoutHandledByOsServer(fetchUrl) {
|
|
6312
|
+
var _this$core2, _this$request;
|
|
6313
|
+
var server = (_this$core2 = this.core) === null || _this$core2 === void 0 ? void 0 : _this$core2.server;
|
|
6314
|
+
if (!server || typeof server.hasRoute !== 'function') return false;
|
|
6315
|
+
var requestBaseUrl = String(((_this$request = this.request) === null || _this$request === void 0 ? void 0 : _this$request.baseUrl) || '/shop').replace(/\/+$/, '');
|
|
6316
|
+
if (!requestBaseUrl.startsWith('/')) return false;
|
|
6317
|
+
var normalizedFetchUrl = fetchUrl.startsWith('/') ? fetchUrl : "/".concat(fetchUrl);
|
|
6318
|
+
var routePath = normalizedFetchUrl === requestBaseUrl || normalizedFetchUrl.startsWith("".concat(requestBaseUrl, "/")) ? normalizedFetchUrl : "".concat(requestBaseUrl).concat(normalizedFetchUrl);
|
|
6319
|
+
return server.hasRoute('post', routePath) === true;
|
|
6320
|
+
}
|
|
6321
|
+
|
|
6307
6322
|
/**
|
|
6308
6323
|
* 发送支付链接邮件。
|
|
6309
6324
|
*
|
package/dist/server/index.js
CHANGED
|
@@ -44,6 +44,7 @@ import { buildSmallTicketData, hasSmallTicketData } from "./utils/small-ticket";
|
|
|
44
44
|
import { BaseSalesImpl } from "../solution/BaseSales";
|
|
45
45
|
import { getOrderPaymentIdentityKeys, isIdentifiedPendingOrderPayment, isPendingOrderPayment, mergeOrderPaymentListsByIdentity } from "../modules/Order/payment-utils";
|
|
46
46
|
import { normalizeOrderCollections } from "../modules/Order/utils/orderCollectionIdentity";
|
|
47
|
+
import { stripOsPrivatePayloadFields } from "../utils/os-private-payload";
|
|
47
48
|
import { getDefaultInvoiceLayoutConfig, getDefaultInvoiceTemplateSettings, normalizeRawInvoiceTemplateSettings, resolveInvoiceReceiptLocales } from "../modules/OpenData";
|
|
48
49
|
var OS_FULFILLMENT_REF_MODE_FIELD = '_os_fulfillment_ref_mode';
|
|
49
50
|
var OS_INVOICE_LAYOUT_CONFIG_FIELD = '_os_invoice_layout_config';
|
|
@@ -2573,7 +2574,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
2573
2574
|
return this.ensureCheckoutOrderNumbers(normalizedData, title);
|
|
2574
2575
|
case 6:
|
|
2575
2576
|
numberedData = _context32.sent;
|
|
2576
|
-
checkoutData = this.normalizeCheckoutCollections(this.applyCheckoutFulfillmentBuzzer(numberedData, title));
|
|
2577
|
+
checkoutData = this.normalizeCheckoutCollections(stripOsPrivatePayloadFields(this.applyCheckoutFulfillmentBuzzer(numberedData, title)));
|
|
2577
2578
|
remoteCheckoutData = this.buildRemoteCheckoutData(checkoutData, title);
|
|
2578
2579
|
_context32.next = 11;
|
|
2579
2580
|
return this.buildCheckoutDeviceHeaders(title);
|
|
@@ -2675,11 +2676,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
2675
2676
|
}, {
|
|
2676
2677
|
key: "buildRemoteCheckoutData",
|
|
2677
2678
|
value: function buildRemoteCheckoutData(data, title) {
|
|
2678
|
-
var next =
|
|
2679
|
+
var next = stripOsPrivatePayloadFields(this.omitCheckoutSyncMode(data));
|
|
2679
2680
|
if (!next || _typeof(next) !== 'object') return next;
|
|
2680
2681
|
var record = next;
|
|
2681
|
-
delete record[OS_FULFILLMENT_REF_MODE_FIELD];
|
|
2682
|
-
delete record[OS_INVOICE_LAYOUT_CONFIG_FIELD];
|
|
2683
2682
|
this.applyKioskCheckoutOperator(record);
|
|
2684
2683
|
if (!Array.isArray(record.payments)) return next;
|
|
2685
2684
|
var originalPayments = record.payments;
|
|
@@ -6372,7 +6371,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6372
6371
|
return this.ensureCheckoutOrderNumbers(normalizedData, title);
|
|
6373
6372
|
case 14:
|
|
6374
6373
|
numberedData = _context62.sent;
|
|
6375
|
-
checkoutData = this.normalizeCheckoutCollections(this.applyCheckoutFulfillmentBuzzer(numberedData, title));
|
|
6374
|
+
checkoutData = this.normalizeCheckoutCollections(stripOsPrivatePayloadFields(this.applyCheckoutFulfillmentBuzzer(numberedData, title)));
|
|
6376
6375
|
_context62.next = 18;
|
|
6377
6376
|
return this.handlePendingSyncCheckoutOrder({
|
|
6378
6377
|
backendPath: backendPath,
|
|
@@ -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;
|