@pisell/pisellos 2.3.206 → 2.3.208
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/server/index.js +26 -13
- package/dist/solution/BaseSales/index.d.ts +2 -0
- package/dist/solution/BaseSales/index.js +65 -37
- package/dist/solution/BaseSales/types.d.ts +2 -0
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/BookingTicket/index.d.ts +8 -1
- package/dist/solution/BookingTicket/index.js +454 -328
- package/dist/solution/UnifiedBookingSales/index.js +34 -23
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/server/index.js +9 -4
- package/lib/solution/BaseSales/index.d.ts +2 -0
- package/lib/solution/BaseSales/index.js +27 -6
- package/lib/solution/BaseSales/types.d.ts +2 -0
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/BookingTicket/index.d.ts +8 -1
- package/lib/solution/BookingTicket/index.js +52 -5
- package/lib/solution/UnifiedBookingSales/index.js +3 -2
- package/package.json +1 -1
|
@@ -187,6 +187,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
187
187
|
_defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshCustomerId", null);
|
|
188
188
|
_defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshTarget", null);
|
|
189
189
|
_defineProperty(_assertThisInitialized(_this), "orderCustomerPromotionRefreshInFlight", null);
|
|
190
|
+
// Retain the settled result too: a failed refresh must remain observable by checkout callers.
|
|
191
|
+
_defineProperty(_assertThisInitialized(_this), "orderCustomerRefreshTask", Promise.resolve());
|
|
192
|
+
_defineProperty(_assertThisInitialized(_this), "orderCustomerRefreshRevision", 0);
|
|
190
193
|
_defineProperty(_assertThisInitialized(_this), "orderCustomerContactRequest", null);
|
|
191
194
|
_defineProperty(_assertThisInitialized(_this), "customerResolveRequests", new Map());
|
|
192
195
|
_defineProperty(_assertThisInitialized(_this), "loadOpenDataInFlight", null);
|
|
@@ -630,7 +633,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
630
633
|
value: function () {
|
|
631
634
|
var _configureIdGeneratorFromOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
632
635
|
var _this$otherParams5, _openDataConfig, _openDataConfig2, _openDataConfig3, _openDataConfig4, _openDataConfig5, _openDataConfig6;
|
|
633
|
-
var idGenerator, openDataConfig, receiptSequenceLength, receiptSequenceStart, prefix, shopOrderPrefix, resetReceiptSequenceDaily, operatingDayBoundary, deviceId, businessCode, _openDataConfig7, _openDataConfig8, _openDataConfig9;
|
|
636
|
+
var idGenerator, openDataConfig, receiptSequenceLength, receiptSequenceStart, prefix, shopOrderPrefix, resetReceiptSequenceDaily, operatingDayBoundary, deviceId, businessCode, _openDataConfig7, _openDataConfig8, _openDataConfig9, _openDataConfig10;
|
|
634
637
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
635
638
|
while (1) switch (_context10.prev = _context10.next) {
|
|
636
639
|
case 0:
|
|
@@ -691,12 +694,13 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
691
694
|
return idGenerator.configure({
|
|
692
695
|
biz: businessCode,
|
|
693
696
|
config: {
|
|
697
|
+
enableShortNumber: ((_openDataConfig7 = openDataConfig) === null || _openDataConfig7 === void 0 ? void 0 : _openDataConfig7['sale.enable_short_number']) !== false,
|
|
694
698
|
prefix: prefix,
|
|
695
699
|
deviceCode: deviceId,
|
|
696
|
-
padReceiptSequence: ((
|
|
700
|
+
padReceiptSequence: ((_openDataConfig8 = openDataConfig) === null || _openDataConfig8 === void 0 ? void 0 : _openDataConfig8['sale.pad_with_leading_zeros']) === true,
|
|
697
701
|
receiptSequenceLength: receiptSequenceLength,
|
|
698
|
-
receiptSequenceMax: this.normalizeShortNumberMaximum((
|
|
699
|
-
randomReceiptSequence: ((
|
|
702
|
+
receiptSequenceMax: this.normalizeShortNumberMaximum((_openDataConfig9 = openDataConfig) === null || _openDataConfig9 === void 0 ? void 0 : _openDataConfig9['sale.maximum_number']),
|
|
703
|
+
randomReceiptSequence: ((_openDataConfig10 = openDataConfig) === null || _openDataConfig10 === void 0 ? void 0 : _openDataConfig10['sale.short_number_random']) === true,
|
|
700
704
|
resetReceiptSequenceDaily: resetReceiptSequenceDaily,
|
|
701
705
|
receiptSequenceResetTime: operatingDayBoundary === null || operatingDayBoundary === void 0 ? void 0 : operatingDayBoundary.time,
|
|
702
706
|
receiptSequenceStart: receiptSequenceStart,
|
|
@@ -1852,12 +1856,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1852
1856
|
}
|
|
1853
1857
|
return;
|
|
1854
1858
|
}
|
|
1859
|
+
var enableMemberCartConsistency = this.isMemberCartConsistencyEnabled();
|
|
1855
1860
|
var next = this.buildOrderCustomerPayload();
|
|
1856
1861
|
this.core.effects.emit("".concat(this.name, ":onOrderCustomerChange"), next && options !== null && options !== void 0 && options.source ? _objectSpread(_objectSpread({}, next), {}, {
|
|
1857
1862
|
source: options.source
|
|
1858
1863
|
}) : next);
|
|
1859
|
-
|
|
1860
|
-
|
|
1864
|
+
if (enableMemberCartConsistency) {
|
|
1865
|
+
this.refreshMemberCartContext(patch.customer_id);
|
|
1866
|
+
return;
|
|
1867
|
+
}
|
|
1868
|
+
void this.refreshDiscountConfigAfterOrderCustomerChange(patch.customer_id);
|
|
1861
1869
|
var promotionRefreshTask = this.store.order.applyPromotion().then(function () {
|
|
1862
1870
|
return undefined;
|
|
1863
1871
|
});
|
|
@@ -1871,6 +1879,85 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1871
1879
|
_this3.orderCustomerPromotionRefreshInFlight = null;
|
|
1872
1880
|
});
|
|
1873
1881
|
}
|
|
1882
|
+
|
|
1883
|
+
/** Shared by customer changes and an explicit retry; keep the selected customer/cart intact. */
|
|
1884
|
+
}, {
|
|
1885
|
+
key: "refreshMemberCartContext",
|
|
1886
|
+
value: function refreshMemberCartContext(customerId) {
|
|
1887
|
+
var _this4 = this;
|
|
1888
|
+
var revision = ++this.orderCustomerRefreshRevision;
|
|
1889
|
+
var orderKey = this.getCustomerContactOrderKey();
|
|
1890
|
+
var isCurrent = function isCurrent() {
|
|
1891
|
+
var _this4$store$order$ge;
|
|
1892
|
+
return revision === _this4.orderCustomerRefreshRevision && _this4.getCustomerContactOrderKey() === orderKey && Number(((_this4$store$order$ge = _this4.store.order.getOrderCustomer()) === null || _this4$store$order$ge === void 0 ? void 0 : _this4$store$order$ge.customer_id) || 0) === Number(customerId || 0);
|
|
1893
|
+
};
|
|
1894
|
+
var task = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
|
|
1895
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
1896
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
1897
|
+
case 0:
|
|
1898
|
+
if (!customerId) {
|
|
1899
|
+
_context26.next = 5;
|
|
1900
|
+
break;
|
|
1901
|
+
}
|
|
1902
|
+
_context26.next = 3;
|
|
1903
|
+
return _this4.refreshDiscountConfigAfterOrderCustomerChange(customerId);
|
|
1904
|
+
case 3:
|
|
1905
|
+
_context26.next = 7;
|
|
1906
|
+
break;
|
|
1907
|
+
case 5:
|
|
1908
|
+
_context26.next = 7;
|
|
1909
|
+
return _this4.loadDiscountConfig({
|
|
1910
|
+
force: true
|
|
1911
|
+
});
|
|
1912
|
+
case 7:
|
|
1913
|
+
if (!isCurrent()) {
|
|
1914
|
+
_context26.next = 10;
|
|
1915
|
+
break;
|
|
1916
|
+
}
|
|
1917
|
+
_context26.next = 10;
|
|
1918
|
+
return _this4.store.order.applyPromotion();
|
|
1919
|
+
case 10:
|
|
1920
|
+
case "end":
|
|
1921
|
+
return _context26.stop();
|
|
1922
|
+
}
|
|
1923
|
+
}, _callee26);
|
|
1924
|
+
}))();
|
|
1925
|
+
this.orderCustomerRefreshTask = task;
|
|
1926
|
+
this.orderCustomerPromotionRefreshInFlight = task;
|
|
1927
|
+
void task.catch(function (error) {
|
|
1928
|
+
if (isCurrent()) console.error('[BookingTicket] Member cart refresh failed', error);
|
|
1929
|
+
}).finally(function () {
|
|
1930
|
+
if (_this4.orderCustomerPromotionRefreshInFlight === task) _this4.orderCustomerPromotionRefreshInFlight = null;
|
|
1931
|
+
});
|
|
1932
|
+
}
|
|
1933
|
+
}, {
|
|
1934
|
+
key: "retryOrderCustomerRefresh",
|
|
1935
|
+
value: function () {
|
|
1936
|
+
var _retryOrderCustomerRefresh = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
|
|
1937
|
+
var _this$store$order$get4, _this$store$order$get5;
|
|
1938
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
1939
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
1940
|
+
case 0:
|
|
1941
|
+
if (this.isMemberCartConsistencyEnabled()) {
|
|
1942
|
+
_context27.next = 2;
|
|
1943
|
+
break;
|
|
1944
|
+
}
|
|
1945
|
+
return _context27.abrupt("return");
|
|
1946
|
+
case 2:
|
|
1947
|
+
this.refreshMemberCartContext((_this$store$order$get4 = (_this$store$order$get5 = this.store.order.getOrderCustomer()) === null || _this$store$order$get5 === void 0 ? void 0 : _this$store$order$get5.customer_id) !== null && _this$store$order$get4 !== void 0 ? _this$store$order$get4 : null);
|
|
1948
|
+
_context27.next = 5;
|
|
1949
|
+
return this.waitForOrderCustomerRefresh();
|
|
1950
|
+
case 5:
|
|
1951
|
+
case "end":
|
|
1952
|
+
return _context27.stop();
|
|
1953
|
+
}
|
|
1954
|
+
}, _callee27, this);
|
|
1955
|
+
}));
|
|
1956
|
+
function retryOrderCustomerRefresh() {
|
|
1957
|
+
return _retryOrderCustomerRefresh.apply(this, arguments);
|
|
1958
|
+
}
|
|
1959
|
+
return retryOrderCustomerRefresh;
|
|
1960
|
+
}()
|
|
1874
1961
|
}, {
|
|
1875
1962
|
key: "resetOrderCustomerContactInfo",
|
|
1876
1963
|
value: function resetOrderCustomerContactInfo() {
|
|
@@ -1907,25 +1994,25 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1907
1994
|
}, {
|
|
1908
1995
|
key: "replaceTempOrder",
|
|
1909
1996
|
value: function () {
|
|
1910
|
-
var _replaceTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1997
|
+
var _replaceTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
|
|
1911
1998
|
var _get2;
|
|
1912
1999
|
var _len2,
|
|
1913
2000
|
args,
|
|
1914
2001
|
_key2,
|
|
1915
|
-
|
|
1916
|
-
return _regeneratorRuntime().wrap(function
|
|
1917
|
-
while (1) switch (
|
|
2002
|
+
_args28 = arguments;
|
|
2003
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2004
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
1918
2005
|
case 0:
|
|
1919
2006
|
this.orderCustomerContactRequest = null;
|
|
1920
|
-
for (_len2 =
|
|
1921
|
-
args[_key2] =
|
|
2007
|
+
for (_len2 = _args28.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
2008
|
+
args[_key2] = _args28[_key2];
|
|
1922
2009
|
}
|
|
1923
|
-
return
|
|
2010
|
+
return _context28.abrupt("return", (_get2 = _get(_getPrototypeOf(BookingTicketImpl.prototype), "replaceTempOrder", this)).call.apply(_get2, [this].concat(args)));
|
|
1924
2011
|
case 3:
|
|
1925
2012
|
case "end":
|
|
1926
|
-
return
|
|
2013
|
+
return _context28.stop();
|
|
1927
2014
|
}
|
|
1928
|
-
},
|
|
2015
|
+
}, _callee28, this);
|
|
1929
2016
|
}));
|
|
1930
2017
|
function replaceTempOrder() {
|
|
1931
2018
|
return _replaceTempOrder.apply(this, arguments);
|
|
@@ -1935,21 +2022,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1935
2022
|
}, {
|
|
1936
2023
|
key: "applyDefaultOrderCustomerContactInfo",
|
|
1937
2024
|
value: function () {
|
|
1938
|
-
var _applyDefaultOrderCustomerContactInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1939
|
-
return _regeneratorRuntime().wrap(function
|
|
1940
|
-
while (1) switch (
|
|
2025
|
+
var _applyDefaultOrderCustomerContactInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(contact) {
|
|
2026
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2027
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
1941
2028
|
case 0:
|
|
1942
2029
|
this.store.order.updateTempOrderContactsInfo(cloneDeep(contact));
|
|
1943
2030
|
// Metadata may finish after promotion/discount refresh; publish the updated cart explicitly.
|
|
1944
|
-
|
|
2031
|
+
_context29.next = 3;
|
|
1945
2032
|
return this.effectsEmit('onTempOrderReplaced', {
|
|
1946
2033
|
tempOrder: this.getTempOrder()
|
|
1947
2034
|
});
|
|
1948
2035
|
case 3:
|
|
1949
2036
|
case "end":
|
|
1950
|
-
return
|
|
2037
|
+
return _context29.stop();
|
|
1951
2038
|
}
|
|
1952
|
-
},
|
|
2039
|
+
}, _callee29, this);
|
|
1953
2040
|
}));
|
|
1954
2041
|
function applyDefaultOrderCustomerContactInfo(_x17) {
|
|
1955
2042
|
return _applyDefaultOrderCustomerContactInfo.apply(this, arguments);
|
|
@@ -1961,7 +2048,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1961
2048
|
value: function prefillOrderCustomerContactInfo(customer, customerChanged) {
|
|
1962
2049
|
var _order$_extend2,
|
|
1963
2050
|
_this$otherParams9,
|
|
1964
|
-
|
|
2051
|
+
_this5 = this;
|
|
1965
2052
|
var order = this.getTempOrder();
|
|
1966
2053
|
var customerId = Number(order === null || order === void 0 ? void 0 : order.customer_id);
|
|
1967
2054
|
if (!order || !Number.isInteger(customerId) || customerId <= 1 || order.contacts_info != null || (_order$_extend2 = order._extend) !== null && _order$_extend2 !== void 0 && _order$_extend2.contactInfoEdited) return;
|
|
@@ -1978,8 +2065,8 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1978
2065
|
if (customer.contacts_info !== undefined) return;
|
|
1979
2066
|
var userPlatform = isCustomerUserPlatform((_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.platform);
|
|
1980
2067
|
var getAuthenticatedCustomerId = function getAuthenticatedCustomerId() {
|
|
1981
|
-
var
|
|
1982
|
-
return Number((
|
|
2068
|
+
var _this5$core, _this5$core$getPlugin, _this5$core$getPlugin2;
|
|
2069
|
+
return Number((_this5$core = _this5.core) === null || _this5$core === void 0 || (_this5$core$getPlugin = _this5$core.getPlugin) === null || _this5$core$getPlugin === void 0 || (_this5$core$getPlugin = _this5$core$getPlugin.call(_this5$core, 'user')) === null || _this5$core$getPlugin === void 0 || (_this5$core$getPlugin2 = _this5$core$getPlugin.get) === null || _this5$core$getPlugin2 === void 0 || (_this5$core$getPlugin2 = _this5$core$getPlugin2.call(_this5$core$getPlugin)) === null || _this5$core$getPlugin2 === void 0 ? void 0 : _this5$core$getPlugin2.id);
|
|
1983
2070
|
};
|
|
1984
2071
|
if (userPlatform && getAuthenticatedCustomerId() !== customerId) return;
|
|
1985
2072
|
var scope = this.getCustomerContactScope();
|
|
@@ -1994,76 +2081,76 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1994
2081
|
};
|
|
1995
2082
|
this.orderCustomerContactRequest = pending;
|
|
1996
2083
|
var loadContact = /*#__PURE__*/function () {
|
|
1997
|
-
var
|
|
2084
|
+
var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
|
|
1998
2085
|
var _result4, resolved;
|
|
1999
|
-
return _regeneratorRuntime().wrap(function
|
|
2000
|
-
while (1) switch (
|
|
2086
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
2087
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
2001
2088
|
case 0:
|
|
2002
2089
|
if (!userPlatform) {
|
|
2003
|
-
|
|
2090
|
+
_context30.next = 7;
|
|
2004
2091
|
break;
|
|
2005
2092
|
}
|
|
2006
|
-
|
|
2007
|
-
return
|
|
2093
|
+
_context30.next = 3;
|
|
2094
|
+
return _this5.request.get('/customer/metadata', {
|
|
2008
2095
|
key: 'contacts_info'
|
|
2009
2096
|
});
|
|
2010
2097
|
case 3:
|
|
2011
|
-
_result4 =
|
|
2098
|
+
_result4 = _context30.sent;
|
|
2012
2099
|
if (!((_result4 === null || _result4 === void 0 ? void 0 : _result4.code) !== 200 || (_result4 === null || _result4 === void 0 ? void 0 : _result4.status) === false)) {
|
|
2013
|
-
|
|
2100
|
+
_context30.next = 6;
|
|
2014
2101
|
break;
|
|
2015
2102
|
}
|
|
2016
2103
|
throw new Error('Customer contact lookup failed');
|
|
2017
2104
|
case 6:
|
|
2018
|
-
return
|
|
2105
|
+
return _context30.abrupt("return", isContactRecord(_result4.data) ? _result4.data : null);
|
|
2019
2106
|
case 7:
|
|
2020
|
-
|
|
2021
|
-
return
|
|
2107
|
+
_context30.next = 9;
|
|
2108
|
+
return _this5.resolveCustomerById(customerId);
|
|
2022
2109
|
case 9:
|
|
2023
|
-
resolved =
|
|
2024
|
-
return
|
|
2110
|
+
resolved = _context30.sent;
|
|
2111
|
+
return _context30.abrupt("return", Number(resolved === null || resolved === void 0 ? void 0 : resolved.id) === customerId ? extractCustomerContactInfo(resolved) : null);
|
|
2025
2112
|
case 11:
|
|
2026
2113
|
case "end":
|
|
2027
|
-
return
|
|
2114
|
+
return _context30.stop();
|
|
2028
2115
|
}
|
|
2029
|
-
},
|
|
2116
|
+
}, _callee30);
|
|
2030
2117
|
}));
|
|
2031
2118
|
return function loadContact() {
|
|
2032
|
-
return
|
|
2119
|
+
return _ref12.apply(this, arguments);
|
|
2033
2120
|
};
|
|
2034
2121
|
}();
|
|
2035
2122
|
pending.promise = loadContact().then( /*#__PURE__*/function () {
|
|
2036
|
-
var
|
|
2123
|
+
var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(value) {
|
|
2037
2124
|
var _current$_extend;
|
|
2038
2125
|
var current;
|
|
2039
|
-
return _regeneratorRuntime().wrap(function
|
|
2040
|
-
while (1) switch (
|
|
2126
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
2127
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
2041
2128
|
case 0:
|
|
2042
|
-
current =
|
|
2043
|
-
if (!(
|
|
2044
|
-
|
|
2129
|
+
current = _this5.getTempOrder();
|
|
2130
|
+
if (!(_this5.orderCustomerContactRequest !== pending || _this5.getCustomerContactOrderKey() !== orderKey || Number(current === null || current === void 0 ? void 0 : current.customer_id) !== customerId || scope !== _this5.getCustomerContactScope() || current !== null && current !== void 0 && (_current$_extend = current._extend) !== null && _current$_extend !== void 0 && _current$_extend.contactInfoEdited || (current === null || current === void 0 ? void 0 : current.contacts_info) != null || userPlatform && getAuthenticatedCustomerId() !== customerId)) {
|
|
2131
|
+
_context31.next = 3;
|
|
2045
2132
|
break;
|
|
2046
2133
|
}
|
|
2047
|
-
return
|
|
2134
|
+
return _context31.abrupt("return");
|
|
2048
2135
|
case 3:
|
|
2049
2136
|
if (!value) {
|
|
2050
|
-
|
|
2137
|
+
_context31.next = 6;
|
|
2051
2138
|
break;
|
|
2052
2139
|
}
|
|
2053
|
-
|
|
2054
|
-
return
|
|
2140
|
+
_context31.next = 6;
|
|
2141
|
+
return _this5.applyDefaultOrderCustomerContactInfo(value);
|
|
2055
2142
|
case 6:
|
|
2056
2143
|
case "end":
|
|
2057
|
-
return
|
|
2144
|
+
return _context31.stop();
|
|
2058
2145
|
}
|
|
2059
|
-
},
|
|
2146
|
+
}, _callee31);
|
|
2060
2147
|
}));
|
|
2061
2148
|
return function (_x18) {
|
|
2062
|
-
return
|
|
2149
|
+
return _ref13.apply(this, arguments);
|
|
2063
2150
|
};
|
|
2064
2151
|
}()).catch(function () {
|
|
2065
2152
|
// A failed default does not prevent manual entry; a subsequent sync can retry.
|
|
2066
|
-
if (
|
|
2153
|
+
if (_this5.orderCustomerContactRequest === pending) _this5.orderCustomerContactRequest = null;
|
|
2067
2154
|
console.warn('[BookingTicket] Failed to load saved customer contact information');
|
|
2068
2155
|
});
|
|
2069
2156
|
}
|
|
@@ -2076,31 +2163,31 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2076
2163
|
}, {
|
|
2077
2164
|
key: "validateContactInfo",
|
|
2078
2165
|
value: function () {
|
|
2079
|
-
var _validateContactInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2166
|
+
var _validateContactInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
|
|
2080
2167
|
var _this$getTempOrder, _this$getTempOrder2;
|
|
2081
2168
|
var orderKey, customerId, scope;
|
|
2082
|
-
return _regeneratorRuntime().wrap(function
|
|
2083
|
-
while (1) switch (
|
|
2169
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
2170
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
2084
2171
|
case 0:
|
|
2085
2172
|
orderKey = this.getCustomerContactOrderKey();
|
|
2086
2173
|
customerId = (_this$getTempOrder = this.getTempOrder()) === null || _this$getTempOrder === void 0 ? void 0 : _this$getTempOrder.customer_id;
|
|
2087
2174
|
scope = this.getCustomerContactScope();
|
|
2088
|
-
|
|
2175
|
+
_context32.next = 5;
|
|
2089
2176
|
return this.waitForOrderCustomerContactInfo();
|
|
2090
2177
|
case 5:
|
|
2091
2178
|
if (!(this.getCustomerContactOrderKey() !== orderKey || ((_this$getTempOrder2 = this.getTempOrder()) === null || _this$getTempOrder2 === void 0 ? void 0 : _this$getTempOrder2.customer_id) !== customerId || this.getCustomerContactScope() !== scope)) {
|
|
2092
|
-
|
|
2179
|
+
_context32.next = 7;
|
|
2093
2180
|
break;
|
|
2094
2181
|
}
|
|
2095
2182
|
throw new Error('The order changed. Please try again.');
|
|
2096
2183
|
case 7:
|
|
2097
|
-
|
|
2184
|
+
_context32.next = 9;
|
|
2098
2185
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "validateContactInfo", this).call(this);
|
|
2099
2186
|
case 9:
|
|
2100
2187
|
case "end":
|
|
2101
|
-
return
|
|
2188
|
+
return _context32.stop();
|
|
2102
2189
|
}
|
|
2103
|
-
},
|
|
2190
|
+
}, _callee32, this);
|
|
2104
2191
|
}));
|
|
2105
2192
|
function validateContactInfo() {
|
|
2106
2193
|
return _validateContactInfo.apply(this, arguments);
|
|
@@ -2133,7 +2220,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2133
2220
|
value: function clearOrderCustomer(options) {
|
|
2134
2221
|
var _discountModule$setOr,
|
|
2135
2222
|
_discountModule$setDi,
|
|
2136
|
-
|
|
2223
|
+
_this6 = this;
|
|
2224
|
+
var enableMemberCartConsistency = this.isMemberCartConsistencyEnabled();
|
|
2225
|
+
var refreshRevision = enableMemberCartConsistency ? ++this.orderCustomerRefreshRevision : undefined;
|
|
2137
2226
|
this.orderCustomerContactRequest = null;
|
|
2138
2227
|
if (!(options !== null && options !== void 0 && options.preserveContactInfo)) this.resetOrderCustomerContactInfo();
|
|
2139
2228
|
if (!(options !== null && options !== void 0 && options.preserveContactInfo)) this.store.order.updateTempOrderContactsInfo(null);
|
|
@@ -2145,19 +2234,25 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2145
2234
|
void (discountModule === null || discountModule === void 0 || (_discountModule$setOr = discountModule.setOriginalDiscountList) === null || _discountModule$setOr === void 0 ? void 0 : _discountModule$setOr.call(discountModule, []));
|
|
2146
2235
|
void (discountModule === null || discountModule === void 0 || (_discountModule$setDi = discountModule.setDiscountList) === null || _discountModule$setDi === void 0 ? void 0 : _discountModule$setDi.call(discountModule, []));
|
|
2147
2236
|
this.store.order.applyDiscount();
|
|
2148
|
-
|
|
2237
|
+
var customerOrderKey = enableMemberCartConsistency ? this.getCustomerContactOrderKey() : undefined;
|
|
2238
|
+
var refreshTask = this.store.order.recalculateSummary({
|
|
2149
2239
|
createIfMissing: true
|
|
2150
2240
|
}).then(function () {
|
|
2151
2241
|
var _discountModule$getDi;
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2242
|
+
if (enableMemberCartConsistency && (_this6.orderCustomerRefreshRevision !== refreshRevision || _this6.getCustomerContactOrderKey() !== customerOrderKey)) return;
|
|
2243
|
+
var tempOrder = _this6.store.order.ensureTempOrder();
|
|
2244
|
+
_this6.store.order.persistTempOrder();
|
|
2245
|
+
return _this6.effectsEmit('onDiscountApplied', {
|
|
2155
2246
|
productList: tempOrder.products || [],
|
|
2156
2247
|
discountList: (discountModule === null || discountModule === void 0 || (_discountModule$getDi = discountModule.getDiscountList) === null || _discountModule$getDi === void 0 ? void 0 : _discountModule$getDi.call(discountModule)) || [],
|
|
2157
2248
|
selectedDiscountList: tempOrder.discount_list || [],
|
|
2158
2249
|
tempOrder: tempOrder
|
|
2159
2250
|
});
|
|
2160
|
-
})
|
|
2251
|
+
});
|
|
2252
|
+
if (enableMemberCartConsistency) this.orderCustomerRefreshTask = refreshTask.then(function () {
|
|
2253
|
+
return undefined;
|
|
2254
|
+
});
|
|
2255
|
+
void (enableMemberCartConsistency ? this.orderCustomerRefreshTask : refreshTask).catch(function (error) {
|
|
2161
2256
|
console.error('Failed to recalculate summary after clearing customer:', error);
|
|
2162
2257
|
});
|
|
2163
2258
|
this.core.effects.emit("".concat(this.name, ":onOrderCustomerChange"), null);
|
|
@@ -2175,24 +2270,24 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2175
2270
|
}, {
|
|
2176
2271
|
key: "restoreOrder",
|
|
2177
2272
|
value: (function () {
|
|
2178
|
-
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2273
|
+
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
|
|
2179
2274
|
var _this$store$customer;
|
|
2180
2275
|
var tempOrder;
|
|
2181
|
-
return _regeneratorRuntime().wrap(function
|
|
2182
|
-
while (1) switch (
|
|
2276
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
2277
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
2183
2278
|
case 0:
|
|
2184
|
-
|
|
2279
|
+
_context33.next = 2;
|
|
2185
2280
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "restoreOrder", this).call(this);
|
|
2186
2281
|
case 2:
|
|
2187
|
-
tempOrder =
|
|
2282
|
+
tempOrder = _context33.sent;
|
|
2188
2283
|
this.clearOrderCustomer();
|
|
2189
2284
|
(_this$store$customer = this.store.customer) === null || _this$store$customer === void 0 || _this$store$customer.setSelectedCustomer(null);
|
|
2190
|
-
return
|
|
2285
|
+
return _context33.abrupt("return", tempOrder);
|
|
2191
2286
|
case 6:
|
|
2192
2287
|
case "end":
|
|
2193
|
-
return
|
|
2288
|
+
return _context33.stop();
|
|
2194
2289
|
}
|
|
2195
|
-
},
|
|
2290
|
+
}, _callee33, this);
|
|
2196
2291
|
}));
|
|
2197
2292
|
function restoreOrder() {
|
|
2198
2293
|
return _restoreOrder.apply(this, arguments);
|
|
@@ -2212,12 +2307,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2212
2307
|
}, {
|
|
2213
2308
|
key: "refreshDiscountConfigAfterOrderCustomerChange",
|
|
2214
2309
|
value: function refreshDiscountConfigAfterOrderCustomerChange(customerId) {
|
|
2215
|
-
var _this$store$order$
|
|
2310
|
+
var _this$store$order$get6,
|
|
2216
2311
|
_this$store$order6,
|
|
2217
2312
|
_this$getOrderIdentit,
|
|
2218
|
-
|
|
2313
|
+
_this7 = this;
|
|
2219
2314
|
if (!customerId || customerId === 1) return Promise.resolve();
|
|
2220
|
-
var tempOrder = (_this$store$order$
|
|
2315
|
+
var tempOrder = (_this$store$order$get6 = (_this$store$order6 = this.store.order).getTempOrder) === null || _this$store$order$get6 === void 0 ? void 0 : _this$store$order$get6.call(_this$store$order6);
|
|
2221
2316
|
var orderIdentity = (_this$getOrderIdentit = this.getOrderIdentity) === null || _this$getOrderIdentit === void 0 ? void 0 : _this$getOrderIdentit.call(this);
|
|
2222
2317
|
var orderId = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.order_id) || (orderIdentity === null || orderIdentity === void 0 ? void 0 : orderIdentity.orderId);
|
|
2223
2318
|
var action = !orderId || String(orderId).startsWith('local_order') ? 'create' : 'edit';
|
|
@@ -2227,50 +2322,50 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2227
2322
|
return this.orderCustomerDiscountRefreshInFlight;
|
|
2228
2323
|
}
|
|
2229
2324
|
var previousRefresh = this.orderCustomerDiscountRefreshInFlight;
|
|
2230
|
-
var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2231
|
-
var
|
|
2325
|
+
var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
|
|
2326
|
+
var _this7$store$order$ge, _this7$store$order, _this7$getOrderIdenti;
|
|
2232
2327
|
var currentCustomer, currentTempOrder, currentOrderIdentity, currentOrderId, currentAction, currentOrderTarget;
|
|
2233
|
-
return _regeneratorRuntime().wrap(function
|
|
2234
|
-
while (1) switch (
|
|
2328
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
2329
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
2235
2330
|
case 0:
|
|
2236
2331
|
if (!previousRefresh) {
|
|
2237
|
-
|
|
2332
|
+
_context34.next = 3;
|
|
2238
2333
|
break;
|
|
2239
2334
|
}
|
|
2240
|
-
|
|
2335
|
+
_context34.next = 3;
|
|
2241
2336
|
return previousRefresh.catch(function () {
|
|
2242
2337
|
return undefined;
|
|
2243
2338
|
});
|
|
2244
2339
|
case 3:
|
|
2245
|
-
currentCustomer =
|
|
2340
|
+
currentCustomer = _this7.store.order.getOrderCustomer();
|
|
2246
2341
|
if (!(!currentCustomer || Number(currentCustomer.customer_id) !== customerId)) {
|
|
2247
|
-
|
|
2342
|
+
_context34.next = 6;
|
|
2248
2343
|
break;
|
|
2249
2344
|
}
|
|
2250
|
-
return
|
|
2345
|
+
return _context34.abrupt("return");
|
|
2251
2346
|
case 6:
|
|
2252
|
-
currentTempOrder = (
|
|
2253
|
-
currentOrderIdentity = (
|
|
2347
|
+
currentTempOrder = (_this7$store$order$ge = (_this7$store$order = _this7.store.order).getTempOrder) === null || _this7$store$order$ge === void 0 ? void 0 : _this7$store$order$ge.call(_this7$store$order);
|
|
2348
|
+
currentOrderIdentity = (_this7$getOrderIdenti = _this7.getOrderIdentity) === null || _this7$getOrderIdenti === void 0 ? void 0 : _this7$getOrderIdenti.call(_this7);
|
|
2254
2349
|
currentOrderId = (currentTempOrder === null || currentTempOrder === void 0 ? void 0 : currentTempOrder.order_id) || (currentOrderIdentity === null || currentOrderIdentity === void 0 ? void 0 : currentOrderIdentity.orderId);
|
|
2255
2350
|
currentAction = !currentOrderId || String(currentOrderId).startsWith('local_order') ? 'create' : 'edit';
|
|
2256
2351
|
currentOrderTarget = currentOrderId ? "order:".concat(String(currentOrderId)) : "external:".concat(String((currentTempOrder === null || currentTempOrder === void 0 ? void 0 : currentTempOrder.external_sale_number) || (currentOrderIdentity === null || currentOrderIdentity === void 0 ? void 0 : currentOrderIdentity.externalSaleNumber) || (currentOrderIdentity === null || currentOrderIdentity === void 0 ? void 0 : currentOrderIdentity.localId) || 'new'));
|
|
2257
2352
|
if (!("".concat(customerId, ":").concat(currentAction, ":").concat(currentOrderTarget) !== refreshTarget)) {
|
|
2258
|
-
|
|
2353
|
+
_context34.next = 13;
|
|
2259
2354
|
break;
|
|
2260
2355
|
}
|
|
2261
|
-
return
|
|
2356
|
+
return _context34.abrupt("return");
|
|
2262
2357
|
case 13:
|
|
2263
|
-
|
|
2264
|
-
return
|
|
2358
|
+
_context34.next = 15;
|
|
2359
|
+
return _this7.loadDiscountConfig({
|
|
2265
2360
|
customerId: customerId,
|
|
2266
2361
|
action: action,
|
|
2267
2362
|
force: true
|
|
2268
2363
|
});
|
|
2269
2364
|
case 15:
|
|
2270
2365
|
case "end":
|
|
2271
|
-
return
|
|
2366
|
+
return _context34.stop();
|
|
2272
2367
|
}
|
|
2273
|
-
},
|
|
2368
|
+
}, _callee34);
|
|
2274
2369
|
}))();
|
|
2275
2370
|
this.orderCustomerDiscountRefreshInFlight = refreshTask;
|
|
2276
2371
|
this.orderCustomerDiscountRefreshCustomerId = customerId;
|
|
@@ -2278,10 +2373,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2278
2373
|
refreshTask.catch(function (error) {
|
|
2279
2374
|
console.error('Failed to load discount config after customer change:', error);
|
|
2280
2375
|
}).finally(function () {
|
|
2281
|
-
if (
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2376
|
+
if (_this7.orderCustomerDiscountRefreshInFlight !== refreshTask) return;
|
|
2377
|
+
_this7.orderCustomerDiscountRefreshInFlight = null;
|
|
2378
|
+
_this7.orderCustomerDiscountRefreshCustomerId = null;
|
|
2379
|
+
_this7.orderCustomerDiscountRefreshTarget = null;
|
|
2285
2380
|
});
|
|
2286
2381
|
return refreshTask;
|
|
2287
2382
|
}
|
|
@@ -2290,31 +2385,62 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2290
2385
|
value: function waitForOrderCustomerPromotionRefresh() {
|
|
2291
2386
|
return this.orderCustomerPromotionRefreshInFlight || Promise.resolve();
|
|
2292
2387
|
}
|
|
2388
|
+
|
|
2389
|
+
/** Wait before reading cart rows: member coupons can split or consolidate them. */
|
|
2390
|
+
}, {
|
|
2391
|
+
key: "waitForOrderCustomerRefresh",
|
|
2392
|
+
value: (function () {
|
|
2393
|
+
var _waitForOrderCustomerRefresh = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
|
|
2394
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
2395
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
2396
|
+
case 0:
|
|
2397
|
+
if (this.isMemberCartConsistencyEnabled()) {
|
|
2398
|
+
_context35.next = 2;
|
|
2399
|
+
break;
|
|
2400
|
+
}
|
|
2401
|
+
return _context35.abrupt("return");
|
|
2402
|
+
case 2:
|
|
2403
|
+
_context35.next = 4;
|
|
2404
|
+
return Promise.resolve();
|
|
2405
|
+
case 4:
|
|
2406
|
+
_context35.next = 6;
|
|
2407
|
+
return this.orderCustomerRefreshTask;
|
|
2408
|
+
case 6:
|
|
2409
|
+
case "end":
|
|
2410
|
+
return _context35.stop();
|
|
2411
|
+
}
|
|
2412
|
+
}, _callee35, this);
|
|
2413
|
+
}));
|
|
2414
|
+
function waitForOrderCustomerRefresh() {
|
|
2415
|
+
return _waitForOrderCustomerRefresh.apply(this, arguments);
|
|
2416
|
+
}
|
|
2417
|
+
return waitForOrderCustomerRefresh;
|
|
2418
|
+
}())
|
|
2293
2419
|
}, {
|
|
2294
2420
|
key: "prepareProductPriceQueryContext",
|
|
2295
2421
|
value: function () {
|
|
2296
|
-
var _prepareProductPriceQueryContext = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2422
|
+
var _prepareProductPriceQueryContext = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(customerId) {
|
|
2297
2423
|
var normalizedCustomerId, refreshTask, shouldWait;
|
|
2298
|
-
return _regeneratorRuntime().wrap(function
|
|
2299
|
-
while (1) switch (
|
|
2424
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
2425
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
2300
2426
|
case 0:
|
|
2301
|
-
|
|
2427
|
+
_context36.next = 2;
|
|
2302
2428
|
return Promise.resolve();
|
|
2303
2429
|
case 2:
|
|
2304
2430
|
normalizedCustomerId = Number(customerId || 0);
|
|
2305
2431
|
refreshTask = this.orderCustomerDiscountRefreshInFlight;
|
|
2306
2432
|
shouldWait = normalizedCustomerId > 1 && this.orderCustomerDiscountRefreshCustomerId === normalizedCustomerId && Boolean(refreshTask);
|
|
2307
2433
|
if (!(shouldWait && refreshTask)) {
|
|
2308
|
-
|
|
2434
|
+
_context36.next = 8;
|
|
2309
2435
|
break;
|
|
2310
2436
|
}
|
|
2311
|
-
|
|
2437
|
+
_context36.next = 8;
|
|
2312
2438
|
return refreshTask;
|
|
2313
2439
|
case 8:
|
|
2314
2440
|
case "end":
|
|
2315
|
-
return
|
|
2441
|
+
return _context36.stop();
|
|
2316
2442
|
}
|
|
2317
|
-
},
|
|
2443
|
+
}, _callee36, this);
|
|
2318
2444
|
}));
|
|
2319
2445
|
function prepareProductPriceQueryContext(_x19) {
|
|
2320
2446
|
return _prepareProductPriceQueryContext.apply(this, arguments);
|
|
@@ -2369,27 +2495,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2369
2495
|
}, {
|
|
2370
2496
|
key: "changeCustomerPage",
|
|
2371
2497
|
value: (function () {
|
|
2372
|
-
var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2498
|
+
var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(page, pageSize) {
|
|
2373
2499
|
var _result5;
|
|
2374
|
-
return _regeneratorRuntime().wrap(function
|
|
2375
|
-
while (1) switch (
|
|
2500
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
2501
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
2376
2502
|
case 0:
|
|
2377
|
-
|
|
2378
|
-
|
|
2503
|
+
_context37.prev = 0;
|
|
2504
|
+
_context37.next = 3;
|
|
2379
2505
|
return this.store.customer.changeCustomerPage(page, pageSize);
|
|
2380
2506
|
case 3:
|
|
2381
|
-
_result5 =
|
|
2382
|
-
return
|
|
2507
|
+
_result5 = _context37.sent;
|
|
2508
|
+
return _context37.abrupt("return", _result5);
|
|
2383
2509
|
case 7:
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
console.error('Failed to change customer page:',
|
|
2387
|
-
throw
|
|
2510
|
+
_context37.prev = 7;
|
|
2511
|
+
_context37.t0 = _context37["catch"](0);
|
|
2512
|
+
console.error('Failed to change customer page:', _context37.t0);
|
|
2513
|
+
throw _context37.t0;
|
|
2388
2514
|
case 11:
|
|
2389
2515
|
case "end":
|
|
2390
|
-
return
|
|
2516
|
+
return _context37.stop();
|
|
2391
2517
|
}
|
|
2392
|
-
},
|
|
2518
|
+
}, _callee37, this, [[0, 7]]);
|
|
2393
2519
|
}));
|
|
2394
2520
|
function changeCustomerPage(_x20, _x21) {
|
|
2395
2521
|
return _changeCustomerPage.apply(this, arguments);
|
|
@@ -2404,28 +2530,28 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2404
2530
|
}, {
|
|
2405
2531
|
key: "loadMoreCustomers",
|
|
2406
2532
|
value: (function () {
|
|
2407
|
-
var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2533
|
+
var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
|
|
2408
2534
|
var _result6;
|
|
2409
|
-
return _regeneratorRuntime().wrap(function
|
|
2410
|
-
while (1) switch (
|
|
2535
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
2536
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
2411
2537
|
case 0:
|
|
2412
|
-
|
|
2413
|
-
|
|
2538
|
+
_context38.prev = 0;
|
|
2539
|
+
_context38.next = 3;
|
|
2414
2540
|
return this.store.customer.loadMoreCustomers();
|
|
2415
2541
|
case 3:
|
|
2416
|
-
_result6 =
|
|
2542
|
+
_result6 = _context38.sent;
|
|
2417
2543
|
this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), _result6);
|
|
2418
|
-
return
|
|
2544
|
+
return _context38.abrupt("return", _result6);
|
|
2419
2545
|
case 8:
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
console.error('Failed to load more customers:',
|
|
2423
|
-
throw
|
|
2546
|
+
_context38.prev = 8;
|
|
2547
|
+
_context38.t0 = _context38["catch"](0);
|
|
2548
|
+
console.error('Failed to load more customers:', _context38.t0);
|
|
2549
|
+
throw _context38.t0;
|
|
2424
2550
|
case 12:
|
|
2425
2551
|
case "end":
|
|
2426
|
-
return
|
|
2552
|
+
return _context38.stop();
|
|
2427
2553
|
}
|
|
2428
|
-
},
|
|
2554
|
+
}, _callee38, this, [[0, 8]]);
|
|
2429
2555
|
}));
|
|
2430
2556
|
function loadMoreCustomers() {
|
|
2431
2557
|
return _loadMoreCustomers.apply(this, arguments);
|
|
@@ -2441,31 +2567,31 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2441
2567
|
}, {
|
|
2442
2568
|
key: "resetAndLoadCustomers",
|
|
2443
2569
|
value: (function () {
|
|
2444
|
-
var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2570
|
+
var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
|
|
2445
2571
|
var params,
|
|
2446
2572
|
_result7,
|
|
2447
|
-
|
|
2448
|
-
return _regeneratorRuntime().wrap(function
|
|
2449
|
-
while (1) switch (
|
|
2573
|
+
_args39 = arguments;
|
|
2574
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
2575
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
2450
2576
|
case 0:
|
|
2451
|
-
params =
|
|
2452
|
-
|
|
2453
|
-
|
|
2577
|
+
params = _args39.length > 0 && _args39[0] !== undefined ? _args39[0] : {};
|
|
2578
|
+
_context39.prev = 1;
|
|
2579
|
+
_context39.next = 4;
|
|
2454
2580
|
return this.store.customer.resetAndLoadCustomers(params);
|
|
2455
2581
|
case 4:
|
|
2456
|
-
_result7 =
|
|
2582
|
+
_result7 = _context39.sent;
|
|
2457
2583
|
this.core.effects.emit("".concat(this.name, ":onCustomerListReset"), _result7);
|
|
2458
|
-
return
|
|
2584
|
+
return _context39.abrupt("return", _result7);
|
|
2459
2585
|
case 9:
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
console.error('Failed to reset and load customers:',
|
|
2463
|
-
throw
|
|
2586
|
+
_context39.prev = 9;
|
|
2587
|
+
_context39.t0 = _context39["catch"](1);
|
|
2588
|
+
console.error('Failed to reset and load customers:', _context39.t0);
|
|
2589
|
+
throw _context39.t0;
|
|
2464
2590
|
case 13:
|
|
2465
2591
|
case "end":
|
|
2466
|
-
return
|
|
2592
|
+
return _context39.stop();
|
|
2467
2593
|
}
|
|
2468
|
-
},
|
|
2594
|
+
}, _callee39, this, [[1, 9]]);
|
|
2469
2595
|
}));
|
|
2470
2596
|
function resetAndLoadCustomers() {
|
|
2471
2597
|
return _resetAndLoadCustomers.apply(this, arguments);
|
|
@@ -2510,9 +2636,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2510
2636
|
}, {
|
|
2511
2637
|
key: "scanGlobalListener",
|
|
2512
2638
|
value: function scanGlobalListener(callback) {
|
|
2513
|
-
var
|
|
2639
|
+
var _this8 = this;
|
|
2514
2640
|
var localSearch = function localSearch(v) {
|
|
2515
|
-
return
|
|
2641
|
+
return _this8.store.products.findProductsByCodeOrBarcode(v);
|
|
2516
2642
|
};
|
|
2517
2643
|
var scanCallback = handleGlobalScan(this.request, localSearch, this.getSubmitOrderSalesChannel());
|
|
2518
2644
|
var safeCallback = function safeCallback(d) {
|
|
@@ -2626,16 +2752,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2626
2752
|
}, {
|
|
2627
2753
|
key: "getOtherParams",
|
|
2628
2754
|
value: (function () {
|
|
2629
|
-
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2630
|
-
return _regeneratorRuntime().wrap(function
|
|
2631
|
-
while (1) switch (
|
|
2755
|
+
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
|
|
2756
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
2757
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
2632
2758
|
case 0:
|
|
2633
|
-
return
|
|
2759
|
+
return _context40.abrupt("return", this.otherParams);
|
|
2634
2760
|
case 1:
|
|
2635
2761
|
case "end":
|
|
2636
|
-
return
|
|
2762
|
+
return _context40.stop();
|
|
2637
2763
|
}
|
|
2638
|
-
},
|
|
2764
|
+
}, _callee40, this);
|
|
2639
2765
|
}));
|
|
2640
2766
|
function getOtherParams() {
|
|
2641
2767
|
return _getOtherParams.apply(this, arguments);
|
|
@@ -2745,7 +2871,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2745
2871
|
var _extra$date,
|
|
2746
2872
|
_extra$presetStartTim,
|
|
2747
2873
|
_this$getOrderSession,
|
|
2748
|
-
|
|
2874
|
+
_this9 = this,
|
|
2749
2875
|
_this$otherParams10;
|
|
2750
2876
|
var state = this.store.bookingContext.getState();
|
|
2751
2877
|
var date = (_extra$date = extra === null || extra === void 0 ? void 0 : extra.date) !== null && _extra$date !== void 0 ? _extra$date : state.date;
|
|
@@ -2758,7 +2884,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2758
2884
|
}, extra || {}), {}, {
|
|
2759
2885
|
orderSessionId: (_this$getOrderSession = this.getOrderSessionId()) !== null && _this$getOrderSession !== void 0 ? _this$getOrderSession : undefined,
|
|
2760
2886
|
isOrderSessionCurrent: function isOrderSessionCurrent(sessionId) {
|
|
2761
|
-
return
|
|
2887
|
+
return _this9.isOrderSessionCurrent(sessionId);
|
|
2762
2888
|
},
|
|
2763
2889
|
platform: String(((_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.platform) || '').trim().toLowerCase()
|
|
2764
2890
|
});
|
|
@@ -2856,17 +2982,17 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2856
2982
|
key: "buildAddProductCtx",
|
|
2857
2983
|
value: function buildAddProductCtx(extra) {
|
|
2858
2984
|
var _extra$date2,
|
|
2859
|
-
|
|
2985
|
+
_ref15,
|
|
2860
2986
|
_this$getOrderCustome4,
|
|
2861
2987
|
_this$getOrderCustome5,
|
|
2862
|
-
_this$store$order$
|
|
2988
|
+
_this$store$order$get7,
|
|
2863
2989
|
_extra$presetStartTim2,
|
|
2864
2990
|
_this$getOrderSession2,
|
|
2865
|
-
|
|
2991
|
+
_this10 = this,
|
|
2866
2992
|
_this$otherParams11;
|
|
2867
2993
|
var bookingContextState = this.store.bookingContext.getState();
|
|
2868
2994
|
var date = (_extra$date2 = extra === null || extra === void 0 ? void 0 : extra.date) !== null && _extra$date2 !== void 0 ? _extra$date2 : bookingContextState.date;
|
|
2869
|
-
var orderCustomerId = (
|
|
2995
|
+
var orderCustomerId = (_ref15 = (_this$getOrderCustome4 = (_this$getOrderCustome5 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome5 === void 0 ? void 0 : _this$getOrderCustome5.id) !== null && _this$getOrderCustome4 !== void 0 ? _this$getOrderCustome4 : (_this$store$order$get7 = this.store.order.getTempOrder()) === null || _this$store$order$get7 === void 0 ? void 0 : _this$store$order$get7.customer_id) !== null && _ref15 !== void 0 ? _ref15 : undefined;
|
|
2870
2996
|
return _objectSpread(_objectSpread({
|
|
2871
2997
|
bookingConfig: bookingContextState.bookingConfig,
|
|
2872
2998
|
resourcesOrigin: bookingContextState.resourcesOrigin,
|
|
@@ -2878,7 +3004,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2878
3004
|
channel: this.getSubmitOrderSalesChannel(),
|
|
2879
3005
|
orderSessionId: (_this$getOrderSession2 = this.getOrderSessionId()) !== null && _this$getOrderSession2 !== void 0 ? _this$getOrderSession2 : undefined,
|
|
2880
3006
|
isOrderSessionCurrent: function isOrderSessionCurrent(sessionId) {
|
|
2881
|
-
return
|
|
3007
|
+
return _this10.isOrderSessionCurrent(sessionId);
|
|
2882
3008
|
},
|
|
2883
3009
|
platform: String(((_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.platform) || '').trim().toLowerCase()
|
|
2884
3010
|
});
|
|
@@ -2982,16 +3108,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2982
3108
|
}, {
|
|
2983
3109
|
key: "updateProductInOrder",
|
|
2984
3110
|
value: (function () {
|
|
2985
|
-
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2986
|
-
return _regeneratorRuntime().wrap(function
|
|
2987
|
-
while (1) switch (
|
|
3111
|
+
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(params) {
|
|
3112
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
3113
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
2988
3114
|
case 0:
|
|
2989
|
-
return
|
|
3115
|
+
return _context41.abrupt("return", this.updateOrderProduct(params));
|
|
2990
3116
|
case 1:
|
|
2991
3117
|
case "end":
|
|
2992
|
-
return
|
|
3118
|
+
return _context41.stop();
|
|
2993
3119
|
}
|
|
2994
|
-
},
|
|
3120
|
+
}, _callee41, this);
|
|
2995
3121
|
}));
|
|
2996
3122
|
function updateProductInOrder(_x22) {
|
|
2997
3123
|
return _updateProductInOrder.apply(this, arguments);
|
|
@@ -3015,24 +3141,24 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3015
3141
|
}, {
|
|
3016
3142
|
key: "handleGlobalScanCode",
|
|
3017
3143
|
value: (function () {
|
|
3018
|
-
var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3019
|
-
var
|
|
3144
|
+
var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(code, bridge) {
|
|
3145
|
+
var _this11 = this;
|
|
3020
3146
|
var trimmed, _bridge$onNotify, _bridge$refresh, beforeScanCommit, beforeScanDialog, guardCallback, guardedBridge, _promotion$isAccepted, promotion, localSearch, scanCallback, raw, formatted, _bridge$onNotify2, host, _result8, _bridge$onNotify3, _bridge$isCurrent;
|
|
3021
|
-
return _regeneratorRuntime().wrap(function
|
|
3022
|
-
while (1) switch (
|
|
3147
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
3148
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
3023
3149
|
case 0:
|
|
3024
3150
|
trimmed = typeof code === 'string' ? code.trim() : '';
|
|
3025
3151
|
if (trimmed) {
|
|
3026
|
-
|
|
3152
|
+
_context43.next = 4;
|
|
3027
3153
|
break;
|
|
3028
3154
|
}
|
|
3029
3155
|
bridge === null || bridge === void 0 || (_bridge$onNotify = bridge.onNotify) === null || _bridge$onNotify === void 0 || _bridge$onNotify.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
3030
|
-
return
|
|
3156
|
+
return _context43.abrupt("return", {
|
|
3031
3157
|
status: 'failed',
|
|
3032
3158
|
reason: 'empty_code'
|
|
3033
3159
|
});
|
|
3034
3160
|
case 4:
|
|
3035
|
-
|
|
3161
|
+
_context43.prev = 4;
|
|
3036
3162
|
// Capture before lookup/UI awaits, so a result cannot land in a new cart.
|
|
3037
3163
|
// Unscoped POS Order modules return a no-op guard.
|
|
3038
3164
|
beforeScanCommit = this.store.order.createCartIntentCommitGuard('add_product');
|
|
@@ -3059,23 +3185,23 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3059
3185
|
} : undefined
|
|
3060
3186
|
}) : undefined;
|
|
3061
3187
|
if (!((guardedBridge === null || guardedBridge === void 0 ? void 0 : guardedBridge.scanScope) === 'product-voucher')) {
|
|
3062
|
-
|
|
3188
|
+
_context43.next = 16;
|
|
3063
3189
|
break;
|
|
3064
3190
|
}
|
|
3065
3191
|
if (guardedBridge.applyPromotionCode) {
|
|
3066
|
-
|
|
3192
|
+
_context43.next = 12;
|
|
3067
3193
|
break;
|
|
3068
3194
|
}
|
|
3069
|
-
return
|
|
3195
|
+
return _context43.abrupt("return", {
|
|
3070
3196
|
status: 'failed',
|
|
3071
3197
|
reason: 'no_bridge'
|
|
3072
3198
|
});
|
|
3073
3199
|
case 12:
|
|
3074
|
-
|
|
3200
|
+
_context43.next = 14;
|
|
3075
3201
|
return guardedBridge.applyPromotionCode(trimmed);
|
|
3076
3202
|
case 14:
|
|
3077
|
-
promotion =
|
|
3078
|
-
return
|
|
3203
|
+
promotion = _context43.sent;
|
|
3204
|
+
return _context43.abrupt("return", ((_promotion$isAccepted = promotion.isAccepted) !== null && _promotion$isAccepted !== void 0 ? _promotion$isAccepted : promotion.isAvailable) ? {
|
|
3079
3205
|
status: 'success',
|
|
3080
3206
|
kind: 'promotion'
|
|
3081
3207
|
} : {
|
|
@@ -3084,23 +3210,23 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3084
3210
|
});
|
|
3085
3211
|
case 16:
|
|
3086
3212
|
localSearch = function localSearch(v) {
|
|
3087
|
-
return
|
|
3213
|
+
return _this11.store.products.findProductsByCodeOrBarcode(v);
|
|
3088
3214
|
};
|
|
3089
3215
|
scanCallback = handleGlobalScan(this.request, localSearch, this.getSubmitOrderSalesChannel());
|
|
3090
|
-
|
|
3216
|
+
_context43.next = 20;
|
|
3091
3217
|
return scanCallback({
|
|
3092
3218
|
type: 'nativeScanner',
|
|
3093
3219
|
value: trimmed
|
|
3094
3220
|
});
|
|
3095
3221
|
case 20:
|
|
3096
|
-
raw =
|
|
3222
|
+
raw = _context43.sent;
|
|
3097
3223
|
formatted = formatGlobalScanResult(raw, trimmed);
|
|
3098
3224
|
if (formatted) {
|
|
3099
|
-
|
|
3225
|
+
_context43.next = 25;
|
|
3100
3226
|
break;
|
|
3101
3227
|
}
|
|
3102
3228
|
bridge === null || bridge === void 0 || (_bridge$onNotify2 = bridge.onNotify) === null || _bridge$onNotify2 === void 0 || _bridge$onNotify2.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
3103
|
-
return
|
|
3229
|
+
return _context43.abrupt("return", {
|
|
3104
3230
|
status: 'failed',
|
|
3105
3231
|
reason: 'not_found'
|
|
3106
3232
|
});
|
|
@@ -3108,73 +3234,73 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3108
3234
|
host = {
|
|
3109
3235
|
setOrderCustomer: function setOrderCustomer(customer) {
|
|
3110
3236
|
beforeScanCommit();
|
|
3111
|
-
|
|
3237
|
+
_this11.setOrderCustomer(customer);
|
|
3112
3238
|
},
|
|
3113
3239
|
getOrderCustomerSnapshot: function getOrderCustomerSnapshot() {
|
|
3114
|
-
return
|
|
3240
|
+
return _this11.getOrderCustomerSnapshot();
|
|
3115
3241
|
},
|
|
3116
3242
|
resolveCustomerById: function resolveCustomerById(customerId) {
|
|
3117
|
-
return
|
|
3243
|
+
return _this11.resolveCustomerById(customerId);
|
|
3118
3244
|
},
|
|
3119
3245
|
getBusinessCode: function getBusinessCode() {
|
|
3120
|
-
var
|
|
3121
|
-
return (
|
|
3246
|
+
var _this11$otherParams;
|
|
3247
|
+
return (_this11$otherParams = _this11.otherParams) === null || _this11$otherParams === void 0 ? void 0 : _this11$otherParams.businessCode;
|
|
3122
3248
|
},
|
|
3123
3249
|
buildAddProductCtx: function buildAddProductCtx(extra) {
|
|
3124
|
-
return
|
|
3250
|
+
return _this11.buildAddProductCtx(extra);
|
|
3125
3251
|
},
|
|
3126
3252
|
decideAddProduct: function decideAddProduct(item, options) {
|
|
3127
|
-
return
|
|
3253
|
+
return _this11.decideAddProduct(item, options);
|
|
3128
3254
|
},
|
|
3129
3255
|
decideAfterDetail: function decideAfterDetail(cacheItem, options) {
|
|
3130
|
-
return
|
|
3256
|
+
return _this11.decideAfterDetail(cacheItem, options);
|
|
3131
3257
|
},
|
|
3132
3258
|
transformDetailToProductAndBooking: function transformDetailToProductAndBooking(input) {
|
|
3133
|
-
return
|
|
3259
|
+
return _this11.transformDetailToProductAndBooking(input);
|
|
3134
3260
|
},
|
|
3135
3261
|
addProductToOrder: function addProductToOrder(product, booking) {
|
|
3136
3262
|
beforeScanCommit();
|
|
3137
|
-
return
|
|
3263
|
+
return _this11.addProductToOrder(product, booking);
|
|
3138
3264
|
},
|
|
3139
3265
|
refreshWalletAssets: function refreshWalletAssets(params) {
|
|
3140
|
-
return
|
|
3266
|
+
return _this11.refreshWalletAssets(params);
|
|
3141
3267
|
},
|
|
3142
3268
|
scanWalletAsset: function scanWalletAsset(scanCode) {
|
|
3143
3269
|
beforeScanCommit();
|
|
3144
|
-
return
|
|
3270
|
+
return _this11.scanWalletAsset(scanCode);
|
|
3145
3271
|
}
|
|
3146
3272
|
};
|
|
3147
3273
|
if (!((guardedBridge === null || guardedBridge === void 0 ? void 0 : guardedBridge.scanScope) === 'product-voucher-collection')) {
|
|
3148
|
-
|
|
3274
|
+
_context43.next = 32;
|
|
3149
3275
|
break;
|
|
3150
3276
|
}
|
|
3151
|
-
|
|
3277
|
+
_context43.next = 29;
|
|
3152
3278
|
return applyProductVoucherCollectionScan(_objectSpread(_objectSpread({}, host), {}, {
|
|
3153
3279
|
loadCustomerDiscounts: function () {
|
|
3154
|
-
var _loadCustomerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3155
|
-
var
|
|
3280
|
+
var _loadCustomerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42() {
|
|
3281
|
+
var _this11$getOrderCusto;
|
|
3156
3282
|
var customerId;
|
|
3157
|
-
return _regeneratorRuntime().wrap(function
|
|
3158
|
-
while (1) switch (
|
|
3283
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
|
3284
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
3159
3285
|
case 0:
|
|
3160
3286
|
beforeScanCommit();
|
|
3161
|
-
customerId = Number(((
|
|
3287
|
+
customerId = Number(((_this11$getOrderCusto = _this11.getOrderCustomer()) === null || _this11$getOrderCusto === void 0 ? void 0 : _this11$getOrderCusto.customer_id) || 0);
|
|
3162
3288
|
if (!(customerId <= 1)) {
|
|
3163
|
-
|
|
3289
|
+
_context42.next = 4;
|
|
3164
3290
|
break;
|
|
3165
3291
|
}
|
|
3166
|
-
return
|
|
3292
|
+
return _context42.abrupt("return", []);
|
|
3167
3293
|
case 4:
|
|
3168
|
-
|
|
3169
|
-
return
|
|
3294
|
+
_context42.next = 6;
|
|
3295
|
+
return _this11.refreshDiscountConfigAfterOrderCustomerChange(customerId);
|
|
3170
3296
|
case 6:
|
|
3171
3297
|
beforeScanCommit();
|
|
3172
|
-
return
|
|
3298
|
+
return _context42.abrupt("return", _this11.getDiscountList());
|
|
3173
3299
|
case 8:
|
|
3174
3300
|
case "end":
|
|
3175
|
-
return
|
|
3301
|
+
return _context42.stop();
|
|
3176
3302
|
}
|
|
3177
|
-
},
|
|
3303
|
+
}, _callee42);
|
|
3178
3304
|
}));
|
|
3179
3305
|
function loadCustomerDiscounts() {
|
|
3180
3306
|
return _loadCustomerDiscounts.apply(this, arguments);
|
|
@@ -3183,49 +3309,49 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3183
3309
|
}()
|
|
3184
3310
|
}), formatted, guardedBridge);
|
|
3185
3311
|
case 29:
|
|
3186
|
-
|
|
3187
|
-
|
|
3312
|
+
_context43.t0 = _context43.sent;
|
|
3313
|
+
_context43.next = 35;
|
|
3188
3314
|
break;
|
|
3189
3315
|
case 32:
|
|
3190
|
-
|
|
3316
|
+
_context43.next = 34;
|
|
3191
3317
|
return applyGlobalScan(host, formatted, guardedBridge);
|
|
3192
3318
|
case 34:
|
|
3193
|
-
|
|
3319
|
+
_context43.t0 = _context43.sent;
|
|
3194
3320
|
case 35:
|
|
3195
|
-
_result8 =
|
|
3321
|
+
_result8 = _context43.t0;
|
|
3196
3322
|
bridge === null || bridge === void 0 || (_bridge$refresh = bridge.refresh) === null || _bridge$refresh === void 0 || _bridge$refresh.call(bridge);
|
|
3197
|
-
return
|
|
3323
|
+
return _context43.abrupt("return", _result8);
|
|
3198
3324
|
case 40:
|
|
3199
|
-
|
|
3200
|
-
|
|
3325
|
+
_context43.prev = 40;
|
|
3326
|
+
_context43.t1 = _context43["catch"](4);
|
|
3201
3327
|
if (!((bridge === null || bridge === void 0 ? void 0 : bridge.scanScope) === 'product-voucher-collection')) {
|
|
3202
|
-
|
|
3328
|
+
_context43.next = 46;
|
|
3203
3329
|
break;
|
|
3204
3330
|
}
|
|
3205
3331
|
if (!(((_bridge$isCurrent = bridge.isCurrent) === null || _bridge$isCurrent === void 0 ? void 0 : _bridge$isCurrent.call(bridge)) === false)) {
|
|
3206
|
-
|
|
3332
|
+
_context43.next = 45;
|
|
3207
3333
|
break;
|
|
3208
3334
|
}
|
|
3209
|
-
return
|
|
3335
|
+
return _context43.abrupt("return", {
|
|
3210
3336
|
status: 'cancelled'
|
|
3211
3337
|
});
|
|
3212
3338
|
case 45:
|
|
3213
|
-
return
|
|
3339
|
+
return _context43.abrupt("return", {
|
|
3214
3340
|
status: 'failed',
|
|
3215
3341
|
reason: 'entry_resolution_failed'
|
|
3216
3342
|
});
|
|
3217
3343
|
case 46:
|
|
3218
|
-
console.error('[BookingTicket] handleGlobalScanCode failed',
|
|
3344
|
+
console.error('[BookingTicket] handleGlobalScanCode failed', _context43.t1);
|
|
3219
3345
|
bridge === null || bridge === void 0 || (_bridge$onNotify3 = bridge.onNotify) === null || _bridge$onNotify3 === void 0 || _bridge$onNotify3.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
3220
|
-
return
|
|
3346
|
+
return _context43.abrupt("return", {
|
|
3221
3347
|
status: 'failed',
|
|
3222
3348
|
reason: 'not_found'
|
|
3223
3349
|
});
|
|
3224
3350
|
case 49:
|
|
3225
3351
|
case "end":
|
|
3226
|
-
return
|
|
3352
|
+
return _context43.stop();
|
|
3227
3353
|
}
|
|
3228
|
-
},
|
|
3354
|
+
}, _callee43, this, [[4, 40]]);
|
|
3229
3355
|
}));
|
|
3230
3356
|
function handleGlobalScanCode(_x23, _x24) {
|
|
3231
3357
|
return _handleGlobalScanCode.apply(this, arguments);
|
|
@@ -3235,37 +3361,37 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3235
3361
|
}, {
|
|
3236
3362
|
key: "getGlobalScanCodeType",
|
|
3237
3363
|
value: (function () {
|
|
3238
|
-
var _getGlobalScanCodeType = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3239
|
-
var
|
|
3364
|
+
var _getGlobalScanCodeType = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(code) {
|
|
3365
|
+
var _this12 = this,
|
|
3240
3366
|
_formatGlobalScanResu,
|
|
3241
3367
|
_formatGlobalScanResu2;
|
|
3242
3368
|
var trimmed, scan, raw;
|
|
3243
|
-
return _regeneratorRuntime().wrap(function
|
|
3244
|
-
while (1) switch (
|
|
3369
|
+
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
3370
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
3245
3371
|
case 0:
|
|
3246
3372
|
trimmed = typeof code === 'string' ? code.trim() : '';
|
|
3247
3373
|
if (trimmed) {
|
|
3248
|
-
|
|
3374
|
+
_context44.next = 3;
|
|
3249
3375
|
break;
|
|
3250
3376
|
}
|
|
3251
|
-
return
|
|
3377
|
+
return _context44.abrupt("return", null);
|
|
3252
3378
|
case 3:
|
|
3253
3379
|
scan = handleGlobalScan(this.request, function (value) {
|
|
3254
|
-
return
|
|
3380
|
+
return _this12.store.products.findProductsByCodeOrBarcode(value);
|
|
3255
3381
|
}, this.getSubmitOrderSalesChannel());
|
|
3256
|
-
|
|
3382
|
+
_context44.next = 6;
|
|
3257
3383
|
return scan({
|
|
3258
3384
|
type: 'nativeScanner',
|
|
3259
3385
|
value: trimmed
|
|
3260
3386
|
});
|
|
3261
3387
|
case 6:
|
|
3262
|
-
raw =
|
|
3263
|
-
return
|
|
3388
|
+
raw = _context44.sent;
|
|
3389
|
+
return _context44.abrupt("return", (_formatGlobalScanResu = (_formatGlobalScanResu2 = formatGlobalScanResult(raw, trimmed)) === null || _formatGlobalScanResu2 === void 0 ? void 0 : _formatGlobalScanResu2.searchType) !== null && _formatGlobalScanResu !== void 0 ? _formatGlobalScanResu : null);
|
|
3264
3390
|
case 8:
|
|
3265
3391
|
case "end":
|
|
3266
|
-
return
|
|
3392
|
+
return _context44.stop();
|
|
3267
3393
|
}
|
|
3268
|
-
},
|
|
3394
|
+
}, _callee44, this);
|
|
3269
3395
|
}));
|
|
3270
3396
|
function getGlobalScanCodeType(_x25) {
|
|
3271
3397
|
return _getGlobalScanCodeType.apply(this, arguments);
|
|
@@ -3287,7 +3413,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3287
3413
|
}, {
|
|
3288
3414
|
key: "buildAddTimeOrderLine",
|
|
3289
3415
|
value: function buildAddTimeOrderLine(input, bookingUid) {
|
|
3290
|
-
var _input$num, _product$id, _product$product_id,
|
|
3416
|
+
var _input$num, _product$id, _product$product_id, _ref16, _product$product_vari, _ref17, _product$variant_id, _product$original_pri, _ref18, _ref19, _product$option, _product$product_sku, _ref20, _ref21, _product$bundle, _product$id2;
|
|
3291
3417
|
var product = input === null || input === void 0 ? void 0 : input.product;
|
|
3292
3418
|
if (!product || _typeof(product) !== 'object') {
|
|
3293
3419
|
throw new Error('[BookingTicket] addAddTimeProductToBooking: product 不能为空');
|
|
@@ -3298,8 +3424,8 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3298
3424
|
var payload = {
|
|
3299
3425
|
id: (_product$id = product.id) !== null && _product$id !== void 0 ? _product$id : product.product_id,
|
|
3300
3426
|
product_id: (_product$product_id = product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : product.id,
|
|
3301
|
-
product_variant_id: (
|
|
3302
|
-
variant_id: (
|
|
3427
|
+
product_variant_id: (_ref16 = (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : product.variant_id) !== null && _ref16 !== void 0 ? _ref16 : 0,
|
|
3428
|
+
variant_id: (_ref17 = (_product$variant_id = product.variant_id) !== null && _product$variant_id !== void 0 ? _product$variant_id : product.product_variant_id) !== null && _ref17 !== void 0 ? _ref17 : 0,
|
|
3303
3429
|
quantity: quantity,
|
|
3304
3430
|
num: quantity,
|
|
3305
3431
|
price: price,
|
|
@@ -3308,8 +3434,8 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3308
3434
|
line_total: price,
|
|
3309
3435
|
total: price,
|
|
3310
3436
|
product_sku: product.product_sku,
|
|
3311
|
-
option: (
|
|
3312
|
-
bundle: (
|
|
3437
|
+
option: (_ref18 = (_ref19 = (_product$option = product.option) !== null && _product$option !== void 0 ? _product$option : product.options) !== null && _ref19 !== void 0 ? _ref19 : (_product$product_sku = product.product_sku) === null || _product$product_sku === void 0 ? void 0 : _product$product_sku.option) !== null && _ref18 !== void 0 ? _ref18 : [],
|
|
3438
|
+
bundle: (_ref20 = (_ref21 = (_product$bundle = product.bundle) !== null && _product$bundle !== void 0 ? _product$bundle : product.bundles) !== null && _ref21 !== void 0 ? _ref21 : product.product_bundle) !== null && _ref20 !== void 0 ? _ref20 : []
|
|
3313
3439
|
};
|
|
3314
3440
|
var orderLine = this.transformBaseProductToOrderProduct({
|
|
3315
3441
|
payload: payload,
|
|
@@ -3349,11 +3475,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3349
3475
|
}, {
|
|
3350
3476
|
key: "addAddTimeProductToBooking",
|
|
3351
3477
|
value: (function () {
|
|
3352
|
-
var _addAddTimeProductToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3353
|
-
return _regeneratorRuntime().wrap(function
|
|
3354
|
-
while (1) switch (
|
|
3478
|
+
var _addAddTimeProductToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(input) {
|
|
3479
|
+
return _regeneratorRuntime().wrap(function _callee45$(_context45) {
|
|
3480
|
+
while (1) switch (_context45.prev = _context45.next) {
|
|
3355
3481
|
case 0:
|
|
3356
|
-
return
|
|
3482
|
+
return _context45.abrupt("return", this.addAddTimeProductsToBooking({
|
|
3357
3483
|
booking: input.booking,
|
|
3358
3484
|
products: [input],
|
|
3359
3485
|
coveredMinutes: input.coveredMinutes,
|
|
@@ -3361,9 +3487,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3361
3487
|
}));
|
|
3362
3488
|
case 1:
|
|
3363
3489
|
case "end":
|
|
3364
|
-
return
|
|
3490
|
+
return _context45.stop();
|
|
3365
3491
|
}
|
|
3366
|
-
},
|
|
3492
|
+
}, _callee45, this);
|
|
3367
3493
|
}));
|
|
3368
3494
|
function addAddTimeProductToBooking(_x26) {
|
|
3369
3495
|
return _addAddTimeProductToBooking.apply(this, arguments);
|
|
@@ -3383,27 +3509,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3383
3509
|
}, {
|
|
3384
3510
|
key: "addAddTimeProductsToBooking",
|
|
3385
3511
|
value: (function () {
|
|
3386
|
-
var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3387
|
-
var
|
|
3512
|
+
var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(input) {
|
|
3513
|
+
var _this13 = this,
|
|
3388
3514
|
_input$bookingPatch;
|
|
3389
3515
|
var bookingUid, orderLines, coveredMinutes, bookingTimePatch, result, _iterator2, _step2, line;
|
|
3390
|
-
return _regeneratorRuntime().wrap(function
|
|
3391
|
-
while (1) switch (
|
|
3516
|
+
return _regeneratorRuntime().wrap(function _callee46$(_context46) {
|
|
3517
|
+
while (1) switch (_context46.prev = _context46.next) {
|
|
3392
3518
|
case 0:
|
|
3393
3519
|
bookingUid = resolveBookingUidForAddTime(input === null || input === void 0 ? void 0 : input.booking);
|
|
3394
3520
|
if (bookingUid) {
|
|
3395
|
-
|
|
3521
|
+
_context46.next = 3;
|
|
3396
3522
|
break;
|
|
3397
3523
|
}
|
|
3398
3524
|
throw new Error('[BookingTicket] addAddTimeProductToBooking: booking.metadata.unique_identification_number 缺失');
|
|
3399
3525
|
case 3:
|
|
3400
3526
|
orderLines = (input.products || []).map(function (line) {
|
|
3401
3527
|
return {
|
|
3402
|
-
product:
|
|
3528
|
+
product: _this13.buildAddTimeOrderLine(line, bookingUid)
|
|
3403
3529
|
};
|
|
3404
3530
|
});
|
|
3405
3531
|
if (this.store.order) {
|
|
3406
|
-
|
|
3532
|
+
_context46.next = 6;
|
|
3407
3533
|
break;
|
|
3408
3534
|
}
|
|
3409
3535
|
throw new Error('order 模块未初始化');
|
|
@@ -3417,53 +3543,53 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3417
3543
|
});
|
|
3418
3544
|
}
|
|
3419
3545
|
if (!(typeof this.store.order.addProductsToOrder === 'function')) {
|
|
3420
|
-
|
|
3546
|
+
_context46.next = 11;
|
|
3421
3547
|
break;
|
|
3422
3548
|
}
|
|
3423
|
-
return
|
|
3549
|
+
return _context46.abrupt("return", this.store.order.addProductsToOrder(orderLines));
|
|
3424
3550
|
case 11:
|
|
3425
3551
|
result = [];
|
|
3426
3552
|
_iterator2 = _createForOfIteratorHelper(orderLines);
|
|
3427
|
-
|
|
3553
|
+
_context46.prev = 13;
|
|
3428
3554
|
_iterator2.s();
|
|
3429
3555
|
case 15:
|
|
3430
3556
|
if ((_step2 = _iterator2.n()).done) {
|
|
3431
|
-
|
|
3557
|
+
_context46.next = 29;
|
|
3432
3558
|
break;
|
|
3433
3559
|
}
|
|
3434
3560
|
line = _step2.value;
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3561
|
+
_context46.t0 = result.splice;
|
|
3562
|
+
_context46.t1 = result;
|
|
3563
|
+
_context46.t2 = [0, result.length];
|
|
3564
|
+
_context46.t3 = _toConsumableArray;
|
|
3565
|
+
_context46.next = 23;
|
|
3440
3566
|
return this.addProductToOrder(line.product);
|
|
3441
3567
|
case 23:
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3568
|
+
_context46.t4 = _context46.sent;
|
|
3569
|
+
_context46.t5 = (0, _context46.t3)(_context46.t4);
|
|
3570
|
+
_context46.t6 = _context46.t2.concat.call(_context46.t2, _context46.t5);
|
|
3571
|
+
_context46.t0.apply.call(_context46.t0, _context46.t1, _context46.t6);
|
|
3446
3572
|
case 27:
|
|
3447
|
-
|
|
3573
|
+
_context46.next = 15;
|
|
3448
3574
|
break;
|
|
3449
3575
|
case 29:
|
|
3450
|
-
|
|
3576
|
+
_context46.next = 34;
|
|
3451
3577
|
break;
|
|
3452
3578
|
case 31:
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
_iterator2.e(
|
|
3579
|
+
_context46.prev = 31;
|
|
3580
|
+
_context46.t7 = _context46["catch"](13);
|
|
3581
|
+
_iterator2.e(_context46.t7);
|
|
3456
3582
|
case 34:
|
|
3457
|
-
|
|
3583
|
+
_context46.prev = 34;
|
|
3458
3584
|
_iterator2.f();
|
|
3459
|
-
return
|
|
3585
|
+
return _context46.finish(34);
|
|
3460
3586
|
case 37:
|
|
3461
|
-
return
|
|
3587
|
+
return _context46.abrupt("return", result);
|
|
3462
3588
|
case 38:
|
|
3463
3589
|
case "end":
|
|
3464
|
-
return
|
|
3590
|
+
return _context46.stop();
|
|
3465
3591
|
}
|
|
3466
|
-
},
|
|
3592
|
+
}, _callee46, this, [[13, 31, 34, 37]]);
|
|
3467
3593
|
}));
|
|
3468
3594
|
function addAddTimeProductsToBooking(_x27) {
|
|
3469
3595
|
return _addAddTimeProductsToBooking.apply(this, arguments);
|
|
@@ -3473,47 +3599,47 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3473
3599
|
}, {
|
|
3474
3600
|
key: "setOtherParams",
|
|
3475
3601
|
value: function () {
|
|
3476
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3477
|
-
var
|
|
3478
|
-
var
|
|
3479
|
-
|
|
3602
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(params) {
|
|
3603
|
+
var _this14 = this;
|
|
3604
|
+
var _ref22,
|
|
3605
|
+
_ref22$cover,
|
|
3480
3606
|
cover,
|
|
3481
3607
|
nextParams,
|
|
3482
3608
|
invoiceContextChanged,
|
|
3483
|
-
|
|
3484
|
-
return _regeneratorRuntime().wrap(function
|
|
3485
|
-
while (1) switch (
|
|
3609
|
+
_args47 = arguments;
|
|
3610
|
+
return _regeneratorRuntime().wrap(function _callee47$(_context47) {
|
|
3611
|
+
while (1) switch (_context47.prev = _context47.next) {
|
|
3486
3612
|
case 0:
|
|
3487
|
-
|
|
3613
|
+
_ref22 = _args47.length > 1 && _args47[1] !== undefined ? _args47[1] : {}, _ref22$cover = _ref22.cover, cover = _ref22$cover === void 0 ? false : _ref22$cover;
|
|
3488
3614
|
nextParams = cover ? params : _objectSpread(_objectSpread({}, this.otherParams), params);
|
|
3489
3615
|
if (['businessCode', 'business_code', 'channel', 'platform', 'shop_id', 'tenantId', 'cacheId'].some(function (key) {
|
|
3490
|
-
var
|
|
3491
|
-
return (nextParams === null || nextParams === void 0 ? void 0 : nextParams[key]) !== ((
|
|
3616
|
+
var _this14$otherParams;
|
|
3617
|
+
return (nextParams === null || nextParams === void 0 ? void 0 : nextParams[key]) !== ((_this14$otherParams = _this14.otherParams) === null || _this14$otherParams === void 0 ? void 0 : _this14$otherParams[key]);
|
|
3492
3618
|
})) this.orderCustomerContactRequest = null;
|
|
3493
|
-
|
|
3619
|
+
_context47.next = 5;
|
|
3494
3620
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "setOtherParams", this).call(this, params, {
|
|
3495
3621
|
cover: cover
|
|
3496
3622
|
});
|
|
3497
3623
|
case 5:
|
|
3498
3624
|
invoiceContextChanged = (params === null || params === void 0 ? void 0 : params.businessCode) !== undefined || (params === null || params === void 0 ? void 0 : params.business_code) !== undefined || (params === null || params === void 0 ? void 0 : params.channel) !== undefined || (params === null || params === void 0 ? void 0 : params.platform) !== undefined || Object.prototype.hasOwnProperty.call(params, 'openData');
|
|
3499
3625
|
if (!invoiceContextChanged) {
|
|
3500
|
-
|
|
3626
|
+
_context47.next = 9;
|
|
3501
3627
|
break;
|
|
3502
3628
|
}
|
|
3503
|
-
|
|
3629
|
+
_context47.next = 9;
|
|
3504
3630
|
return this.prepareInvoiceTemplateAtSolutionReady(Object.prototype.hasOwnProperty.call(params, 'openData') ? this.getInjectedOpenDataConfig() : undefined);
|
|
3505
3631
|
case 9:
|
|
3506
|
-
if (!((params === null || params === void 0 ? void 0 : params.businessCode) !== undefined || (params === null || params === void 0 ? void 0 : params.business_code) !== undefined)) {
|
|
3507
|
-
|
|
3632
|
+
if (!((params === null || params === void 0 ? void 0 : params.businessCode) !== undefined || (params === null || params === void 0 ? void 0 : params.business_code) !== undefined || Object.prototype.hasOwnProperty.call(params !== null && params !== void 0 ? params : {}, 'openData'))) {
|
|
3633
|
+
_context47.next = 12;
|
|
3508
3634
|
break;
|
|
3509
3635
|
}
|
|
3510
|
-
|
|
3636
|
+
_context47.next = 12;
|
|
3511
3637
|
return this.configureIdGeneratorFromOpenData();
|
|
3512
3638
|
case 12:
|
|
3513
3639
|
case "end":
|
|
3514
|
-
return
|
|
3640
|
+
return _context47.stop();
|
|
3515
3641
|
}
|
|
3516
|
-
},
|
|
3642
|
+
}, _callee47, this);
|
|
3517
3643
|
}));
|
|
3518
3644
|
function setOtherParams(_x28) {
|
|
3519
3645
|
return _setOtherParams.apply(this, arguments);
|
|
@@ -3532,15 +3658,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3532
3658
|
}, {
|
|
3533
3659
|
key: "handlePrintWristband",
|
|
3534
3660
|
value: function () {
|
|
3535
|
-
var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3661
|
+
var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(params) {
|
|
3536
3662
|
var _this$getOrderIdentit2;
|
|
3537
3663
|
var deviceTask, deviceId, idempotencyKey;
|
|
3538
|
-
return _regeneratorRuntime().wrap(function
|
|
3539
|
-
while (1) switch (
|
|
3664
|
+
return _regeneratorRuntime().wrap(function _callee48$(_context48) {
|
|
3665
|
+
while (1) switch (_context48.prev = _context48.next) {
|
|
3540
3666
|
case 0:
|
|
3541
3667
|
deviceTask = this.getDeviceTaskPlugin();
|
|
3542
3668
|
if (deviceTask !== null && deviceTask !== void 0 && deviceTask.dispatch) {
|
|
3543
|
-
|
|
3669
|
+
_context48.next = 4;
|
|
3544
3670
|
break;
|
|
3545
3671
|
}
|
|
3546
3672
|
this.logger.addLog({
|
|
@@ -3550,7 +3676,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3550
3676
|
voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
|
|
3551
3677
|
}
|
|
3552
3678
|
});
|
|
3553
|
-
return
|
|
3679
|
+
return _context48.abrupt("return");
|
|
3554
3680
|
case 4:
|
|
3555
3681
|
this.logger.addLog({
|
|
3556
3682
|
type: 'info',
|
|
@@ -3559,10 +3685,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3559
3685
|
voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
|
|
3560
3686
|
}
|
|
3561
3687
|
});
|
|
3562
|
-
|
|
3688
|
+
_context48.next = 7;
|
|
3563
3689
|
return this.getShortNumberOrDeviceId();
|
|
3564
3690
|
case 7:
|
|
3565
|
-
deviceId =
|
|
3691
|
+
deviceId = _context48.sent;
|
|
3566
3692
|
idempotencyKey = createUuidV4();
|
|
3567
3693
|
deviceTask.dispatch({
|
|
3568
3694
|
action: 'print_all',
|
|
@@ -3582,9 +3708,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3582
3708
|
});
|
|
3583
3709
|
case 10:
|
|
3584
3710
|
case "end":
|
|
3585
|
-
return
|
|
3711
|
+
return _context48.stop();
|
|
3586
3712
|
}
|
|
3587
|
-
},
|
|
3713
|
+
}, _callee48, this);
|
|
3588
3714
|
}));
|
|
3589
3715
|
function handlePrintWristband(_x29) {
|
|
3590
3716
|
return _handlePrintWristband.apply(this, arguments);
|
|
@@ -3594,11 +3720,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3594
3720
|
}, {
|
|
3595
3721
|
key: "handleRedeem",
|
|
3596
3722
|
value: function () {
|
|
3597
|
-
var _handleRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3598
|
-
var _this$store$order8, _this$store$order8$ge, _this$store$order9,
|
|
3723
|
+
var _handleRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(params) {
|
|
3724
|
+
var _this$store$order8, _this$store$order8$ge, _this$store$order9, _ref23, _tempOrder$order_id2;
|
|
3599
3725
|
var voucherIds, status, voucherIdSet, tempOrder, vouchers, hasUpdatedVoucher, nextVouchers, identity, externalSaleNumber, orderId, orderLookup;
|
|
3600
|
-
return _regeneratorRuntime().wrap(function
|
|
3601
|
-
while (1) switch (
|
|
3726
|
+
return _regeneratorRuntime().wrap(function _callee49$(_context49) {
|
|
3727
|
+
while (1) switch (_context49.prev = _context49.next) {
|
|
3602
3728
|
case 0:
|
|
3603
3729
|
voucherIds = Array.isArray(params.voucher_ids) ? params.voucher_ids : [];
|
|
3604
3730
|
status = params.is_checkin ? 'used' : 'unused';
|
|
@@ -3622,10 +3748,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3622
3748
|
});
|
|
3623
3749
|
});
|
|
3624
3750
|
if (!(tempOrder && hasUpdatedVoucher)) {
|
|
3625
|
-
|
|
3751
|
+
_context49.next = 11;
|
|
3626
3752
|
break;
|
|
3627
3753
|
}
|
|
3628
|
-
|
|
3754
|
+
_context49.next = 11;
|
|
3629
3755
|
return this.replaceTempOrder(_objectSpread(_objectSpread({}, tempOrder), {}, {
|
|
3630
3756
|
vouchers: nextVouchers
|
|
3631
3757
|
}), {
|
|
@@ -3634,10 +3760,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3634
3760
|
case 11:
|
|
3635
3761
|
this.core.effects.emit("".concat(this.name, ":onVouchersChange"), {});
|
|
3636
3762
|
if (!(voucherIds.length === 0)) {
|
|
3637
|
-
|
|
3763
|
+
_context49.next = 14;
|
|
3638
3764
|
break;
|
|
3639
3765
|
}
|
|
3640
|
-
return
|
|
3766
|
+
return _context49.abrupt("return", {
|
|
3641
3767
|
code: 200,
|
|
3642
3768
|
status: true,
|
|
3643
3769
|
message: '',
|
|
@@ -3646,9 +3772,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3646
3772
|
case 14:
|
|
3647
3773
|
identity = this.getOrderIdentity();
|
|
3648
3774
|
externalSaleNumber = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.external_sale_number) || (identity === null || identity === void 0 ? void 0 : identity.externalSaleNumber) || undefined;
|
|
3649
|
-
orderId = (
|
|
3775
|
+
orderId = (_ref23 = (_tempOrder$order_id2 = tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.order_id) !== null && _tempOrder$order_id2 !== void 0 ? _tempOrder$order_id2 : identity === null || identity === void 0 ? void 0 : identity.orderId) !== null && _ref23 !== void 0 ? _ref23 : undefined;
|
|
3650
3776
|
orderLookup = externalSaleNumber || orderId || (identity === null || identity === void 0 ? void 0 : identity.orderNumber) || (identity === null || identity === void 0 ? void 0 : identity.shopOrderNumber) || (identity === null || identity === void 0 ? void 0 : identity.shopFullOrderNumber) || undefined;
|
|
3651
|
-
return
|
|
3777
|
+
return _context49.abrupt("return", this.request.post('/machinecode/batch', {
|
|
3652
3778
|
ids: voucherIds,
|
|
3653
3779
|
status: status,
|
|
3654
3780
|
order_lookup: orderLookup,
|
|
@@ -3659,9 +3785,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3659
3785
|
}));
|
|
3660
3786
|
case 19:
|
|
3661
3787
|
case "end":
|
|
3662
|
-
return
|
|
3788
|
+
return _context49.stop();
|
|
3663
3789
|
}
|
|
3664
|
-
},
|
|
3790
|
+
}, _callee49, this);
|
|
3665
3791
|
}));
|
|
3666
3792
|
function handleRedeem(_x30) {
|
|
3667
3793
|
return _handleRedeem.apply(this, arguments);
|
|
@@ -3675,13 +3801,13 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3675
3801
|
}, {
|
|
3676
3802
|
key: "destroy",
|
|
3677
3803
|
value: (function () {
|
|
3678
|
-
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3804
|
+
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50() {
|
|
3679
3805
|
var _this$scan;
|
|
3680
|
-
return _regeneratorRuntime().wrap(function
|
|
3681
|
-
while (1) switch (
|
|
3806
|
+
return _regeneratorRuntime().wrap(function _callee50$(_context50) {
|
|
3807
|
+
while (1) switch (_context50.prev = _context50.next) {
|
|
3682
3808
|
case 0:
|
|
3683
3809
|
this.orderCustomerContactRequest = null;
|
|
3684
|
-
|
|
3810
|
+
_context50.next = 3;
|
|
3685
3811
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "destroy", this).call(this);
|
|
3686
3812
|
case 3:
|
|
3687
3813
|
try {
|
|
@@ -3692,9 +3818,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3692
3818
|
scanCache.clear();
|
|
3693
3819
|
case 5:
|
|
3694
3820
|
case "end":
|
|
3695
|
-
return
|
|
3821
|
+
return _context50.stop();
|
|
3696
3822
|
}
|
|
3697
|
-
},
|
|
3823
|
+
}, _callee50, this);
|
|
3698
3824
|
}));
|
|
3699
3825
|
function destroy() {
|
|
3700
3826
|
return _destroy.apply(this, arguments);
|