@pisell/pisellos 0.10.75 → 0.10.76
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/Product/index.d.ts +1 -1
- package/dist/server/index.js +14 -9
- package/dist/shared/receipt/small-ticket.d.ts +3 -0
- package/dist/shared/receipt/small-ticket.js +23 -2
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/BookingTicket/index.d.ts +13 -1
- package/dist/solution/OrderInvoicePreview/index.js +13 -8
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/server/index.js +5 -0
- package/lib/shared/receipt/small-ticket.d.ts +3 -0
- package/lib/shared/receipt/small-ticket.js +21 -0
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/BookingTicket/index.d.ts +13 -1
- package/lib/solution/OrderInvoicePreview/index.js +6 -1
- package/package.json +1 -1
- package/dist/apis/picoding.d.ts +0 -0
- package/dist/effects/index.d.ts +0 -19
- package/dist/model/strategy/adapter/dataVariant/adapter.d.ts +0 -50
- package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +0 -105
- package/dist/model/strategy/adapter/dataVariant/examples.d.ts +0 -39
- package/dist/model/strategy/adapter/dataVariant/index.d.ts +0 -4
- package/dist/model/strategy/adapter/dataVariant/type.d.ts +0 -173
- package/dist/model/strategy/adapter/promotion/adapter.d.ts +0 -70
- package/dist/model/strategy/adapter/promotion/examples.d.ts +0 -224
- package/dist/model/strategy/adapter/promotion/type.d.ts +0 -535
- package/dist/model/strategy/adapter/type.d.ts +0 -28
- package/dist/model/strategy/adapter/walletPass/index.d.ts +0 -32
- package/dist/model/strategy/adapter/walletPass/locales.d.ts +0 -1
- package/dist/model/strategy/adapter/walletPass/type.d.ts +0 -192
- package/dist/model/strategy/adapter/walletPass/utils.d.ts +0 -50
- package/dist/model/strategy/engine.d.ts +0 -119
- package/dist/model/strategy/type.d.ts +0 -245
- package/dist/modules/Account/types.d.ts +0 -56
- package/dist/modules/BookingContext/types.d.ts +0 -104
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -76
- package/dist/modules/BookingContext/utils/flexible.d.ts +0 -28
- package/dist/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
- package/dist/modules/BookingContext/utils/noResource.d.ts +0 -13
- package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts +0 -1
- package/dist/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
- package/dist/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
- package/dist/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
- package/dist/modules/BookingContext/utils/timeSlices.d.ts +0 -42
- package/dist/modules/Customer/constants.d.ts +0 -7
- package/dist/modules/Date/types.d.ts +0 -84
- package/dist/modules/Date/utils.d.ts +0 -36
- package/dist/modules/FulfillmentTiming/index.d.ts +0 -11
- package/dist/modules/FulfillmentTiming/types.d.ts +0 -67
- package/dist/modules/Order/payment-utils.d.ts +0 -26
- package/dist/modules/Order/pickupTiming.d.ts +0 -46
- package/dist/modules/Order/utils/manualProductDiscount.d.ts +0 -106
- package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +0 -68
- package/dist/modules/Order/utils/weighedProduct.d.ts +0 -12
- package/dist/modules/Payment/cashRecommendationAlgorithm.d.ts +0 -21
- package/dist/modules/Payment/mx51.d.ts +0 -0
- package/dist/modules/Payment/types.d.ts +0 -943
- package/dist/modules/Payment/utils.d.ts +0 -19
- package/dist/modules/Quotation/types.d.ts +0 -61
- package/dist/modules/Resource/types.d.ts +0 -50
- package/dist/modules/Resource/utils.d.ts +0 -23
- package/dist/modules/ResourcePlanner/localClock.d.ts +0 -33
- package/dist/modules/SalesSummary/types.d.ts +0 -69
- package/dist/modules/ScanOrderLogger/providers/feishu.d.ts +0 -2
- package/dist/modules/ScanOrderLogger/providers/grafana.d.ts +0 -2
- package/dist/modules/ScanOrderLogger/types.d.ts +0 -53
- package/dist/modules/Schedule/getDateIsInSchedule.d.ts +0 -32
- package/dist/modules/Schedule/type.d.ts +0 -157
- package/dist/modules/Schedule/types.d.ts +0 -201
- package/dist/modules/Schedule/utils.d.ts +0 -67
- package/dist/modules/Step/tyeps.d.ts +0 -20
- package/dist/modules/SurchargeList/types.d.ts +0 -15
- package/dist/plugins/app.d.ts +0 -10
- package/dist/plugins/shopStore.d.ts +0 -4
- package/dist/plugins/user.d.ts +0 -7
- package/dist/server/modules/floor-plan/types.d.ts +0 -43
- package/dist/server/modules/menu/types.d.ts +0 -68
- package/dist/server/modules/payment/types.d.ts +0 -9
- package/dist/server/modules/quotation/types.d.ts +0 -50
- package/dist/server/modules/resource/types.d.ts +0 -121
- package/dist/server/modules/schedule/types.d.ts +0 -1
- package/dist/server/modules/schedule/utils.d.ts +0 -32
- package/dist/server/types.d.ts +0 -66
- package/dist/server/utils/index.d.ts +0 -5
- package/dist/server/utils/schedule.d.ts +0 -14
- package/dist/server/utils/time.d.ts +0 -18
- package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +0 -77
- package/dist/solution/BookingTicket/utils/exampleData.d.ts +0 -123
- package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +0 -185
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +0 -38
- package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts +0 -78
- package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts +0 -21
- package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +0 -5
- package/dist/solution/PlaceOrder/index.d.ts +0 -0
- package/dist/solution/RegisterAndLogin/config.d.ts +0 -93
- package/dist/solution/RegisterAndLogin/types.d.ts +0 -445
- package/dist/solution/RegisterAndLogin/utils.d.ts +0 -103
- package/dist/store/createStore.d.ts +0 -3
- package/dist/types/index.d.ts +0 -132
- package/dist/utils/os-private-payload.d.ts +0 -5
- package/dist/utils/payment-number.d.ts +0 -9
- package/dist/utils/task.d.ts +0 -40
- package/dist/utils/watch.d.ts +0 -102
- package/lib/apis/picoding.d.ts +0 -0
- package/lib/effects/index.d.ts +0 -19
- package/lib/model/strategy/adapter/dataVariant/adapter.d.ts +0 -50
- package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +0 -105
- package/lib/model/strategy/adapter/dataVariant/examples.d.ts +0 -39
- package/lib/model/strategy/adapter/dataVariant/index.d.ts +0 -4
- package/lib/model/strategy/adapter/dataVariant/type.d.ts +0 -173
- package/lib/model/strategy/adapter/promotion/adapter.d.ts +0 -70
- package/lib/model/strategy/adapter/promotion/examples.d.ts +0 -224
- package/lib/model/strategy/adapter/promotion/type.d.ts +0 -535
- package/lib/model/strategy/adapter/type.d.ts +0 -28
- package/lib/model/strategy/adapter/walletPass/index.d.ts +0 -32
- package/lib/model/strategy/adapter/walletPass/locales.d.ts +0 -1
- package/lib/model/strategy/adapter/walletPass/type.d.ts +0 -192
- package/lib/model/strategy/adapter/walletPass/utils.d.ts +0 -50
- package/lib/model/strategy/engine.d.ts +0 -119
- package/lib/model/strategy/type.d.ts +0 -245
- package/lib/modules/Account/types.d.ts +0 -56
- package/lib/modules/BookingContext/types.d.ts +0 -104
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -76
- package/lib/modules/BookingContext/utils/flexible.d.ts +0 -28
- package/lib/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
- package/lib/modules/BookingContext/utils/noResource.d.ts +0 -13
- package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +0 -1
- package/lib/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
- package/lib/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
- package/lib/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
- package/lib/modules/BookingContext/utils/timeSlices.d.ts +0 -42
- package/lib/modules/Customer/constants.d.ts +0 -7
- package/lib/modules/Date/types.d.ts +0 -84
- package/lib/modules/Date/utils.d.ts +0 -36
- package/lib/modules/FulfillmentTiming/index.d.ts +0 -11
- package/lib/modules/FulfillmentTiming/types.d.ts +0 -67
- package/lib/modules/Order/payment-utils.d.ts +0 -26
- package/lib/modules/Order/pickupTiming.d.ts +0 -46
- package/lib/modules/Order/utils/manualProductDiscount.d.ts +0 -106
- package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +0 -68
- package/lib/modules/Order/utils/weighedProduct.d.ts +0 -12
- package/lib/modules/Payment/cashRecommendationAlgorithm.d.ts +0 -21
- package/lib/modules/Payment/mx51.d.ts +0 -0
- package/lib/modules/Payment/types.d.ts +0 -943
- package/lib/modules/Payment/utils.d.ts +0 -19
- package/lib/modules/Quotation/types.d.ts +0 -61
- package/lib/modules/Resource/types.d.ts +0 -50
- package/lib/modules/Resource/utils.d.ts +0 -23
- package/lib/modules/ResourcePlanner/localClock.d.ts +0 -33
- package/lib/modules/SalesSummary/types.d.ts +0 -69
- package/lib/modules/ScanOrderLogger/providers/feishu.d.ts +0 -2
- package/lib/modules/ScanOrderLogger/providers/grafana.d.ts +0 -2
- package/lib/modules/ScanOrderLogger/types.d.ts +0 -53
- package/lib/modules/Schedule/getDateIsInSchedule.d.ts +0 -32
- package/lib/modules/Schedule/type.d.ts +0 -157
- package/lib/modules/Schedule/types.d.ts +0 -201
- package/lib/modules/Schedule/utils.d.ts +0 -67
- package/lib/modules/Step/tyeps.d.ts +0 -20
- package/lib/modules/SurchargeList/types.d.ts +0 -15
- package/lib/plugins/app.d.ts +0 -10
- package/lib/plugins/shopStore.d.ts +0 -4
- package/lib/plugins/user.d.ts +0 -7
- package/lib/server/modules/floor-plan/types.d.ts +0 -43
- package/lib/server/modules/menu/types.d.ts +0 -68
- package/lib/server/modules/payment/types.d.ts +0 -9
- package/lib/server/modules/quotation/types.d.ts +0 -50
- package/lib/server/modules/resource/types.d.ts +0 -121
- package/lib/server/modules/schedule/types.d.ts +0 -1
- package/lib/server/modules/schedule/utils.d.ts +0 -32
- package/lib/server/types.d.ts +0 -66
- package/lib/server/utils/index.d.ts +0 -5
- package/lib/server/utils/schedule.d.ts +0 -14
- package/lib/server/utils/time.d.ts +0 -18
- package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +0 -77
- package/lib/solution/BookingTicket/utils/exampleData.d.ts +0 -123
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +0 -185
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +0 -38
- package/lib/solution/BookingTicket/utils/scan/scanCache.d.ts +0 -78
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.d.ts +0 -21
- package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +0 -5
- package/lib/solution/PlaceOrder/index.d.ts +0 -0
- package/lib/solution/RegisterAndLogin/config.d.ts +0 -93
- package/lib/solution/RegisterAndLogin/types.d.ts +0 -445
- package/lib/solution/RegisterAndLogin/utils.d.ts +0 -103
- package/lib/store/createStore.d.ts +0 -3
- package/lib/types/index.d.ts +0 -132
- package/lib/utils/os-private-payload.d.ts +0 -5
- package/lib/utils/payment-number.d.ts +0 -9
- package/lib/utils/task.d.ts +0 -40
- package/lib/utils/watch.d.ts +0 -102
|
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
|
|
|
49
49
|
getCategories(): ProductCategory[];
|
|
50
50
|
setOtherParams(key: string, value: any): void;
|
|
51
51
|
getOtherParams(): any;
|
|
52
|
-
getProductType(): "
|
|
52
|
+
getProductType(): "normal" | "duration" | "session";
|
|
53
53
|
}
|
package/dist/server/index.js
CHANGED
|
@@ -5502,9 +5502,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
5502
5502
|
}, {
|
|
5503
5503
|
key: "getSmallTicketShopInfo",
|
|
5504
5504
|
value: function getSmallTicketShopInfo() {
|
|
5505
|
-
var _shopInfo$is_price_in;
|
|
5505
|
+
var _this$app15, _this$app15$getStore, _this$app15$getStore$, _this$app15$getStore$2, _this$app16, _this$app16$getStore, _this$app16$getStore$, _this$app16$getStore$2, _shopInfo$is_price_in;
|
|
5506
5506
|
var shopInfo = this.getAppData('shop_info') || {};
|
|
5507
|
+
// WebPOS getData does not expose core/default_domain; read the business
|
|
5508
|
+
// shop model directly when the expanded shop_info has not loaded it yet.
|
|
5509
|
+
var shopCore = ((_this$app15 = this.app) === null || _this$app15 === void 0 || (_this$app15 = _this$app15.models) === null || _this$app15 === void 0 || (_this$app15$getStore = _this$app15.getStore) === null || _this$app15$getStore === void 0 || (_this$app15$getStore$ = (_this$app15$getStore$2 = _this$app15$getStore.call(_this$app15)).getDataByModel) === null || _this$app15$getStore$ === void 0 ? void 0 : _this$app15$getStore$.call(_this$app15$getStore$2, 'core', 'core')) || ((_this$app16 = this.app) === null || _this$app16 === void 0 || (_this$app16 = _this$app16.data) === null || _this$app16 === void 0 || (_this$app16 = _this$app16.store) === null || _this$app16 === void 0 || (_this$app16$getStore = _this$app16.getStore) === null || _this$app16$getStore === void 0 || (_this$app16$getStore$ = (_this$app16$getStore$2 = _this$app16$getStore.call(_this$app16)).getDataByModel) === null || _this$app16$getStore$ === void 0 ? void 0 : _this$app16$getStore$.call(_this$app16$getStore$2, 'core', 'core')) || {};
|
|
5507
5510
|
return _objectSpread(_objectSpread({}, shopInfo), {}, {
|
|
5511
|
+
default_domain: shopInfo.default_domain || shopCore.default_domain,
|
|
5512
|
+
private_domain_protocol: shopInfo.private_domain_protocol || shopCore.private_domain_protocol,
|
|
5508
5513
|
currency_symbol: shopInfo.currency_symbol || this.getAppData('shop_symbol') || this.getAppData('currency_symbol'),
|
|
5509
5514
|
currency_code: shopInfo.currency_code || this.getAppData('shop_currency_code') || this.getAppData('currency_code'),
|
|
5510
5515
|
tax_title: shopInfo.tax_title || this.getAppData('tax_title'),
|
|
@@ -6514,13 +6519,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
6514
6519
|
key: "handleSyncCheckoutSubmit",
|
|
6515
6520
|
value: function () {
|
|
6516
6521
|
var _handleSyncCheckoutSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(params) {
|
|
6517
|
-
var _this$
|
|
6522
|
+
var _this$app17;
|
|
6518
6523
|
var backendPath, data, title, invoiceLayoutConfig, invoiceTemplateSettings, syncResult, _normalized$data, normalized, response, syncedOrder, backendError, _normalized$data2, _normalized, message;
|
|
6519
6524
|
return _regeneratorRuntime().wrap(function _callee63$(_context63) {
|
|
6520
6525
|
while (1) switch (_context63.prev = _context63.next) {
|
|
6521
6526
|
case 0:
|
|
6522
6527
|
backendPath = params.backendPath, data = params.data, title = params.title, invoiceLayoutConfig = params.invoiceLayoutConfig, invoiceTemplateSettings = params.invoiceTemplateSettings;
|
|
6523
|
-
if ((_this$
|
|
6528
|
+
if ((_this$app17 = this.app) !== null && _this$app17 !== void 0 && (_this$app17 = _this$app17.request) !== null && _this$app17 !== void 0 && _this$app17.post) {
|
|
6524
6529
|
_context63.next = 4;
|
|
6525
6530
|
break;
|
|
6526
6531
|
}
|
|
@@ -6878,9 +6883,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
6878
6883
|
}, {
|
|
6879
6884
|
key: "shouldAutoPrintCheckoutReceipt",
|
|
6880
6885
|
value: function shouldAutoPrintCheckoutReceipt() {
|
|
6881
|
-
var _this$core$context2, _this$core$context2$g, _this$
|
|
6886
|
+
var _this$core$context2, _this$core$context2$g, _this$app18, _this$app18$getStorag;
|
|
6882
6887
|
if (((_this$core$context2 = this.core.context) === null || _this$core$context2 === void 0 || (_this$core$context2$g = _this$core$context2.getPlatform) === null || _this$core$context2$g === void 0 ? void 0 : _this$core$context2$g.call(_this$core$context2)) !== 'android') return true;
|
|
6883
|
-
return ((_this$
|
|
6888
|
+
return ((_this$app18 = this.app) === null || _this$app18 === void 0 || (_this$app18 = _this$app18.storage) === null || _this$app18 === void 0 || (_this$app18$getStorag = _this$app18.getStorage) === null || _this$app18$getStorag === void 0 ? void 0 : _this$app18$getStorag.call(_this$app18, AUTO_PRINT_STORAGE_KEY)) !== 'false';
|
|
6884
6889
|
}
|
|
6885
6890
|
}, {
|
|
6886
6891
|
key: "shouldBuildSmallTicketData",
|
|
@@ -7504,7 +7509,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
7504
7509
|
key: "fetchAndPersistSalesOrderByLookup",
|
|
7505
7510
|
value: function () {
|
|
7506
7511
|
var _fetchAndPersistSalesOrderByLookup = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee73(lookup, data, title) {
|
|
7507
|
-
var _this$order5, _this$order6, _this$
|
|
7512
|
+
var _this$order5, _this$order6, _this$app19;
|
|
7508
7513
|
var backendPath, response, _response$code3, responseStatusCode, code, message, fresh, savedOrder, _errorRecord$response, backendError, errorRecord, _responseStatusCode, _ref78, _backendError$code2, backendStatusCode, _code, _message2, _message3;
|
|
7509
7514
|
return _regeneratorRuntime().wrap(function _callee73$(_context73) {
|
|
7510
7515
|
while (1) switch (_context73.prev = _context73.next) {
|
|
@@ -7520,7 +7525,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
7520
7525
|
order: null
|
|
7521
7526
|
});
|
|
7522
7527
|
case 3:
|
|
7523
|
-
if ((_this$
|
|
7528
|
+
if ((_this$app19 = this.app) !== null && _this$app19 !== void 0 && (_this$app19 = _this$app19.request) !== null && _this$app19 !== void 0 && _this$app19.get) {
|
|
7524
7529
|
_context73.next = 6;
|
|
7525
7530
|
break;
|
|
7526
7531
|
}
|
|
@@ -7720,7 +7725,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
7720
7725
|
key: "handleUpdateLocalOrdersBatch",
|
|
7721
7726
|
value: (function () {
|
|
7722
7727
|
var _handleUpdateLocalOrdersBatch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee74(orderIds) {
|
|
7723
|
-
var _this$
|
|
7728
|
+
var _this$app20;
|
|
7724
7729
|
var existedBefore, _iterator13, _step13, id, fetched, message, fetchedMap, _iterator14, _step14, order, oid, freshOrders, succeedIds, failed, _iterator15, _step15, _id, fresh, _message4, overwritten, inserted;
|
|
7725
7730
|
return _regeneratorRuntime().wrap(function _callee74$(_context74) {
|
|
7726
7731
|
while (1) switch (_context74.prev = _context74.next) {
|
|
@@ -7741,7 +7746,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
7741
7746
|
data: null
|
|
7742
7747
|
});
|
|
7743
7748
|
case 4:
|
|
7744
|
-
if ((_this$
|
|
7749
|
+
if ((_this$app20 = this.app) !== null && _this$app20 !== void 0 && _this$app20.request) {
|
|
7745
7750
|
_context74.next = 7;
|
|
7746
7751
|
break;
|
|
7747
7752
|
}
|
|
@@ -15,6 +15,9 @@ export interface SmallTicketShopInfo {
|
|
|
15
15
|
currency_code?: string;
|
|
16
16
|
primary_locale?: string;
|
|
17
17
|
timezone?: string;
|
|
18
|
+
/** Customer-facing shop domain, supplied by the host shop context. */
|
|
19
|
+
default_domain?: string;
|
|
20
|
+
private_domain_protocol?: string;
|
|
18
21
|
[key: string]: any;
|
|
19
22
|
}
|
|
20
23
|
export interface BuildSmallTicketDataParams {
|
|
@@ -403,10 +403,14 @@ function buildBaseData(params) {
|
|
|
403
403
|
currencySymbol = params.currencySymbol,
|
|
404
404
|
financials = params.financials;
|
|
405
405
|
var orderNumber = stringify(order.buzzer || order.shop_full_order_number);
|
|
406
|
-
|
|
406
|
+
var rewardClaim = buildRewardClaimUrl(shopInfo, order.shop_order_number);
|
|
407
|
+
return _objectSpread(_objectSpread({
|
|
407
408
|
shop_name: stringify(shopInfo.name || order.shop_name),
|
|
408
409
|
note: stringify(order.note),
|
|
409
|
-
shop_order_number: stringify(order.shop_order_number)
|
|
410
|
+
shop_order_number: stringify(order.shop_order_number)
|
|
411
|
+
}, rewardClaim ? {
|
|
412
|
+
reward_claim: rewardClaim
|
|
413
|
+
} : {}), {}, {
|
|
410
414
|
order_number: orderNumber,
|
|
411
415
|
shop_tax_number: stringify(shopInfo.tax_number || order.shop_tax_number),
|
|
412
416
|
shop_phone: stringify(shopInfo.phone || order.shop_phone),
|
|
@@ -424,6 +428,23 @@ function buildBaseData(params) {
|
|
|
424
428
|
updated_at: formatDateTime(order.updated_at, locale)
|
|
425
429
|
} : {});
|
|
426
430
|
}
|
|
431
|
+
function buildRewardClaimUrl(shopInfo, shopOrderNumber) {
|
|
432
|
+
var domain = typeof shopInfo.default_domain === 'string' ? shopInfo.default_domain.trim() : '';
|
|
433
|
+
var orderNumber = typeof shopOrderNumber === 'string' ? shopOrderNumber.trim() : typeof shopOrderNumber === 'number' && Number.isFinite(shopOrderNumber) ? String(shopOrderNumber) : '';
|
|
434
|
+
if (!domain || !orderNumber) return undefined;
|
|
435
|
+
try {
|
|
436
|
+
var protocol = shopInfo.private_domain_protocol === 'http' ? 'http' : 'https';
|
|
437
|
+
var base = new URL(/^[a-z][a-z\d+.-]*:\/\//i.test(domain) ? domain : "".concat(protocol, "://").concat(domain));
|
|
438
|
+
if (!['http:', 'https:'].includes(base.protocol) || base.username || base.password) {
|
|
439
|
+
return undefined;
|
|
440
|
+
}
|
|
441
|
+
var url = new URL('/claim-purchase-rewards', base);
|
|
442
|
+
url.searchParams.set('shop_order_number', orderNumber);
|
|
443
|
+
return url.toString();
|
|
444
|
+
} catch (_unused) {
|
|
445
|
+
return undefined;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
427
448
|
function buildProducts(order, locale, productMap) {
|
|
428
449
|
var products = Array.isArray(order.products) ? order.products : [];
|
|
429
450
|
var allergyByProductUid = buildProductAllergyMap(order, locale);
|
|
@@ -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 | 2 | 1 |
|
|
329
|
+
weekNum: 0 | 2 | 1 | 6 | 4 | 5 | 3;
|
|
330
330
|
}[]>;
|
|
331
331
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
332
332
|
private getScheduleDataByIds;
|
|
@@ -373,7 +373,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
373
373
|
};
|
|
374
374
|
setOtherData(key: string, value: any): void;
|
|
375
375
|
getOtherData(key: string): any;
|
|
376
|
-
getProductTypeById(id: number): Promise<"
|
|
376
|
+
getProductTypeById(id: number): Promise<"normal" | "duration" | "session">;
|
|
377
377
|
/**
|
|
378
378
|
* 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
|
|
379
379
|
*
|
|
@@ -479,7 +479,19 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
479
479
|
* 加车两阶段主决策(规格弹窗 / 资源编辑 / 直接加车)。
|
|
480
480
|
* 与 ticketBooking `handleSelectProduct` + `handleBooking4Service` 等价。
|
|
481
481
|
*/
|
|
482
|
-
decideAddProduct(item: any, options?: Partial<AddProductDecideContext>):
|
|
482
|
+
decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): {
|
|
483
|
+
action: "reloadCatalog";
|
|
484
|
+
} | {
|
|
485
|
+
action: "add";
|
|
486
|
+
cacheItem: any;
|
|
487
|
+
} | {
|
|
488
|
+
action: "requiresDetail";
|
|
489
|
+
payload: AddProductRequiresDetailPayload;
|
|
490
|
+
} | {
|
|
491
|
+
action: "requiresBookingEdit";
|
|
492
|
+
cacheItem: any;
|
|
493
|
+
payload: import("./utils/addProductDecision").AddProductRequiresBookingEditPayload;
|
|
494
|
+
};
|
|
483
495
|
/** 规格弹窗 callback 后的第二段决策。 */
|
|
484
496
|
decideAfterDetail(cacheItem: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
|
|
485
497
|
/**
|
|
@@ -187,8 +187,8 @@ export var OrderInvoicePreviewImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
187
187
|
error: null
|
|
188
188
|
});
|
|
189
189
|
var task = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
190
|
-
var
|
|
191
|
-
var _yield$Promise$all, _yield$Promise$all2, snapshot, context, template, source, getData, coreData, shop, languageOptions, remembered, selected, locale, result;
|
|
190
|
+
var _appPlugin$getData, _appPlugin$getApp, _hostApp$models, _hostApp$models$getSt, _hostApp$models$getSt2, _hostApp$models$getSt3, _hostApp$data, _hostApp$data$getStor, _hostApp$data$getStor2, _hostApp$data$getStor3, _coreData$core, _this3$languageSelect;
|
|
191
|
+
var _yield$Promise$all, _yield$Promise$all2, snapshot, context, template, source, appPlugin, getData, coreData, hostApp, shopCore, shop, languageOptions, remembered, selected, locale, result;
|
|
192
192
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
193
193
|
while (1) switch (_context.prev = _context.next) {
|
|
194
194
|
case 0:
|
|
@@ -201,23 +201,28 @@ export var OrderInvoicePreviewImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
201
201
|
context = _yield$Promise$all2[1];
|
|
202
202
|
template = _yield$Promise$all2[2];
|
|
203
203
|
source = withPaymentMethodNames(snapshot, context.methods);
|
|
204
|
-
|
|
204
|
+
appPlugin = _this3.core.getPlugin('app');
|
|
205
|
+
getData = appPlugin === null || appPlugin === void 0 || (_appPlugin$getData = appPlugin.getData) === null || _appPlugin$getData === void 0 ? void 0 : _appPlugin$getData.call(appPlugin);
|
|
205
206
|
if (!((getData === null || getData === void 0 ? void 0 : getData('shop_id')) != null && String(getData('shop_id')) !== String(input.shopId))) {
|
|
206
|
-
_context.next =
|
|
207
|
+
_context.next = 12;
|
|
207
208
|
break;
|
|
208
209
|
}
|
|
209
210
|
throw new Error('Invoice shop changed');
|
|
210
|
-
case
|
|
211
|
+
case 12:
|
|
211
212
|
coreData = getData === null || getData === void 0 ? void 0 : getData('core');
|
|
213
|
+
hostApp = appPlugin === null || appPlugin === void 0 || (_appPlugin$getApp = appPlugin.getApp) === null || _appPlugin$getApp === void 0 ? void 0 : _appPlugin$getApp.call(appPlugin);
|
|
214
|
+
shopCore = (hostApp === null || hostApp === void 0 || (_hostApp$models = hostApp.models) === null || _hostApp$models === void 0 || (_hostApp$models$getSt = _hostApp$models.getStore) === null || _hostApp$models$getSt === void 0 || (_hostApp$models$getSt2 = (_hostApp$models$getSt3 = _hostApp$models$getSt.call(_hostApp$models)).getDataByModel) === null || _hostApp$models$getSt2 === void 0 ? void 0 : _hostApp$models$getSt2.call(_hostApp$models$getSt3, 'core', 'core')) || (hostApp === null || hostApp === void 0 || (_hostApp$data = hostApp.data) === null || _hostApp$data === void 0 || (_hostApp$data = _hostApp$data.store) === null || _hostApp$data === void 0 || (_hostApp$data$getStor = _hostApp$data.getStore) === null || _hostApp$data$getStor === void 0 || (_hostApp$data$getStor2 = (_hostApp$data$getStor3 = _hostApp$data$getStor.call(_hostApp$data)).getDataByModel) === null || _hostApp$data$getStor2 === void 0 ? void 0 : _hostApp$data$getStor2.call(_hostApp$data$getStor3, 'core', 'core')) || (coreData === null || coreData === void 0 ? void 0 : coreData.core) || coreData || {};
|
|
212
215
|
shop = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, (coreData === null || coreData === void 0 || (_coreData$core = coreData.core) === null || _coreData$core === void 0 ? void 0 : _coreData$core.shop) || (coreData === null || coreData === void 0 ? void 0 : coreData.shop) || {}), (getData === null || getData === void 0 ? void 0 : getData('shop_info')) || {}), input.shop), context.shop), getData !== null && getData !== void 0 && getData('tax_country_code') ? {
|
|
213
216
|
tax_country_code: getData('tax_country_code')
|
|
214
217
|
} : {});
|
|
218
|
+
shop.default_domain || (shop.default_domain = shopCore.default_domain);
|
|
219
|
+
shop.private_domain_protocol || (shop.private_domain_protocol = shopCore.private_domain_protocol);
|
|
215
220
|
if (!(generation !== _this3.generation || _this3.disposed)) {
|
|
216
|
-
_context.next =
|
|
221
|
+
_context.next = 20;
|
|
217
222
|
break;
|
|
218
223
|
}
|
|
219
224
|
throw new Error('Invoice request superseded');
|
|
220
|
-
case
|
|
225
|
+
case 20:
|
|
221
226
|
languageOptions = resolveCustomerInvoiceLanguages(template.language, input.locale);
|
|
222
227
|
remembered = (_this3$languageSelect = _this3.languageSelection) === null || _this3$languageSelect === void 0 ? void 0 : _this3$languageSelect.code;
|
|
223
228
|
selected = languageOptions.find(function (option) {
|
|
@@ -254,7 +259,7 @@ export var OrderInvoicePreviewImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
254
259
|
error: null
|
|
255
260
|
});
|
|
256
261
|
return _context.abrupt("return", result);
|
|
257
|
-
case
|
|
262
|
+
case 27:
|
|
258
263
|
case "end":
|
|
259
264
|
return _context.stop();
|
|
260
265
|
}
|
|
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
|
|
|
49
49
|
getCategories(): ProductCategory[];
|
|
50
50
|
setOtherParams(key: string, value: any): void;
|
|
51
51
|
getOtherParams(): any;
|
|
52
|
-
getProductType(): "
|
|
52
|
+
getProductType(): "normal" | "duration" | "session";
|
|
53
53
|
}
|
package/lib/server/index.js
CHANGED
|
@@ -3405,8 +3405,13 @@ class Server {
|
|
|
3405
3405
|
}
|
|
3406
3406
|
getSmallTicketShopInfo() {
|
|
3407
3407
|
const shopInfo = this.getAppData('shop_info') || {};
|
|
3408
|
+
// WebPOS getData does not expose core/default_domain; read the business
|
|
3409
|
+
// shop model directly when the expanded shop_info has not loaded it yet.
|
|
3410
|
+
const shopCore = this.app?.models?.getStore?.().getDataByModel?.('core', 'core') || this.app?.data?.store?.getStore?.().getDataByModel?.('core', 'core') || {};
|
|
3408
3411
|
return {
|
|
3409
3412
|
...shopInfo,
|
|
3413
|
+
default_domain: shopInfo.default_domain || shopCore.default_domain,
|
|
3414
|
+
private_domain_protocol: shopInfo.private_domain_protocol || shopCore.private_domain_protocol,
|
|
3410
3415
|
currency_symbol: shopInfo.currency_symbol || this.getAppData('shop_symbol') || this.getAppData('currency_symbol'),
|
|
3411
3416
|
currency_code: shopInfo.currency_code || this.getAppData('shop_currency_code') || this.getAppData('currency_code'),
|
|
3412
3417
|
tax_title: shopInfo.tax_title || this.getAppData('tax_title'),
|
|
@@ -15,6 +15,9 @@ export interface SmallTicketShopInfo {
|
|
|
15
15
|
currency_code?: string;
|
|
16
16
|
primary_locale?: string;
|
|
17
17
|
timezone?: string;
|
|
18
|
+
/** Customer-facing shop domain, supplied by the host shop context. */
|
|
19
|
+
default_domain?: string;
|
|
20
|
+
private_domain_protocol?: string;
|
|
18
21
|
[key: string]: any;
|
|
19
22
|
}
|
|
20
23
|
export interface BuildSmallTicketDataParams {
|
|
@@ -387,10 +387,14 @@ function buildBaseData(params) {
|
|
|
387
387
|
financials
|
|
388
388
|
} = params;
|
|
389
389
|
const orderNumber = stringify(order.buzzer || order.shop_full_order_number);
|
|
390
|
+
const rewardClaim = buildRewardClaimUrl(shopInfo, order.shop_order_number);
|
|
390
391
|
return {
|
|
391
392
|
shop_name: stringify(shopInfo.name || order.shop_name),
|
|
392
393
|
note: stringify(order.note),
|
|
393
394
|
shop_order_number: stringify(order.shop_order_number),
|
|
395
|
+
...(rewardClaim ? {
|
|
396
|
+
reward_claim: rewardClaim
|
|
397
|
+
} : {}),
|
|
394
398
|
order_number: orderNumber,
|
|
395
399
|
shop_tax_number: stringify(shopInfo.tax_number || order.shop_tax_number),
|
|
396
400
|
shop_phone: stringify(shopInfo.phone || order.shop_phone),
|
|
@@ -409,6 +413,23 @@ function buildBaseData(params) {
|
|
|
409
413
|
} : {})
|
|
410
414
|
};
|
|
411
415
|
}
|
|
416
|
+
function buildRewardClaimUrl(shopInfo, shopOrderNumber) {
|
|
417
|
+
const domain = typeof shopInfo.default_domain === 'string' ? shopInfo.default_domain.trim() : '';
|
|
418
|
+
const orderNumber = typeof shopOrderNumber === 'string' ? shopOrderNumber.trim() : typeof shopOrderNumber === 'number' && Number.isFinite(shopOrderNumber) ? String(shopOrderNumber) : '';
|
|
419
|
+
if (!domain || !orderNumber) return undefined;
|
|
420
|
+
try {
|
|
421
|
+
const protocol = shopInfo.private_domain_protocol === 'http' ? 'http' : 'https';
|
|
422
|
+
const base = new URL(/^[a-z][a-z\d+.-]*:\/\//i.test(domain) ? domain : `${protocol}://${domain}`);
|
|
423
|
+
if (!['http:', 'https:'].includes(base.protocol) || base.username || base.password) {
|
|
424
|
+
return undefined;
|
|
425
|
+
}
|
|
426
|
+
const url = new URL('/claim-purchase-rewards', base);
|
|
427
|
+
url.searchParams.set('shop_order_number', orderNumber);
|
|
428
|
+
return url.toString();
|
|
429
|
+
} catch {
|
|
430
|
+
return undefined;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
412
433
|
function buildProducts(order, locale, productMap) {
|
|
413
434
|
const products = Array.isArray(order.products) ? order.products : [];
|
|
414
435
|
const allergyByProductUid = buildProductAllergyMap(order, locale);
|
|
@@ -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 | 2 | 1 |
|
|
329
|
+
weekNum: 0 | 2 | 1 | 6 | 4 | 5 | 3;
|
|
330
330
|
}[]>;
|
|
331
331
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
332
332
|
private getScheduleDataByIds;
|
|
@@ -373,7 +373,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
373
373
|
};
|
|
374
374
|
setOtherData(key: string, value: any): void;
|
|
375
375
|
getOtherData(key: string): any;
|
|
376
|
-
getProductTypeById(id: number): Promise<"
|
|
376
|
+
getProductTypeById(id: number): Promise<"normal" | "duration" | "session">;
|
|
377
377
|
/**
|
|
378
378
|
* 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
|
|
379
379
|
*
|
|
@@ -479,7 +479,19 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
479
479
|
* 加车两阶段主决策(规格弹窗 / 资源编辑 / 直接加车)。
|
|
480
480
|
* 与 ticketBooking `handleSelectProduct` + `handleBooking4Service` 等价。
|
|
481
481
|
*/
|
|
482
|
-
decideAddProduct(item: any, options?: Partial<AddProductDecideContext>):
|
|
482
|
+
decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): {
|
|
483
|
+
action: "reloadCatalog";
|
|
484
|
+
} | {
|
|
485
|
+
action: "add";
|
|
486
|
+
cacheItem: any;
|
|
487
|
+
} | {
|
|
488
|
+
action: "requiresDetail";
|
|
489
|
+
payload: AddProductRequiresDetailPayload;
|
|
490
|
+
} | {
|
|
491
|
+
action: "requiresBookingEdit";
|
|
492
|
+
cacheItem: any;
|
|
493
|
+
payload: import("./utils/addProductDecision").AddProductRequiresBookingEditPayload;
|
|
494
|
+
};
|
|
483
495
|
/** 规格弹窗 callback 后的第二段决策。 */
|
|
484
496
|
decideAfterDetail(cacheItem: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
|
|
485
497
|
/**
|
|
@@ -130,9 +130,12 @@ class OrderInvoicePreviewImpl extends _BaseModule.BaseModule {
|
|
|
130
130
|
const task = (async () => {
|
|
131
131
|
const [snapshot, context, template] = await Promise.all([this.loadSource(input), this.loadContext(input), (0, _loadCustomerInvoiceLayout.loadCustomerInvoiceTemplate)(this.request, input)]);
|
|
132
132
|
const source = (0, _loadPaymentMethods.withPaymentMethodNames)(snapshot, context.methods);
|
|
133
|
-
const
|
|
133
|
+
const appPlugin = this.core.getPlugin('app');
|
|
134
|
+
const getData = appPlugin?.getData?.();
|
|
134
135
|
if (getData?.('shop_id') != null && String(getData('shop_id')) !== String(input.shopId)) throw new Error('Invoice shop changed');
|
|
135
136
|
const coreData = getData?.('core');
|
|
137
|
+
const hostApp = appPlugin?.getApp?.();
|
|
138
|
+
const shopCore = hostApp?.models?.getStore?.().getDataByModel?.('core', 'core') || hostApp?.data?.store?.getStore?.().getDataByModel?.('core', 'core') || coreData?.core || coreData || {};
|
|
136
139
|
const shop = {
|
|
137
140
|
...(coreData?.core?.shop || coreData?.shop || {}),
|
|
138
141
|
...(getData?.('shop_info') || {}),
|
|
@@ -142,6 +145,8 @@ class OrderInvoicePreviewImpl extends _BaseModule.BaseModule {
|
|
|
142
145
|
tax_country_code: getData('tax_country_code')
|
|
143
146
|
} : {})
|
|
144
147
|
};
|
|
148
|
+
shop.default_domain || (shop.default_domain = shopCore.default_domain);
|
|
149
|
+
shop.private_domain_protocol || (shop.private_domain_protocol = shopCore.private_domain_protocol);
|
|
145
150
|
if (generation !== this.generation || this.disposed) throw new Error('Invoice request superseded');
|
|
146
151
|
const languageOptions = (0, _customerInvoiceLanguages.resolveCustomerInvoiceLanguages)(template.language, input.locale);
|
|
147
152
|
const remembered = this.languageSelection?.code;
|
package/package.json
CHANGED
package/dist/apis/picoding.d.ts
DELETED
|
File without changes
|
package/dist/effects/index.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
type EffectCallback = (payload: any) => void | Promise<void | {
|
|
2
|
-
status: boolean;
|
|
3
|
-
message?: string;
|
|
4
|
-
}>;
|
|
5
|
-
type UnsubscribeFunction = () => void;
|
|
6
|
-
declare class EffectsManager {
|
|
7
|
-
private listeners;
|
|
8
|
-
on(event: string, callback: EffectCallback): UnsubscribeFunction;
|
|
9
|
-
only(event: string, callback: EffectCallback): UnsubscribeFunction;
|
|
10
|
-
off(event: string, callback: EffectCallback): void;
|
|
11
|
-
offByModuleDestroy(module: string): void;
|
|
12
|
-
once(event: string, callback: EffectCallback): UnsubscribeFunction;
|
|
13
|
-
emit(event: string, payload: any): Promise<{
|
|
14
|
-
status: boolean;
|
|
15
|
-
data: any;
|
|
16
|
-
}>;
|
|
17
|
-
clear(): void;
|
|
18
|
-
}
|
|
19
|
-
export { EffectsManager, UnsubscribeFunction };
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import type { EvaluationResult, RuntimeContext } from '../../type';
|
|
2
|
-
import type { BusinessAdapter } from '../type';
|
|
3
|
-
import type { DataVariantBusinessData, DataVariantProduct } from './type';
|
|
4
|
-
/**
|
|
5
|
-
* Data Variant 适配器。
|
|
6
|
-
*
|
|
7
|
-
* 负责把智能定价运行态数据转换为 StrategyEngine 能识别的 attributes。
|
|
8
|
-
*/
|
|
9
|
-
export declare class DataVariantAdapter implements BusinessAdapter {
|
|
10
|
-
name: string;
|
|
11
|
-
version: string;
|
|
12
|
-
/**
|
|
13
|
-
* 准备批量全局上下文。
|
|
14
|
-
*
|
|
15
|
-
* 这里只放不依赖单个商品的字段,用于预计算 schedule/channel/orderType 等条件。
|
|
16
|
-
*/
|
|
17
|
-
prepareContext(businessData: DataVariantBusinessData): RuntimeContext;
|
|
18
|
-
/**
|
|
19
|
-
* 准备全局预计算上下文。
|
|
20
|
-
*/
|
|
21
|
-
prepareGlobalContext(businessData: DataVariantBusinessData): RuntimeContext;
|
|
22
|
-
/**
|
|
23
|
-
* 准备单商品上下文。
|
|
24
|
-
*
|
|
25
|
-
* 商品级条件只在当前商品 data_variants 引用到对应规则后才评估。
|
|
26
|
-
*/
|
|
27
|
-
prepareProductContext(businessData: DataVariantBusinessData, product: DataVariantProduct): RuntimeContext;
|
|
28
|
-
transformResult(result: EvaluationResult): EvaluationResult;
|
|
29
|
-
formatConfig(result: EvaluationResult, businessData?: DataVariantBusinessData): {
|
|
30
|
-
result: EvaluationResult;
|
|
31
|
-
businessData?: DataVariantBusinessData;
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* 构建 menu_match 使用的轻量商品对象。
|
|
35
|
-
*
|
|
36
|
-
* collection_ids 来自商品 collection 字段,避免 operator 读取复杂商品对象。
|
|
37
|
-
*/
|
|
38
|
-
buildProductValue(product: DataVariantProduct): {
|
|
39
|
-
id: number;
|
|
40
|
-
product_variant_id: number;
|
|
41
|
-
collection_ids: number[];
|
|
42
|
-
};
|
|
43
|
-
private toNumber;
|
|
44
|
-
/**
|
|
45
|
-
* 归一化客户 id:无效值返回 undefined,有效值统一为 number。
|
|
46
|
-
*/
|
|
47
|
-
private normalizeCustomerId;
|
|
48
|
-
private normalizeNumberArray;
|
|
49
|
-
}
|
|
50
|
-
export default DataVariantAdapter;
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import type { ConditionRule, StrategyConfig } from '../../type';
|
|
2
|
-
import type { ConditionScope, DataVariantBusinessData, DataVariantMenu, DataVariantRuleMetadata, MenuScope, ResolvedDataVariantResult } from './type';
|
|
3
|
-
/**
|
|
4
|
-
* Data Variant 评估器。
|
|
5
|
-
*
|
|
6
|
-
* OS Server 商品路由开启时由 ProductsModule 调用;路由关闭时由 ProductList 在远端响应后调用。
|
|
7
|
-
*/
|
|
8
|
-
export declare class DataVariantEvaluator {
|
|
9
|
-
private adapter;
|
|
10
|
-
private strategyConfigs;
|
|
11
|
-
constructor();
|
|
12
|
-
/**
|
|
13
|
-
* 设置策略配置列表,仅保留 metadata.type === 'data_variant' 的策略。
|
|
14
|
-
*/
|
|
15
|
-
setStrategyConfigs(configs: StrategyConfig[]): void;
|
|
16
|
-
getStrategyConfigs(): StrategyConfig<DataVariantRuleMetadata>[];
|
|
17
|
-
/**
|
|
18
|
-
* 批量解析商品 Data Variant。
|
|
19
|
-
*
|
|
20
|
-
* 优先使用商品 metadata.data_variant_ids;缺少权威命中结果时才执行本地策略判断。
|
|
21
|
-
*/
|
|
22
|
-
resolveProducts(businessData: DataVariantBusinessData): ResolvedDataVariantResult;
|
|
23
|
-
/**
|
|
24
|
-
* 根据 operator/field 判断条件是否依赖当前商品。
|
|
25
|
-
*/
|
|
26
|
-
getConditionScope(rule: ConditionRule): ConditionScope;
|
|
27
|
-
/**
|
|
28
|
-
* 将餐牌 partyroom_package 预构建为 Map/Set 索引。
|
|
29
|
-
*/
|
|
30
|
-
buildMenuScopeMap(menuList: DataVariantMenu[]): Map<number, MenuScope>;
|
|
31
|
-
/**
|
|
32
|
-
* 从当前策略中所有 schedule_match.value 绑定的 schedule_id 提取时间点。
|
|
33
|
-
*
|
|
34
|
-
* 这里不依赖餐牌,只读取策略配置和调用方传入的 scheduleList。
|
|
35
|
-
*/
|
|
36
|
-
buildScheduleTimePoints(strategyConfigs: StrategyConfig<DataVariantRuleMetadata>[], scheduleList: NonNullable<DataVariantBusinessData['scheduleList']>): string[];
|
|
37
|
-
/**
|
|
38
|
-
* 判断商品(含套餐子商品)是否仍需要本地执行策略条件。
|
|
39
|
-
* metadata.data_variant_ids 只要是数组,即使为空,也表示接口已经给出权威命中结果。
|
|
40
|
-
*/
|
|
41
|
-
private requiresLocalStrategyEvaluation;
|
|
42
|
-
/**
|
|
43
|
-
* 将接口返回的高 -> 低优先级 Variant ID 转成数值优先级。
|
|
44
|
-
* 返回 null 表示接口没有提供该字段;空 Map 表示已计算但没有任何命中。
|
|
45
|
-
*/
|
|
46
|
-
private getAuthoritativeVariantPriorities;
|
|
47
|
-
private normalizeDataVariantId;
|
|
48
|
-
private buildGlobalEffectiveRuleMap;
|
|
49
|
-
private resolveProduct;
|
|
50
|
-
/**
|
|
51
|
-
* 多货币 Data Variant 只生成候选列表,不参与商品字段覆盖。
|
|
52
|
-
* rule_id=0 是无条件默认价;同币种命中的条件价优先于默认价。
|
|
53
|
-
*/
|
|
54
|
-
private resolveSettlementOptions;
|
|
55
|
-
/**
|
|
56
|
-
* 解析套餐子商品上的 Data Variant 覆盖。
|
|
57
|
-
*
|
|
58
|
-
* bundle_item 以 bundle_product_id / bundle_variant_id 作为商品身份参与 product_match 等条件判断。
|
|
59
|
-
*/
|
|
60
|
-
private resolveProductBundleItems;
|
|
61
|
-
/**
|
|
62
|
-
* 将 bundle_item 转为 DataVariantProduct 并评估 data_variants。
|
|
63
|
-
*/
|
|
64
|
-
private resolveBundleItem;
|
|
65
|
-
/**
|
|
66
|
-
* bundle_item 的商品身份映射:bundle_product_id + bundle_variant_id。
|
|
67
|
-
*/
|
|
68
|
-
private toBundleItemDataVariantProduct;
|
|
69
|
-
/**
|
|
70
|
-
* 仅回写命中的字段,避免污染 bundle_item 的结构字段。
|
|
71
|
-
*/
|
|
72
|
-
private mergeBundleItemResolvedData;
|
|
73
|
-
private evaluateProductRules;
|
|
74
|
-
/**
|
|
75
|
-
* 拆分策略条件。
|
|
76
|
-
*
|
|
77
|
-
* 当前 MVP 支持顶层 and 原子条件拆分;复杂条件保守地放到商品级完整判断。
|
|
78
|
-
*/
|
|
79
|
-
private splitStrategyConfig;
|
|
80
|
-
private createEngine;
|
|
81
|
-
private evaluateScheduleMatch;
|
|
82
|
-
private evaluateMenuMatch;
|
|
83
|
-
private evaluateArrayIntersects;
|
|
84
|
-
private collectScheduleIdsFromStrategies;
|
|
85
|
-
private extractTimePointsFromSchedules;
|
|
86
|
-
private addDateTimePoint;
|
|
87
|
-
private addRawTimePoint;
|
|
88
|
-
private extractTimeFromDateTime;
|
|
89
|
-
private normalizeTime;
|
|
90
|
-
private timeToMinutes;
|
|
91
|
-
private isProductInMenuScope;
|
|
92
|
-
private mergeMatchedVariants;
|
|
93
|
-
private getProductDataVariants;
|
|
94
|
-
private normalizeStrategyConfigs;
|
|
95
|
-
private isStrategyActive;
|
|
96
|
-
private getStrategyPriority;
|
|
97
|
-
private createAlwaysTrueConditions;
|
|
98
|
-
private flattenConditionRules;
|
|
99
|
-
private isConditionGroup;
|
|
100
|
-
private normalizeNumberArray;
|
|
101
|
-
private normalizeComparableArray;
|
|
102
|
-
private buildProductKey;
|
|
103
|
-
private toNumber;
|
|
104
|
-
}
|
|
105
|
-
export default DataVariantEvaluator;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { StrategyConfig } from '../../type';
|
|
2
|
-
import type { ScheduleItem } from '../../../../modules/Schedule/types';
|
|
3
|
-
import type { DataVariantItem, DataVariantMenu, DataVariantProduct, DataVariantRuleMetadata } from './type';
|
|
4
|
-
/**
|
|
5
|
-
* 构造示例用 data_variant 记录,字段结构与后端 /product/query 返回一致。
|
|
6
|
-
*/
|
|
7
|
-
export declare function createExampleDataVariant(ruleId: number | string, data: Record<string, any>, overrides?: Partial<Omit<DataVariantItem, 'data_variant_rule_id' | 'data'>>): DataVariantItem;
|
|
8
|
-
/**
|
|
9
|
-
* 晚场餐牌价:命中日程 + 餐牌商品范围后覆盖 price / stock。
|
|
10
|
-
*/
|
|
11
|
-
export declare const EVENING_MENU_PRICE_STRATEGY: StrategyConfig<DataVariantRuleMetadata>;
|
|
12
|
-
/**
|
|
13
|
-
* VIP 商品价:演示 product_match 与更高优先级字段覆盖。
|
|
14
|
-
*/
|
|
15
|
-
export declare const VIP_PRODUCT_PRICE_STRATEGY: StrategyConfig<DataVariantRuleMetadata>;
|
|
16
|
-
/**
|
|
17
|
-
* 客户/渠道/业务范围价:演示 customer_id、channel、business_code 的 in 条件。
|
|
18
|
-
*/
|
|
19
|
-
export declare const CUSTOMER_SCOPE_PRICE_STRATEGY: StrategyConfig<DataVariantRuleMetadata>;
|
|
20
|
-
/**
|
|
21
|
-
* 示例日程:2026-06-26 17:00 ~ 20:00 生效。
|
|
22
|
-
*/
|
|
23
|
-
export declare const DATA_VARIANT_EXAMPLE_SCHEDULES: ScheduleItem[];
|
|
24
|
-
/**
|
|
25
|
-
* 示例餐牌:product_collection = 128 的商品均属于餐牌。
|
|
26
|
-
*/
|
|
27
|
-
export declare const DATA_VARIANT_EXAMPLE_MENUS: DataVariantMenu[];
|
|
28
|
-
/**
|
|
29
|
-
* 示例商品:同时带两条 Data Variant 覆盖数据。
|
|
30
|
-
*/
|
|
31
|
-
export declare const DATA_VARIANT_EXAMPLE_PRODUCTS: DataVariantProduct[];
|
|
32
|
-
/**
|
|
33
|
-
* Data Variant 评估器示例调用。
|
|
34
|
-
*/
|
|
35
|
-
export declare function runDataVariantDemo(): import("./type").ResolvedDataVariantResult;
|
|
36
|
-
/**
|
|
37
|
-
* 客户/渠道/业务范围条件示例调用。
|
|
38
|
-
*/
|
|
39
|
-
export declare function runCustomerScopeDataVariantDemo(): import("./type").ResolvedDataVariantResult;
|