@pisell/pisellos 0.10.53 → 0.10.55
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/index.d.ts +2 -0
- package/dist/index.js +3 -1
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/modules/BusinessAvailability/index.d.ts +30 -0
- package/dist/modules/BusinessAvailability/index.js +204 -0
- package/dist/modules/OpenData/index.js +1 -1
- package/dist/modules/OpenData/types.d.ts +2 -0
- package/dist/modules/Order/index.d.ts +5 -2
- package/dist/modules/Order/index.js +320 -247
- package/dist/modules/Order/types.d.ts +8 -0
- package/dist/modules/Payment/index.js +9 -10
- package/dist/plugins/request.d.ts +3 -0
- package/dist/server/utils/small-ticket.d.ts +1 -85
- package/dist/server/utils/small-ticket.js +2 -2576
- package/dist/shared/payment/loadPaymentMethods.d.ts +9 -0
- package/dist/shared/payment/loadPaymentMethods.js +66 -0
- package/dist/shared/receipt/small-ticket.d.ts +85 -0
- package/dist/shared/receipt/small-ticket.js +2576 -0
- package/dist/shared/sales/loadSalesOrderSnapshot.d.ts +9 -0
- package/dist/shared/sales/loadSalesOrderSnapshot.js +21 -0
- package/dist/solution/BaseSales/index.d.ts +4 -15
- package/dist/solution/BaseSales/index.js +131 -86
- package/dist/solution/BaseSales/types.d.ts +11 -0
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +41 -13
- package/dist/solution/OrderInvoicePreview/index.d.ts +56 -0
- package/dist/solution/OrderInvoicePreview/index.js +269 -0
- package/dist/solution/UnifiedBookingSales/businessAvailability.d.ts +27 -0
- package/dist/solution/UnifiedBookingSales/businessAvailability.js +292 -0
- package/dist/solution/UnifiedBookingSales/index.d.ts +11 -0
- package/dist/solution/UnifiedBookingSales/index.js +154 -75
- package/dist/solution/UnifiedBookingSales/types.d.ts +2 -0
- package/dist/solution/index.d.ts +1 -0
- package/dist/solution/index.js +2 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +21 -1
- package/lib/modules/BusinessAvailability/index.d.ts +30 -0
- package/lib/modules/BusinessAvailability/index.js +146 -0
- package/lib/modules/OpenData/index.js +1 -1
- package/lib/modules/OpenData/types.d.ts +2 -0
- package/lib/modules/Order/index.d.ts +5 -2
- package/lib/modules/Order/index.js +67 -13
- package/lib/modules/Order/types.d.ts +8 -0
- package/lib/modules/Payment/index.js +3 -4
- package/lib/plugins/request.d.ts +3 -0
- package/lib/server/utils/small-ticket.d.ts +1 -85
- package/lib/server/utils/small-ticket.js +9 -2335
- package/lib/shared/payment/loadPaymentMethods.d.ts +9 -0
- package/lib/shared/payment/loadPaymentMethods.js +40 -0
- package/lib/shared/receipt/small-ticket.d.ts +85 -0
- package/lib/shared/receipt/small-ticket.js +2342 -0
- package/lib/shared/sales/loadSalesOrderSnapshot.d.ts +9 -0
- package/lib/shared/sales/loadSalesOrderSnapshot.js +22 -0
- package/lib/solution/BaseSales/index.d.ts +4 -15
- package/lib/solution/BaseSales/index.js +45 -24
- package/lib/solution/BaseSales/types.d.ts +11 -0
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +37 -4
- package/lib/solution/OrderInvoicePreview/index.d.ts +56 -0
- package/lib/solution/OrderInvoicePreview/index.js +194 -0
- package/lib/solution/UnifiedBookingSales/businessAvailability.d.ts +27 -0
- package/lib/solution/UnifiedBookingSales/businessAvailability.js +138 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +11 -0
- package/lib/solution/UnifiedBookingSales/index.js +54 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +2 -0
- package/lib/solution/index.d.ts +1 -0
- package/lib/solution/index.js +11 -0
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RequestPlugin } from '../../plugins/request';
|
|
2
|
+
export declare const SALES_ORDER_RELATIONS: string[];
|
|
3
|
+
/** Shared transport contract; remote callers use their host's /h5 prefix. */
|
|
4
|
+
export declare function loadSalesOrderSnapshot(request: RequestPlugin, params: {
|
|
5
|
+
lookup: string | number;
|
|
6
|
+
transport: 'remote' | 'os-server';
|
|
7
|
+
forceRemote?: boolean;
|
|
8
|
+
with?: string[];
|
|
9
|
+
}): Promise<any>;
|
|
@@ -0,0 +1,21 @@
|
|
|
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; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
export var SALES_ORDER_RELATIONS = ['products', 'bookings', 'payments', 'customer', 'summary', 'contacts_info', 'order_meta_list', 'refunds', 'notes'];
|
|
8
|
+
|
|
9
|
+
/** Shared transport contract; remote callers use their host's /h5 prefix. */
|
|
10
|
+
export function loadSalesOrderSnapshot(request, params) {
|
|
11
|
+
var _params$lookup, _params$with;
|
|
12
|
+
var lookup = String((_params$lookup = params.lookup) !== null && _params$lookup !== void 0 ? _params$lookup : '').trim();
|
|
13
|
+
if (!lookup) throw new Error('加载销售详情需要 lookup');
|
|
14
|
+
return request.get("/order/sales/".concat(encodeURIComponent(lookup)), _objectSpread({
|
|
15
|
+
with: (_params$with = params.with) !== null && _params$with !== void 0 ? _params$with : SALES_ORDER_RELATIONS
|
|
16
|
+
}, params.forceRemote && !lookup.startsWith('LOCAL_') ? {
|
|
17
|
+
forceRemote: true
|
|
18
|
+
} : {}), params.transport === 'os-server' ? {
|
|
19
|
+
osServer: true
|
|
20
|
+
} : undefined);
|
|
21
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Module, ModuleOptions, PisellCore } from '../../types';
|
|
2
2
|
import { BaseModule } from '../../modules/BaseModule';
|
|
3
|
-
import { BaseSalesOrderProduct, BaseSalesOrderProductIdentity, BaseSalesPaymentStatus, BaseSalesUpdateOrderProductQuantityParams, BaseSalesCalculateProductBookingPriceParams, BaseSalesPriceRecalculationContextChange, BaseSalesProductBookingPriceResult, BaseSalesQuotationCustomerScopeInfo, BaseSalesScanCodeResult, BaseSalesCashPaymentConfig, BaseSalesPayCashParams, BaseSalesPayCashResult, BaseSalesCommitPaymentMethodParams, BaseSalesCommitPaymentMethodResult, BaseSalesConfirmWalletPaymentResult } from './types';
|
|
3
|
+
import { BaseSalesOrderProduct, BaseSalesOrderProductIdentity, BaseSalesPaymentStatus, BaseSalesSubmitSalesOrderParams, BaseSalesUpdateOrderProductQuantityParams, BaseSalesCalculateProductBookingPriceParams, BaseSalesPriceRecalculationContextChange, BaseSalesProductBookingPriceResult, BaseSalesQuotationCustomerScopeInfo, BaseSalesScanCodeResult, BaseSalesCashPaymentConfig, BaseSalesPayCashParams, BaseSalesPayCashResult, BaseSalesCommitPaymentMethodParams, BaseSalesCommitPaymentMethodResult, BaseSalesConfirmWalletPaymentResult } from './types';
|
|
4
4
|
import { OrderModule } from '../../modules/Order';
|
|
5
5
|
import { type PickupTimingBookingInput } from '../../modules/Order/pickupTiming';
|
|
6
6
|
import type { PickupTimingAvailability, PickupTimingSelection, PickupTimingValidationResult } from '../../modules/FulfillmentTiming';
|
|
@@ -337,13 +337,8 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
337
337
|
productList?: Record<string, any>[];
|
|
338
338
|
discountList?: Discount[];
|
|
339
339
|
}): Promise<void>;
|
|
340
|
-
submitScanOrder<T = any>(params?:
|
|
341
|
-
|
|
342
|
-
paymentStatus?: BaseSalesPaymentStatus;
|
|
343
|
-
smallTicketDataFlag?: number;
|
|
344
|
-
confirmPendingVoucherPayments?: boolean;
|
|
345
|
-
enhancePayload?: SubmitPayloadEnhancer;
|
|
346
|
-
}): Promise<T>;
|
|
340
|
+
submitScanOrder<T = any>(params?: BaseSalesSubmitSalesOrderParams): Promise<T>;
|
|
341
|
+
private buildVirtualSettlementOrderData;
|
|
347
342
|
private buildVirtualSettlementSubmitData;
|
|
348
343
|
/**
|
|
349
344
|
* 提交当前 Sales 订单。
|
|
@@ -351,13 +346,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
351
346
|
* PaymentModal 场景通过 smallTicketDataFlag=1 请求 B 端小票数据;
|
|
352
347
|
* payments 会交给 OrderModule 统一映射为 Sales 协议支付项。
|
|
353
348
|
*/
|
|
354
|
-
submitSalesOrder<T = any>(params?:
|
|
355
|
-
payments?: OrderPaymentSource[];
|
|
356
|
-
paymentStatus?: BaseSalesPaymentStatus;
|
|
357
|
-
smallTicketDataFlag?: number;
|
|
358
|
-
confirmPendingVoucherPayments?: boolean;
|
|
359
|
-
enhancePayload?: SubmitPayloadEnhancer;
|
|
360
|
-
}): Promise<T>;
|
|
349
|
+
submitSalesOrder<T = any>(params?: BaseSalesSubmitSalesOrderParams): Promise<T>;
|
|
361
350
|
saveSalesOrderDraft<T = any>(params?: {
|
|
362
351
|
platform?: string;
|
|
363
352
|
businessCode?: string;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
var _excluded = ["payment_status"];
|
|
2
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
3
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
1
4
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
5
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
6
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
@@ -3918,92 +3921,91 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3918
3921
|
}
|
|
3919
3922
|
return submitScanOrder;
|
|
3920
3923
|
}()
|
|
3924
|
+
}, {
|
|
3925
|
+
key: "buildVirtualSettlementOrderData",
|
|
3926
|
+
value: function buildVirtualSettlementOrderData() {
|
|
3927
|
+
var _tempOrder$metadata$c, _tempOrder$metadata2;
|
|
3928
|
+
if (!this.store.order) return null;
|
|
3929
|
+
var tempOrder = this.store.order.getTempOrder();
|
|
3930
|
+
if (!this.isActiveVirtualSettlementOrder(tempOrder)) return null;
|
|
3931
|
+
var snapshot = getTempOrderSettlementSnapshot(tempOrder);
|
|
3932
|
+
var currencyProductId = Number((_tempOrder$metadata$c = tempOrder === null || tempOrder === void 0 || (_tempOrder$metadata2 = tempOrder.metadata) === null || _tempOrder$metadata2 === void 0 || (_tempOrder$metadata2 = _tempOrder$metadata2.currency_settlement_config) === null || _tempOrder$metadata2 === void 0 || (_tempOrder$metadata2 = _tempOrder$metadata2.settlement_ids) === null || _tempOrder$metadata2 === void 0 ? void 0 : _tempOrder$metadata2[0]) !== null && _tempOrder$metadata$c !== void 0 ? _tempOrder$metadata$c : snapshot === null || snapshot === void 0 ? void 0 : snapshot.currency_product_id);
|
|
3933
|
+
if (!snapshot || !Number.isFinite(currencyProductId) || currencyProductId <= 0) {
|
|
3934
|
+
throw new Error('Virtual currency settlement configuration is invalid.');
|
|
3935
|
+
}
|
|
3936
|
+
return {
|
|
3937
|
+
snapshot: snapshot,
|
|
3938
|
+
currencyProductId: currencyProductId,
|
|
3939
|
+
currencyCode: String((tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.currency_code) || ''),
|
|
3940
|
+
currencySymbol: String((tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.currency_symbol) || ''),
|
|
3941
|
+
currencyFormat: String((tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.currency_format) || 'symbol_first')
|
|
3942
|
+
};
|
|
3943
|
+
}
|
|
3921
3944
|
}, {
|
|
3922
3945
|
key: "buildVirtualSettlementSubmitData",
|
|
3923
3946
|
value: function () {
|
|
3924
3947
|
var _buildVirtualSettlementSubmitData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
|
|
3925
|
-
var
|
|
3926
|
-
var tempOrder, snapshot, currencyProductId, summary, amount, customerId, asset, currencyCode, currencySymbol, currencyFormat, balance, amountText, paymentNumber, payment, _paymentMethod$custom, paymentMethods, paymentMethod;
|
|
3948
|
+
var settlement, tempOrder, currencyProductId, summary, amount, customerId, asset, balance, amountText, paymentNumber, payment, _paymentMethod$custom, paymentMethods, paymentMethod;
|
|
3927
3949
|
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
3928
3950
|
while (1) switch (_context33.prev = _context33.next) {
|
|
3929
3951
|
case 0:
|
|
3930
|
-
|
|
3931
|
-
|
|
3952
|
+
settlement = this.buildVirtualSettlementOrderData();
|
|
3953
|
+
if (!(!settlement || !this.store.order)) {
|
|
3954
|
+
_context33.next = 3;
|
|
3932
3955
|
break;
|
|
3933
3956
|
}
|
|
3934
3957
|
return _context33.abrupt("return", null);
|
|
3935
|
-
case
|
|
3958
|
+
case 3:
|
|
3936
3959
|
tempOrder = this.store.order.getTempOrder();
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
break;
|
|
3940
|
-
}
|
|
3941
|
-
return _context33.abrupt("return", null);
|
|
3942
|
-
case 5:
|
|
3943
|
-
snapshot = getTempOrderSettlementSnapshot(tempOrder);
|
|
3944
|
-
currencyProductId = Number((_tempOrder$metadata$c = tempOrder === null || tempOrder === void 0 || (_tempOrder$metadata2 = tempOrder.metadata) === null || _tempOrder$metadata2 === void 0 || (_tempOrder$metadata2 = _tempOrder$metadata2.currency_settlement_config) === null || _tempOrder$metadata2 === void 0 || (_tempOrder$metadata2 = _tempOrder$metadata2.settlement_ids) === null || _tempOrder$metadata2 === void 0 ? void 0 : _tempOrder$metadata2[0]) !== null && _tempOrder$metadata$c !== void 0 ? _tempOrder$metadata$c : snapshot === null || snapshot === void 0 ? void 0 : snapshot.currency_product_id);
|
|
3945
|
-
if (!(!snapshot || !Number.isFinite(currencyProductId) || currencyProductId <= 0)) {
|
|
3946
|
-
_context33.next = 9;
|
|
3947
|
-
break;
|
|
3948
|
-
}
|
|
3949
|
-
throw new Error('Virtual currency settlement configuration is invalid.');
|
|
3950
|
-
case 9:
|
|
3951
|
-
_context33.next = 11;
|
|
3960
|
+
currencyProductId = settlement.currencyProductId;
|
|
3961
|
+
_context33.next = 7;
|
|
3952
3962
|
return this.store.order.recalculateSummary({
|
|
3953
3963
|
createIfMissing: true
|
|
3954
3964
|
});
|
|
3955
|
-
case
|
|
3965
|
+
case 7:
|
|
3956
3966
|
summary = _context33.sent;
|
|
3957
3967
|
amount = new Decimal((summary === null || summary === void 0 ? void 0 : summary.total_amount) || 0).toDecimalPlaces(2);
|
|
3958
3968
|
customerId = Number((tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.customer_id) || 0);
|
|
3959
3969
|
if (!(amount.gt(0) && customerId > 0 && customerId !== 1)) {
|
|
3960
|
-
_context33.next =
|
|
3970
|
+
_context33.next = 13;
|
|
3961
3971
|
break;
|
|
3962
3972
|
}
|
|
3963
|
-
_context33.next =
|
|
3973
|
+
_context33.next = 13;
|
|
3964
3974
|
return this.store.order.loadDiscountConfig({
|
|
3965
3975
|
customerId: customerId,
|
|
3966
3976
|
action: tempOrder !== null && tempOrder !== void 0 && tempOrder.order_id ? 'edit' : 'create',
|
|
3967
3977
|
orderId: Number(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.order_id) || undefined,
|
|
3968
3978
|
apply: false
|
|
3969
3979
|
});
|
|
3970
|
-
case
|
|
3980
|
+
case 13:
|
|
3971
3981
|
asset = this.store.order.getVirtualCurrencyList().find(function (item) {
|
|
3972
3982
|
return Number(item === null || item === void 0 ? void 0 : item.product_id) === currencyProductId;
|
|
3973
3983
|
});
|
|
3974
|
-
currencyCode = String((tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.currency_code) || '');
|
|
3975
|
-
currencySymbol = String((tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.currency_symbol) || '');
|
|
3976
|
-
currencyFormat = String((tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.currency_format) || 'symbol_first');
|
|
3977
3984
|
if (!amount.lte(0)) {
|
|
3978
|
-
_context33.next =
|
|
3985
|
+
_context33.next = 16;
|
|
3979
3986
|
break;
|
|
3980
3987
|
}
|
|
3981
|
-
return _context33.abrupt("return", {
|
|
3982
|
-
payments: []
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
currencyCode: currencyCode,
|
|
3986
|
-
currencySymbol: currencySymbol,
|
|
3987
|
-
currencyFormat: currencyFormat
|
|
3988
|
-
});
|
|
3989
|
-
case 23:
|
|
3988
|
+
return _context33.abrupt("return", _objectSpread(_objectSpread({}, settlement), {}, {
|
|
3989
|
+
payments: []
|
|
3990
|
+
}));
|
|
3991
|
+
case 16:
|
|
3990
3992
|
if (asset) {
|
|
3991
|
-
_context33.next =
|
|
3993
|
+
_context33.next = 18;
|
|
3992
3994
|
break;
|
|
3993
3995
|
}
|
|
3994
3996
|
throw new Error('No matching virtual currency card is available.');
|
|
3995
|
-
case
|
|
3997
|
+
case 18:
|
|
3996
3998
|
balance = new Decimal(asset.balance || 0);
|
|
3997
3999
|
if (!balance.lt(amount)) {
|
|
3998
|
-
_context33.next =
|
|
4000
|
+
_context33.next = 21;
|
|
3999
4001
|
break;
|
|
4000
4002
|
}
|
|
4001
4003
|
throw new Error('Insufficient virtual currency balance.');
|
|
4002
|
-
case
|
|
4004
|
+
case 21:
|
|
4003
4005
|
amountText = amount.toFixed(2);
|
|
4004
4006
|
paymentNumber = "LOCAL_".concat(createUuidV4());
|
|
4005
4007
|
if (!this.store.order.isOnlineStorePlatform()) {
|
|
4006
|
-
_context33.next =
|
|
4008
|
+
_context33.next = 27;
|
|
4007
4009
|
break;
|
|
4008
4010
|
}
|
|
4009
4011
|
payment = {
|
|
@@ -4020,22 +4022,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4020
4022
|
},
|
|
4021
4023
|
wallet_pass_use_value: amountText
|
|
4022
4024
|
};
|
|
4023
|
-
_context33.next =
|
|
4025
|
+
_context33.next = 34;
|
|
4024
4026
|
break;
|
|
4025
|
-
case
|
|
4026
|
-
_context33.next =
|
|
4027
|
+
case 27:
|
|
4028
|
+
_context33.next = 29;
|
|
4027
4029
|
return this.getPaymentMethodsAsync();
|
|
4028
|
-
case
|
|
4030
|
+
case 29:
|
|
4029
4031
|
paymentMethods = _context33.sent;
|
|
4030
4032
|
paymentMethod = paymentMethods.find(function (method) {
|
|
4031
4033
|
return String(method.code || '').toUpperCase() === 'PRODUCTVOUCHER';
|
|
4032
4034
|
});
|
|
4033
4035
|
if (paymentMethod) {
|
|
4034
|
-
_context33.next =
|
|
4036
|
+
_context33.next = 33;
|
|
4035
4037
|
break;
|
|
4036
4038
|
}
|
|
4037
4039
|
throw new Error('PRODUCTVOUCHER payment method is unavailable.');
|
|
4038
|
-
case
|
|
4040
|
+
case 33:
|
|
4039
4041
|
payment = {
|
|
4040
4042
|
payment_number: paymentNumber,
|
|
4041
4043
|
amount: amountText,
|
|
@@ -4054,16 +4056,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4054
4056
|
wallet_pass_use_value: amountText,
|
|
4055
4057
|
metadata: {}
|
|
4056
4058
|
};
|
|
4057
|
-
case
|
|
4058
|
-
return _context33.abrupt("return", {
|
|
4059
|
-
payments: [payment]
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
currencyCode: currencyCode,
|
|
4063
|
-
currencySymbol: currencySymbol,
|
|
4064
|
-
currencyFormat: currencyFormat
|
|
4065
|
-
});
|
|
4066
|
-
case 42:
|
|
4059
|
+
case 34:
|
|
4060
|
+
return _context33.abrupt("return", _objectSpread(_objectSpread({}, settlement), {}, {
|
|
4061
|
+
payments: [payment]
|
|
4062
|
+
}));
|
|
4063
|
+
case 35:
|
|
4067
4064
|
case "end":
|
|
4068
4065
|
return _context33.stop();
|
|
4069
4066
|
}
|
|
@@ -4085,7 +4082,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4085
4082
|
value: (function () {
|
|
4086
4083
|
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(params) {
|
|
4087
4084
|
var _params$smallTicketDa, _this$otherParams18, _this$otherParams19, _this$otherParams20, _this$otherParams21;
|
|
4088
|
-
var virtualSettlement, inferredPaymentStatus, smallTicketDataFlag, virtualSettlementEnhancePayload, enhancePayload, submitParams;
|
|
4085
|
+
var isDeferredPayment, virtualPaymentSettlement, virtualSettlement, inferredPaymentStatus, smallTicketDataFlag, virtualSettlementEnhancePayload, configuredEnhancePayload, enhancePayload, submitParams;
|
|
4089
4086
|
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
4090
4087
|
while (1) switch (_context34.prev = _context34.next) {
|
|
4091
4088
|
case 0:
|
|
@@ -4104,12 +4101,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4104
4101
|
freeze: true
|
|
4105
4102
|
});
|
|
4106
4103
|
case 5:
|
|
4107
|
-
|
|
4104
|
+
isDeferredPayment = (params === null || params === void 0 ? void 0 : params.paymentExecution) === 'deferred';
|
|
4105
|
+
if (!isDeferredPayment) {
|
|
4106
|
+
_context34.next = 10;
|
|
4107
|
+
break;
|
|
4108
|
+
}
|
|
4109
|
+
_context34.t0 = null;
|
|
4110
|
+
_context34.next = 13;
|
|
4111
|
+
break;
|
|
4112
|
+
case 10:
|
|
4113
|
+
_context34.next = 12;
|
|
4108
4114
|
return this.buildVirtualSettlementSubmitData();
|
|
4109
|
-
case
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4115
|
+
case 12:
|
|
4116
|
+
_context34.t0 = _context34.sent;
|
|
4117
|
+
case 13:
|
|
4118
|
+
virtualPaymentSettlement = _context34.t0;
|
|
4119
|
+
virtualSettlement = isDeferredPayment ? this.buildVirtualSettlementOrderData() : virtualPaymentSettlement; // this.store.order.persistTempOrder();
|
|
4120
|
+
inferredPaymentStatus = isDeferredPayment ? undefined : this.getSubmitPaymentStatus(params === null || params === void 0 ? void 0 : params.paymentStatus);
|
|
4113
4121
|
smallTicketDataFlag = (_params$smallTicketDa = params === null || params === void 0 ? void 0 : params.smallTicketDataFlag) !== null && _params$smallTicketDa !== void 0 ? _params$smallTicketDa : this.getDefaultCheckoutSmallTicketDataFlag();
|
|
4114
4122
|
virtualSettlementEnhancePayload = virtualSettlement ? function (payload, ctx) {
|
|
4115
4123
|
var _callerPayload$metada, _currencySettlementCo;
|
|
@@ -4128,7 +4136,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4128
4136
|
currency_format: virtualSettlement.currencyFormat
|
|
4129
4137
|
});
|
|
4130
4138
|
} : params === null || params === void 0 ? void 0 : params.enhancePayload;
|
|
4131
|
-
|
|
4139
|
+
configuredEnhancePayload = this.buildSubmitPayloadEnhancerWithOpenDataConfig(virtualSettlementEnhancePayload); // Apply this last so neither a stale draft status nor a caller enhancer can
|
|
4140
|
+
// turn deferred submission into payment. The live wallet selection is untouched.
|
|
4141
|
+
enhancePayload = isDeferredPayment ? function (payload, ctx) {
|
|
4142
|
+
var enhancedPayload = configuredEnhancePayload ? configuredEnhancePayload(payload, ctx) : payload;
|
|
4143
|
+
var _paymentStatus = enhancedPayload.payment_status,
|
|
4144
|
+
orderPayload = _objectWithoutProperties(enhancedPayload, _excluded);
|
|
4145
|
+
return _objectSpread(_objectSpread({}, orderPayload), {}, {
|
|
4146
|
+
payments: []
|
|
4147
|
+
});
|
|
4148
|
+
} : configuredEnhancePayload;
|
|
4132
4149
|
submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
4133
4150
|
cacheId: this.cacheId,
|
|
4134
4151
|
platform: (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.platform,
|
|
@@ -4136,15 +4153,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4136
4153
|
channel: this.getSubmitOrderSalesChannel(),
|
|
4137
4154
|
type: (_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.type,
|
|
4138
4155
|
request_unique_idempotency_token: this.store.order.generateIdempotencyToken()
|
|
4139
|
-
},
|
|
4140
|
-
payments:
|
|
4156
|
+
}, isDeferredPayment ? {
|
|
4157
|
+
payments: []
|
|
4158
|
+
} : virtualPaymentSettlement ? {
|
|
4159
|
+
payments: virtualPaymentSettlement.payments
|
|
4141
4160
|
} : (params === null || params === void 0 ? void 0 : params.payments) !== undefined ? {
|
|
4142
4161
|
payments: params.payments
|
|
4143
4162
|
} : {}), inferredPaymentStatus !== undefined ? {
|
|
4144
4163
|
paymentStatus: inferredPaymentStatus
|
|
4145
4164
|
} : {}), smallTicketDataFlag !== undefined ? {
|
|
4146
4165
|
smallTicketDataFlag: smallTicketDataFlag
|
|
4147
|
-
} : {}), virtualSettlement ? {
|
|
4166
|
+
} : {}), isDeferredPayment || virtualSettlement ? {
|
|
4148
4167
|
confirmPendingVoucherPayments: false
|
|
4149
4168
|
} : (params === null || params === void 0 ? void 0 : params.confirmPendingVoucherPayments) !== undefined ? {
|
|
4150
4169
|
confirmPendingVoucherPayments: params.confirmPendingVoucherPayments
|
|
@@ -4152,7 +4171,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4152
4171
|
enhancePayload: enhancePayload
|
|
4153
4172
|
} : {});
|
|
4154
4173
|
return _context34.abrupt("return", this.shouldUseCheckoutSyncTask() ? this.store.order.submitTempOrder(submitParams) : this.store.order.submitTempOrderAsync(submitParams));
|
|
4155
|
-
case
|
|
4174
|
+
case 22:
|
|
4156
4175
|
case "end":
|
|
4157
4176
|
return _context34.stop();
|
|
4158
4177
|
}
|
|
@@ -6460,20 +6479,33 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
6460
6479
|
}
|
|
6461
6480
|
throw new Error('order 模块未初始化');
|
|
6462
6481
|
case 3:
|
|
6463
|
-
|
|
6464
|
-
|
|
6465
|
-
|
|
6466
|
-
|
|
6467
|
-
|
|
6482
|
+
if (!(options === undefined)) {
|
|
6483
|
+
_context62.next = 9;
|
|
6484
|
+
break;
|
|
6485
|
+
}
|
|
6486
|
+
_context62.next = 6;
|
|
6487
|
+
return this.store.order.addProductToOrder(product, booking);
|
|
6488
|
+
case 6:
|
|
6489
|
+
_context62.t0 = _context62.sent;
|
|
6490
|
+
_context62.next = 12;
|
|
6491
|
+
break;
|
|
6468
6492
|
case 9:
|
|
6469
|
-
_context62.
|
|
6470
|
-
|
|
6471
|
-
|
|
6493
|
+
_context62.next = 11;
|
|
6494
|
+
return this.store.order.addProductToOrder(product, booking, options);
|
|
6495
|
+
case 11:
|
|
6496
|
+
_context62.t0 = _context62.sent;
|
|
6472
6497
|
case 12:
|
|
6498
|
+
products = _context62.t0;
|
|
6499
|
+
return _context62.abrupt("return", products);
|
|
6500
|
+
case 16:
|
|
6501
|
+
_context62.prev = 16;
|
|
6502
|
+
_context62.t1 = _context62["catch"](0);
|
|
6503
|
+
throw _context62.t1;
|
|
6504
|
+
case 19:
|
|
6473
6505
|
case "end":
|
|
6474
6506
|
return _context62.stop();
|
|
6475
6507
|
}
|
|
6476
|
-
}, _callee62, this, [[0,
|
|
6508
|
+
}, _callee62, this, [[0, 16]]);
|
|
6477
6509
|
}));
|
|
6478
6510
|
function addProductToOrder(_x51, _x52, _x53) {
|
|
6479
6511
|
return _addProductToOrder.apply(this, arguments);
|
|
@@ -6664,19 +6696,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
6664
6696
|
}
|
|
6665
6697
|
throw new Error('order 模块未初始化');
|
|
6666
6698
|
case 3:
|
|
6667
|
-
|
|
6699
|
+
if (!(options === undefined)) {
|
|
6700
|
+
_context67.next = 9;
|
|
6701
|
+
break;
|
|
6702
|
+
}
|
|
6703
|
+
_context67.next = 6;
|
|
6704
|
+
return this.store.order.removeProductsFromOrder(identities);
|
|
6705
|
+
case 6:
|
|
6706
|
+
_context67.t0 = _context67.sent;
|
|
6707
|
+
_context67.next = 12;
|
|
6708
|
+
break;
|
|
6709
|
+
case 9:
|
|
6710
|
+
_context67.next = 11;
|
|
6668
6711
|
return this.store.order.removeProductsFromOrder(identities, options);
|
|
6669
|
-
case 5:
|
|
6670
|
-
return _context67.abrupt("return", _context67.sent);
|
|
6671
|
-
case 8:
|
|
6672
|
-
_context67.prev = 8;
|
|
6673
|
-
_context67.t0 = _context67["catch"](0);
|
|
6674
|
-
throw _context67.t0;
|
|
6675
6712
|
case 11:
|
|
6713
|
+
_context67.t0 = _context67.sent;
|
|
6714
|
+
case 12:
|
|
6715
|
+
return _context67.abrupt("return", _context67.t0);
|
|
6716
|
+
case 15:
|
|
6717
|
+
_context67.prev = 15;
|
|
6718
|
+
_context67.t1 = _context67["catch"](0);
|
|
6719
|
+
throw _context67.t1;
|
|
6720
|
+
case 18:
|
|
6676
6721
|
case "end":
|
|
6677
6722
|
return _context67.stop();
|
|
6678
6723
|
}
|
|
6679
|
-
}, _callee67, this, [[0,
|
|
6724
|
+
}, _callee67, this, [[0, 15]]);
|
|
6680
6725
|
}));
|
|
6681
6726
|
function removeProductsFromOrder(_x59, _x60) {
|
|
6682
6727
|
return _removeProductsFromOrder.apply(this, arguments);
|
|
@@ -4,6 +4,8 @@ import type { ScanOrderLogInput as BaseSalesLogInput, ScanOrderLoggerProviderCon
|
|
|
4
4
|
import type { QuantityCheckResult, QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
|
|
5
5
|
import type { QuotationCustomerScopeInfo } from '../../modules/Quotation/types';
|
|
6
6
|
import type { PaymentMethod } from '../../modules/Payment/types';
|
|
7
|
+
import type { OrderPaymentSource } from '../../modules/Order/types';
|
|
8
|
+
import type { SubmitPayloadEnhancer } from '../../modules/Order/utils';
|
|
7
9
|
/**
|
|
8
10
|
* BaseSales 流程 hook 后缀。
|
|
9
11
|
* 完整事件名应由当前模块名动态拼接,避免多个实例共享固定事件 key。
|
|
@@ -23,6 +25,15 @@ export type BaseSalesHookName = typeof BaseSalesHookNames[keyof typeof BaseSales
|
|
|
23
25
|
export declare function createBaseSalesHook(moduleName: string, hookName: BaseSalesHookName): string;
|
|
24
26
|
export type BaseSalesStatus = 'idle' | 'initializing' | 'ready' | 'error';
|
|
25
27
|
export type BaseSalesPaymentStatus = 'paid' | 'partially_paid' | 'unpaid' | 'payment_processing' | string;
|
|
28
|
+
export interface BaseSalesSubmitSalesOrderParams {
|
|
29
|
+
payments?: OrderPaymentSource[];
|
|
30
|
+
paymentStatus?: BaseSalesPaymentStatus;
|
|
31
|
+
smallTicketDataFlag?: number;
|
|
32
|
+
confirmPendingVoucherPayments?: boolean;
|
|
33
|
+
enhancePayload?: SubmitPayloadEnhancer;
|
|
34
|
+
/** Create the order without executing payment; payment status comes from the server. */
|
|
35
|
+
paymentExecution?: 'deferred';
|
|
36
|
+
}
|
|
26
37
|
export interface BaseSalesCashPaymentConfig {
|
|
27
38
|
available: boolean;
|
|
28
39
|
paymentMethod?: PaymentMethod;
|
|
@@ -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;
|
|
@@ -2664,7 +2664,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2664
2664
|
value: (function () {
|
|
2665
2665
|
var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(code, bridge) {
|
|
2666
2666
|
var _this7 = this;
|
|
2667
|
-
var trimmed, _bridge$onNotify, _bridge$refresh, localSearch, scanCallback, raw, formatted, _bridge$onNotify2, _result7, _bridge$onNotify3;
|
|
2667
|
+
var trimmed, _bridge$onNotify, _bridge$refresh, beforeScanCommit, beforeScanDialog, guardCallback, guardedBridge, localSearch, scanCallback, raw, formatted, _bridge$onNotify2, _result7, _bridge$onNotify3;
|
|
2668
2668
|
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
2669
2669
|
while (1) switch (_context32.prev = _context32.next) {
|
|
2670
2670
|
case 0:
|
|
@@ -2680,20 +2680,45 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2680
2680
|
});
|
|
2681
2681
|
case 4:
|
|
2682
2682
|
_context32.prev = 4;
|
|
2683
|
+
// Capture before lookup/UI awaits, so a result cannot land in a new cart.
|
|
2684
|
+
// Unscoped POS Order modules return a no-op guard.
|
|
2685
|
+
beforeScanCommit = this.store.order.createCartIntentCommitGuard('add_product');
|
|
2686
|
+
beforeScanDialog = this.store.order.createCartIntentCommitGuard('add_product');
|
|
2687
|
+
guardCallback = function guardCallback(callback) {
|
|
2688
|
+
return callback ? function () {
|
|
2689
|
+
beforeScanCommit();
|
|
2690
|
+
return callback.apply(void 0, arguments);
|
|
2691
|
+
} : undefined;
|
|
2692
|
+
};
|
|
2693
|
+
guardedBridge = bridge ? _objectSpread(_objectSpread({}, bridge), {}, {
|
|
2694
|
+
confirmDetail: guardCallback(bridge.confirmDetail),
|
|
2695
|
+
confirmBookingEdit: guardCallback(bridge.confirmBookingEdit),
|
|
2696
|
+
applyPromotionCode: guardCallback(bridge.applyPromotionCode),
|
|
2697
|
+
requestCustomerSwitch: guardCallback(bridge.requestCustomerSwitch),
|
|
2698
|
+
openOrder: guardCallback(bridge.openOrder),
|
|
2699
|
+
openProductDetail: bridge.openProductDetail ? function (payload) {
|
|
2700
|
+
beforeScanDialog();
|
|
2701
|
+
return bridge.openProductDetail(payload);
|
|
2702
|
+
} : undefined,
|
|
2703
|
+
openBookingEdit: bridge.openBookingEdit ? function (payload) {
|
|
2704
|
+
beforeScanDialog();
|
|
2705
|
+
return bridge.openBookingEdit(payload);
|
|
2706
|
+
} : undefined
|
|
2707
|
+
}) : undefined;
|
|
2683
2708
|
localSearch = function localSearch(v) {
|
|
2684
2709
|
return _this7.store.products.findProductsByCodeOrBarcode(v);
|
|
2685
2710
|
};
|
|
2686
2711
|
scanCallback = handleGlobalScan(this.request, localSearch, this.getSubmitOrderSalesChannel());
|
|
2687
|
-
_context32.next =
|
|
2712
|
+
_context32.next = 13;
|
|
2688
2713
|
return scanCallback({
|
|
2689
2714
|
type: 'nativeScanner',
|
|
2690
2715
|
value: trimmed
|
|
2691
2716
|
});
|
|
2692
|
-
case
|
|
2717
|
+
case 13:
|
|
2693
2718
|
raw = _context32.sent;
|
|
2694
2719
|
formatted = formatGlobalScanResult(raw, trimmed);
|
|
2695
2720
|
if (formatted) {
|
|
2696
|
-
_context32.next =
|
|
2721
|
+
_context32.next = 18;
|
|
2697
2722
|
break;
|
|
2698
2723
|
}
|
|
2699
2724
|
bridge === null || bridge === void 0 || (_bridge$onNotify2 = bridge.onNotify) === null || _bridge$onNotify2 === void 0 || _bridge$onNotify2.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
@@ -2701,11 +2726,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2701
2726
|
status: 'failed',
|
|
2702
2727
|
reason: 'not_found'
|
|
2703
2728
|
});
|
|
2704
|
-
case
|
|
2705
|
-
_context32.next =
|
|
2729
|
+
case 18:
|
|
2730
|
+
_context32.next = 20;
|
|
2706
2731
|
return applyGlobalScan({
|
|
2707
2732
|
setOrderCustomer: function setOrderCustomer(customer) {
|
|
2708
|
-
|
|
2733
|
+
beforeScanCommit();
|
|
2734
|
+
_this7.setOrderCustomer(customer);
|
|
2709
2735
|
},
|
|
2710
2736
|
getOrderCustomerSnapshot: function getOrderCustomerSnapshot() {
|
|
2711
2737
|
return _this7.getOrderCustomerSnapshot();
|
|
@@ -2730,21 +2756,23 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2730
2756
|
return _this7.transformDetailToProductAndBooking(input);
|
|
2731
2757
|
},
|
|
2732
2758
|
addProductToOrder: function addProductToOrder(product, booking) {
|
|
2759
|
+
beforeScanCommit();
|
|
2733
2760
|
return _this7.addProductToOrder(product, booking);
|
|
2734
2761
|
},
|
|
2735
2762
|
refreshWalletAssets: function refreshWalletAssets(params) {
|
|
2736
2763
|
return _this7.refreshWalletAssets(params);
|
|
2737
2764
|
},
|
|
2738
2765
|
scanWalletAsset: function scanWalletAsset(scanCode) {
|
|
2766
|
+
beforeScanCommit();
|
|
2739
2767
|
return _this7.scanWalletAsset(scanCode);
|
|
2740
2768
|
}
|
|
2741
|
-
}, formatted,
|
|
2742
|
-
case
|
|
2769
|
+
}, formatted, guardedBridge);
|
|
2770
|
+
case 20:
|
|
2743
2771
|
_result7 = _context32.sent;
|
|
2744
2772
|
bridge === null || bridge === void 0 || (_bridge$refresh = bridge.refresh) === null || _bridge$refresh === void 0 || _bridge$refresh.call(bridge);
|
|
2745
2773
|
return _context32.abrupt("return", _result7);
|
|
2746
|
-
case
|
|
2747
|
-
_context32.prev =
|
|
2774
|
+
case 25:
|
|
2775
|
+
_context32.prev = 25;
|
|
2748
2776
|
_context32.t0 = _context32["catch"](4);
|
|
2749
2777
|
console.error('[BookingTicket] handleGlobalScanCode failed', _context32.t0);
|
|
2750
2778
|
bridge === null || bridge === void 0 || (_bridge$onNotify3 = bridge.onNotify) === null || _bridge$onNotify3 === void 0 || _bridge$onNotify3.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
@@ -2752,11 +2780,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2752
2780
|
status: 'failed',
|
|
2753
2781
|
reason: 'not_found'
|
|
2754
2782
|
});
|
|
2755
|
-
case
|
|
2783
|
+
case 30:
|
|
2756
2784
|
case "end":
|
|
2757
2785
|
return _context32.stop();
|
|
2758
2786
|
}
|
|
2759
|
-
}, _callee32, this, [[4,
|
|
2787
|
+
}, _callee32, this, [[4, 25]]);
|
|
2760
2788
|
}));
|
|
2761
2789
|
function handleGlobalScanCode(_x21, _x22) {
|
|
2762
2790
|
return _handleGlobalScanCode.apply(this, arguments);
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { Module, ModuleOptions, PisellCore } from '../../types';
|
|
2
|
+
import { BaseModule } from '../../modules/BaseModule';
|
|
3
|
+
import type { InvoiceLayoutConfig } from '../../modules/OpenData';
|
|
4
|
+
import { type SmallTicketData } from '../../shared/receipt/small-ticket';
|
|
5
|
+
export interface OrderInvoicePreviewInput {
|
|
6
|
+
orderId: string | number;
|
|
7
|
+
tenantId: string | number;
|
|
8
|
+
shopId: string | number;
|
|
9
|
+
/** Changes on login/logout, without exposing credentials in state or cache keys. */
|
|
10
|
+
identity: string;
|
|
11
|
+
businessCode: string;
|
|
12
|
+
channel: string;
|
|
13
|
+
locale: string;
|
|
14
|
+
sourceRevision: string;
|
|
15
|
+
shop?: Record<string, any>;
|
|
16
|
+
}
|
|
17
|
+
export interface OrderInvoicePreviewResult {
|
|
18
|
+
identity: string;
|
|
19
|
+
sourceRevision: string;
|
|
20
|
+
generatedAt: string;
|
|
21
|
+
locale: string;
|
|
22
|
+
orderId: string | number;
|
|
23
|
+
source: Record<string, any>;
|
|
24
|
+
shop: Record<string, any>;
|
|
25
|
+
layout: InvoiceLayoutConfig;
|
|
26
|
+
smallTicketData: SmallTicketData;
|
|
27
|
+
}
|
|
28
|
+
export interface OrderInvoicePreviewState {
|
|
29
|
+
status: 'idle' | 'loading' | 'ready' | 'error';
|
|
30
|
+
result: OrderInvoicePreviewResult | null;
|
|
31
|
+
error: string | null;
|
|
32
|
+
}
|
|
33
|
+
/** Read-only, page-owned solution. No Order, Schedule, quotation or payment modules. */
|
|
34
|
+
export declare class OrderInvoicePreviewImpl extends BaseModule implements Module {
|
|
35
|
+
isSolution: boolean;
|
|
36
|
+
private request;
|
|
37
|
+
private state;
|
|
38
|
+
private listeners;
|
|
39
|
+
private generation;
|
|
40
|
+
private disposed;
|
|
41
|
+
private input?;
|
|
42
|
+
private activeKey;
|
|
43
|
+
private pending?;
|
|
44
|
+
private snapshotCache;
|
|
45
|
+
constructor(name?: string);
|
|
46
|
+
initialize(core: PisellCore, _options: ModuleOptions): void;
|
|
47
|
+
getState: () => OrderInvoicePreviewState;
|
|
48
|
+
subscribe: (listener: () => void) => (() => void);
|
|
49
|
+
private publish;
|
|
50
|
+
private getScope;
|
|
51
|
+
private loadContext;
|
|
52
|
+
private loadSource;
|
|
53
|
+
prepare(input: OrderInvoicePreviewInput): Promise<OrderInvoicePreviewResult>;
|
|
54
|
+
retry(): Promise<OrderInvoicePreviewResult>;
|
|
55
|
+
destroy(): void;
|
|
56
|
+
}
|