@pisell/pisellos 2.3.219 → 2.3.220
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/modules/Product/index.d.ts +1 -1
- 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 +1 -1
- package/dist/solution/BookingTicket/index.d.ts +7 -0
- package/dist/solution/BookingTicket/index.js +510 -385
- package/lib/model/strategy/adapter/promotion/index.js +46 -1
- package/lib/modules/Product/index.d.ts +1 -1
- 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 +1 -1
- package/lib/solution/BookingTicket/index.d.ts +7 -0
- package/lib/solution/BookingTicket/index.js +50 -4
- package/package.json +1 -1
|
@@ -188,6 +188,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
188
188
|
_defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshCustomerId", null);
|
|
189
189
|
_defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshTarget", null);
|
|
190
190
|
_defineProperty(_assertThisInitialized(_this), "orderCustomerPromotionRefreshInFlight", null);
|
|
191
|
+
// Retain the settled result too: a failed refresh must remain observable by checkout callers.
|
|
192
|
+
_defineProperty(_assertThisInitialized(_this), "orderCustomerRefreshTask", Promise.resolve());
|
|
193
|
+
_defineProperty(_assertThisInitialized(_this), "orderCustomerRefreshRevision", 0);
|
|
191
194
|
_defineProperty(_assertThisInitialized(_this), "orderCustomerContactRequest", null);
|
|
192
195
|
_defineProperty(_assertThisInitialized(_this), "customerResolveRequests", new Map());
|
|
193
196
|
_defineProperty(_assertThisInitialized(_this), "loadOpenDataInFlight", null);
|
|
@@ -1857,12 +1860,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1857
1860
|
}
|
|
1858
1861
|
return;
|
|
1859
1862
|
}
|
|
1863
|
+
var enableMemberCartConsistency = this.isMemberCartConsistencyEnabled();
|
|
1860
1864
|
var next = this.buildOrderCustomerPayload();
|
|
1861
1865
|
this.core.effects.emit("".concat(this.name, ":onOrderCustomerChange"), next && options !== null && options !== void 0 && options.source ? _objectSpread(_objectSpread({}, next), {}, {
|
|
1862
1866
|
source: options.source
|
|
1863
1867
|
}) : next);
|
|
1864
|
-
|
|
1865
|
-
|
|
1868
|
+
if (enableMemberCartConsistency) {
|
|
1869
|
+
this.refreshMemberCartContext(patch.customer_id);
|
|
1870
|
+
return;
|
|
1871
|
+
}
|
|
1872
|
+
void this.refreshDiscountConfigAfterOrderCustomerChange(patch.customer_id);
|
|
1866
1873
|
var promotionRefreshTask = this.store.order.applyPromotion().then(function () {
|
|
1867
1874
|
return undefined;
|
|
1868
1875
|
});
|
|
@@ -1876,6 +1883,85 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1876
1883
|
_this3.orderCustomerPromotionRefreshInFlight = null;
|
|
1877
1884
|
});
|
|
1878
1885
|
}
|
|
1886
|
+
|
|
1887
|
+
/** Shared by customer changes and an explicit retry; keep the selected customer/cart intact. */
|
|
1888
|
+
}, {
|
|
1889
|
+
key: "refreshMemberCartContext",
|
|
1890
|
+
value: function refreshMemberCartContext(customerId) {
|
|
1891
|
+
var _this4 = this;
|
|
1892
|
+
var revision = ++this.orderCustomerRefreshRevision;
|
|
1893
|
+
var orderKey = this.getCustomerContactOrderKey();
|
|
1894
|
+
var isCurrent = function isCurrent() {
|
|
1895
|
+
var _this4$store$order$ge;
|
|
1896
|
+
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);
|
|
1897
|
+
};
|
|
1898
|
+
var task = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
|
|
1899
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
1900
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
1901
|
+
case 0:
|
|
1902
|
+
if (!customerId) {
|
|
1903
|
+
_context26.next = 5;
|
|
1904
|
+
break;
|
|
1905
|
+
}
|
|
1906
|
+
_context26.next = 3;
|
|
1907
|
+
return _this4.refreshDiscountConfigAfterOrderCustomerChange(customerId);
|
|
1908
|
+
case 3:
|
|
1909
|
+
_context26.next = 7;
|
|
1910
|
+
break;
|
|
1911
|
+
case 5:
|
|
1912
|
+
_context26.next = 7;
|
|
1913
|
+
return _this4.loadDiscountConfig({
|
|
1914
|
+
force: true
|
|
1915
|
+
});
|
|
1916
|
+
case 7:
|
|
1917
|
+
if (!isCurrent()) {
|
|
1918
|
+
_context26.next = 10;
|
|
1919
|
+
break;
|
|
1920
|
+
}
|
|
1921
|
+
_context26.next = 10;
|
|
1922
|
+
return _this4.store.order.applyPromotion();
|
|
1923
|
+
case 10:
|
|
1924
|
+
case "end":
|
|
1925
|
+
return _context26.stop();
|
|
1926
|
+
}
|
|
1927
|
+
}, _callee26);
|
|
1928
|
+
}))();
|
|
1929
|
+
this.orderCustomerRefreshTask = task;
|
|
1930
|
+
this.orderCustomerPromotionRefreshInFlight = task;
|
|
1931
|
+
void task.catch(function (error) {
|
|
1932
|
+
if (isCurrent()) console.error('[BookingTicket] Member cart refresh failed', error);
|
|
1933
|
+
}).finally(function () {
|
|
1934
|
+
if (_this4.orderCustomerPromotionRefreshInFlight === task) _this4.orderCustomerPromotionRefreshInFlight = null;
|
|
1935
|
+
});
|
|
1936
|
+
}
|
|
1937
|
+
}, {
|
|
1938
|
+
key: "retryOrderCustomerRefresh",
|
|
1939
|
+
value: function () {
|
|
1940
|
+
var _retryOrderCustomerRefresh = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
|
|
1941
|
+
var _this$store$order$get4, _this$store$order$get5;
|
|
1942
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
1943
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
1944
|
+
case 0:
|
|
1945
|
+
if (this.isMemberCartConsistencyEnabled()) {
|
|
1946
|
+
_context27.next = 2;
|
|
1947
|
+
break;
|
|
1948
|
+
}
|
|
1949
|
+
return _context27.abrupt("return");
|
|
1950
|
+
case 2:
|
|
1951
|
+
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);
|
|
1952
|
+
_context27.next = 5;
|
|
1953
|
+
return this.waitForOrderCustomerRefresh();
|
|
1954
|
+
case 5:
|
|
1955
|
+
case "end":
|
|
1956
|
+
return _context27.stop();
|
|
1957
|
+
}
|
|
1958
|
+
}, _callee27, this);
|
|
1959
|
+
}));
|
|
1960
|
+
function retryOrderCustomerRefresh() {
|
|
1961
|
+
return _retryOrderCustomerRefresh.apply(this, arguments);
|
|
1962
|
+
}
|
|
1963
|
+
return retryOrderCustomerRefresh;
|
|
1964
|
+
}()
|
|
1879
1965
|
}, {
|
|
1880
1966
|
key: "resetOrderCustomerContactInfo",
|
|
1881
1967
|
value: function resetOrderCustomerContactInfo() {
|
|
@@ -1912,25 +1998,25 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1912
1998
|
}, {
|
|
1913
1999
|
key: "replaceTempOrder",
|
|
1914
2000
|
value: function () {
|
|
1915
|
-
var _replaceTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2001
|
+
var _replaceTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
|
|
1916
2002
|
var _get2;
|
|
1917
2003
|
var _len2,
|
|
1918
2004
|
args,
|
|
1919
2005
|
_key2,
|
|
1920
|
-
|
|
1921
|
-
return _regeneratorRuntime().wrap(function
|
|
1922
|
-
while (1) switch (
|
|
2006
|
+
_args28 = arguments;
|
|
2007
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2008
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
1923
2009
|
case 0:
|
|
1924
2010
|
this.orderCustomerContactRequest = null;
|
|
1925
|
-
for (_len2 =
|
|
1926
|
-
args[_key2] =
|
|
2011
|
+
for (_len2 = _args28.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
2012
|
+
args[_key2] = _args28[_key2];
|
|
1927
2013
|
}
|
|
1928
|
-
return
|
|
2014
|
+
return _context28.abrupt("return", (_get2 = _get(_getPrototypeOf(BookingTicketImpl.prototype), "replaceTempOrder", this)).call.apply(_get2, [this].concat(args)));
|
|
1929
2015
|
case 3:
|
|
1930
2016
|
case "end":
|
|
1931
|
-
return
|
|
2017
|
+
return _context28.stop();
|
|
1932
2018
|
}
|
|
1933
|
-
},
|
|
2019
|
+
}, _callee28, this);
|
|
1934
2020
|
}));
|
|
1935
2021
|
function replaceTempOrder() {
|
|
1936
2022
|
return _replaceTempOrder.apply(this, arguments);
|
|
@@ -1940,21 +2026,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1940
2026
|
}, {
|
|
1941
2027
|
key: "applyDefaultOrderCustomerContactInfo",
|
|
1942
2028
|
value: function () {
|
|
1943
|
-
var _applyDefaultOrderCustomerContactInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1944
|
-
return _regeneratorRuntime().wrap(function
|
|
1945
|
-
while (1) switch (
|
|
2029
|
+
var _applyDefaultOrderCustomerContactInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(contact) {
|
|
2030
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2031
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
1946
2032
|
case 0:
|
|
1947
2033
|
this.store.order.updateTempOrderContactsInfo(cloneDeep(contact));
|
|
1948
2034
|
// Metadata may finish after promotion/discount refresh; publish the updated cart explicitly.
|
|
1949
|
-
|
|
2035
|
+
_context29.next = 3;
|
|
1950
2036
|
return this.effectsEmit('onTempOrderReplaced', {
|
|
1951
2037
|
tempOrder: this.getTempOrder()
|
|
1952
2038
|
});
|
|
1953
2039
|
case 3:
|
|
1954
2040
|
case "end":
|
|
1955
|
-
return
|
|
2041
|
+
return _context29.stop();
|
|
1956
2042
|
}
|
|
1957
|
-
},
|
|
2043
|
+
}, _callee29, this);
|
|
1958
2044
|
}));
|
|
1959
2045
|
function applyDefaultOrderCustomerContactInfo(_x17) {
|
|
1960
2046
|
return _applyDefaultOrderCustomerContactInfo.apply(this, arguments);
|
|
@@ -1966,7 +2052,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1966
2052
|
value: function prefillOrderCustomerContactInfo(customer, customerChanged) {
|
|
1967
2053
|
var _order$_extend2,
|
|
1968
2054
|
_this$otherParams9,
|
|
1969
|
-
|
|
2055
|
+
_this5 = this;
|
|
1970
2056
|
var order = this.getTempOrder();
|
|
1971
2057
|
var customerId = Number(order === null || order === void 0 ? void 0 : order.customer_id);
|
|
1972
2058
|
if (!order || !Number.isInteger(customerId) || customerId <= 1 || order.contacts_info != null || (_order$_extend2 = order._extend) !== null && _order$_extend2 !== void 0 && _order$_extend2.contactInfoEdited) return;
|
|
@@ -1983,8 +2069,8 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1983
2069
|
if (customer.contacts_info !== undefined) return;
|
|
1984
2070
|
var userPlatform = isCustomerUserPlatform((_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.platform);
|
|
1985
2071
|
var getAuthenticatedCustomerId = function getAuthenticatedCustomerId() {
|
|
1986
|
-
var
|
|
1987
|
-
return Number((
|
|
2072
|
+
var _this5$core, _this5$core$getPlugin, _this5$core$getPlugin2;
|
|
2073
|
+
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);
|
|
1988
2074
|
};
|
|
1989
2075
|
if (userPlatform && getAuthenticatedCustomerId() !== customerId) return;
|
|
1990
2076
|
var scope = this.getCustomerContactScope();
|
|
@@ -1999,76 +2085,76 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1999
2085
|
};
|
|
2000
2086
|
this.orderCustomerContactRequest = pending;
|
|
2001
2087
|
var loadContact = /*#__PURE__*/function () {
|
|
2002
|
-
var
|
|
2088
|
+
var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
|
|
2003
2089
|
var _result4, resolved;
|
|
2004
|
-
return _regeneratorRuntime().wrap(function
|
|
2005
|
-
while (1) switch (
|
|
2090
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
2091
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
2006
2092
|
case 0:
|
|
2007
2093
|
if (!userPlatform) {
|
|
2008
|
-
|
|
2094
|
+
_context30.next = 7;
|
|
2009
2095
|
break;
|
|
2010
2096
|
}
|
|
2011
|
-
|
|
2012
|
-
return
|
|
2097
|
+
_context30.next = 3;
|
|
2098
|
+
return _this5.request.get('/customer/metadata', {
|
|
2013
2099
|
key: 'contacts_info'
|
|
2014
2100
|
});
|
|
2015
2101
|
case 3:
|
|
2016
|
-
_result4 =
|
|
2102
|
+
_result4 = _context30.sent;
|
|
2017
2103
|
if (!((_result4 === null || _result4 === void 0 ? void 0 : _result4.code) !== 200 || (_result4 === null || _result4 === void 0 ? void 0 : _result4.status) === false)) {
|
|
2018
|
-
|
|
2104
|
+
_context30.next = 6;
|
|
2019
2105
|
break;
|
|
2020
2106
|
}
|
|
2021
2107
|
throw new Error('Customer contact lookup failed');
|
|
2022
2108
|
case 6:
|
|
2023
|
-
return
|
|
2109
|
+
return _context30.abrupt("return", isContactRecord(_result4.data) ? _result4.data : null);
|
|
2024
2110
|
case 7:
|
|
2025
|
-
|
|
2026
|
-
return
|
|
2111
|
+
_context30.next = 9;
|
|
2112
|
+
return _this5.resolveCustomerById(customerId);
|
|
2027
2113
|
case 9:
|
|
2028
|
-
resolved =
|
|
2029
|
-
return
|
|
2114
|
+
resolved = _context30.sent;
|
|
2115
|
+
return _context30.abrupt("return", Number(resolved === null || resolved === void 0 ? void 0 : resolved.id) === customerId ? extractCustomerContactInfo(resolved) : null);
|
|
2030
2116
|
case 11:
|
|
2031
2117
|
case "end":
|
|
2032
|
-
return
|
|
2118
|
+
return _context30.stop();
|
|
2033
2119
|
}
|
|
2034
|
-
},
|
|
2120
|
+
}, _callee30);
|
|
2035
2121
|
}));
|
|
2036
2122
|
return function loadContact() {
|
|
2037
|
-
return
|
|
2123
|
+
return _ref12.apply(this, arguments);
|
|
2038
2124
|
};
|
|
2039
2125
|
}();
|
|
2040
2126
|
pending.promise = loadContact().then( /*#__PURE__*/function () {
|
|
2041
|
-
var
|
|
2127
|
+
var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(value) {
|
|
2042
2128
|
var _current$_extend;
|
|
2043
2129
|
var current;
|
|
2044
|
-
return _regeneratorRuntime().wrap(function
|
|
2045
|
-
while (1) switch (
|
|
2130
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
2131
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
2046
2132
|
case 0:
|
|
2047
|
-
current =
|
|
2048
|
-
if (!(
|
|
2049
|
-
|
|
2133
|
+
current = _this5.getTempOrder();
|
|
2134
|
+
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)) {
|
|
2135
|
+
_context31.next = 3;
|
|
2050
2136
|
break;
|
|
2051
2137
|
}
|
|
2052
|
-
return
|
|
2138
|
+
return _context31.abrupt("return");
|
|
2053
2139
|
case 3:
|
|
2054
2140
|
if (!value) {
|
|
2055
|
-
|
|
2141
|
+
_context31.next = 6;
|
|
2056
2142
|
break;
|
|
2057
2143
|
}
|
|
2058
|
-
|
|
2059
|
-
return
|
|
2144
|
+
_context31.next = 6;
|
|
2145
|
+
return _this5.applyDefaultOrderCustomerContactInfo(value);
|
|
2060
2146
|
case 6:
|
|
2061
2147
|
case "end":
|
|
2062
|
-
return
|
|
2148
|
+
return _context31.stop();
|
|
2063
2149
|
}
|
|
2064
|
-
},
|
|
2150
|
+
}, _callee31);
|
|
2065
2151
|
}));
|
|
2066
2152
|
return function (_x18) {
|
|
2067
|
-
return
|
|
2153
|
+
return _ref13.apply(this, arguments);
|
|
2068
2154
|
};
|
|
2069
2155
|
}()).catch(function () {
|
|
2070
2156
|
// A failed default does not prevent manual entry; a subsequent sync can retry.
|
|
2071
|
-
if (
|
|
2157
|
+
if (_this5.orderCustomerContactRequest === pending) _this5.orderCustomerContactRequest = null;
|
|
2072
2158
|
console.warn('[BookingTicket] Failed to load saved customer contact information');
|
|
2073
2159
|
});
|
|
2074
2160
|
}
|
|
@@ -2081,31 +2167,31 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2081
2167
|
}, {
|
|
2082
2168
|
key: "validateContactInfo",
|
|
2083
2169
|
value: function () {
|
|
2084
|
-
var _validateContactInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2170
|
+
var _validateContactInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
|
|
2085
2171
|
var _this$getTempOrder, _this$getTempOrder2;
|
|
2086
2172
|
var orderKey, customerId, scope;
|
|
2087
|
-
return _regeneratorRuntime().wrap(function
|
|
2088
|
-
while (1) switch (
|
|
2173
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
2174
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
2089
2175
|
case 0:
|
|
2090
2176
|
orderKey = this.getCustomerContactOrderKey();
|
|
2091
2177
|
customerId = (_this$getTempOrder = this.getTempOrder()) === null || _this$getTempOrder === void 0 ? void 0 : _this$getTempOrder.customer_id;
|
|
2092
2178
|
scope = this.getCustomerContactScope();
|
|
2093
|
-
|
|
2179
|
+
_context32.next = 5;
|
|
2094
2180
|
return this.waitForOrderCustomerContactInfo();
|
|
2095
2181
|
case 5:
|
|
2096
2182
|
if (!(this.getCustomerContactOrderKey() !== orderKey || ((_this$getTempOrder2 = this.getTempOrder()) === null || _this$getTempOrder2 === void 0 ? void 0 : _this$getTempOrder2.customer_id) !== customerId || this.getCustomerContactScope() !== scope)) {
|
|
2097
|
-
|
|
2183
|
+
_context32.next = 7;
|
|
2098
2184
|
break;
|
|
2099
2185
|
}
|
|
2100
2186
|
throw new Error('The order changed. Please try again.');
|
|
2101
2187
|
case 7:
|
|
2102
|
-
|
|
2188
|
+
_context32.next = 9;
|
|
2103
2189
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "validateContactInfo", this).call(this);
|
|
2104
2190
|
case 9:
|
|
2105
2191
|
case "end":
|
|
2106
|
-
return
|
|
2192
|
+
return _context32.stop();
|
|
2107
2193
|
}
|
|
2108
|
-
},
|
|
2194
|
+
}, _callee32, this);
|
|
2109
2195
|
}));
|
|
2110
2196
|
function validateContactInfo() {
|
|
2111
2197
|
return _validateContactInfo.apply(this, arguments);
|
|
@@ -2138,7 +2224,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2138
2224
|
value: function clearOrderCustomer(options) {
|
|
2139
2225
|
var _discountModule$setOr,
|
|
2140
2226
|
_discountModule$setDi,
|
|
2141
|
-
|
|
2227
|
+
_this6 = this;
|
|
2228
|
+
var enableMemberCartConsistency = this.isMemberCartConsistencyEnabled();
|
|
2229
|
+
var refreshRevision = enableMemberCartConsistency ? ++this.orderCustomerRefreshRevision : undefined;
|
|
2142
2230
|
this.orderCustomerContactRequest = null;
|
|
2143
2231
|
if (!(options !== null && options !== void 0 && options.preserveContactInfo)) this.resetOrderCustomerContactInfo();
|
|
2144
2232
|
if (!(options !== null && options !== void 0 && options.preserveContactInfo)) this.store.order.updateTempOrderContactsInfo(null);
|
|
@@ -2150,19 +2238,25 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2150
2238
|
void (discountModule === null || discountModule === void 0 || (_discountModule$setOr = discountModule.setOriginalDiscountList) === null || _discountModule$setOr === void 0 ? void 0 : _discountModule$setOr.call(discountModule, []));
|
|
2151
2239
|
void (discountModule === null || discountModule === void 0 || (_discountModule$setDi = discountModule.setDiscountList) === null || _discountModule$setDi === void 0 ? void 0 : _discountModule$setDi.call(discountModule, []));
|
|
2152
2240
|
this.store.order.applyDiscount();
|
|
2153
|
-
|
|
2241
|
+
var customerOrderKey = enableMemberCartConsistency ? this.getCustomerContactOrderKey() : undefined;
|
|
2242
|
+
var refreshTask = this.store.order.recalculateSummary({
|
|
2154
2243
|
createIfMissing: true
|
|
2155
2244
|
}).then(function () {
|
|
2156
2245
|
var _discountModule$getDi;
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2246
|
+
if (enableMemberCartConsistency && (_this6.orderCustomerRefreshRevision !== refreshRevision || _this6.getCustomerContactOrderKey() !== customerOrderKey)) return;
|
|
2247
|
+
var tempOrder = _this6.store.order.ensureTempOrder();
|
|
2248
|
+
_this6.store.order.persistTempOrder();
|
|
2249
|
+
return _this6.effectsEmit('onDiscountApplied', {
|
|
2160
2250
|
productList: tempOrder.products || [],
|
|
2161
2251
|
discountList: (discountModule === null || discountModule === void 0 || (_discountModule$getDi = discountModule.getDiscountList) === null || _discountModule$getDi === void 0 ? void 0 : _discountModule$getDi.call(discountModule)) || [],
|
|
2162
2252
|
selectedDiscountList: tempOrder.discount_list || [],
|
|
2163
2253
|
tempOrder: tempOrder
|
|
2164
2254
|
});
|
|
2165
|
-
})
|
|
2255
|
+
});
|
|
2256
|
+
if (enableMemberCartConsistency) this.orderCustomerRefreshTask = refreshTask.then(function () {
|
|
2257
|
+
return undefined;
|
|
2258
|
+
});
|
|
2259
|
+
void (enableMemberCartConsistency ? this.orderCustomerRefreshTask : refreshTask).catch(function (error) {
|
|
2166
2260
|
console.error('Failed to recalculate summary after clearing customer:', error);
|
|
2167
2261
|
});
|
|
2168
2262
|
this.core.effects.emit("".concat(this.name, ":onOrderCustomerChange"), null);
|
|
@@ -2180,24 +2274,24 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2180
2274
|
}, {
|
|
2181
2275
|
key: "restoreOrder",
|
|
2182
2276
|
value: (function () {
|
|
2183
|
-
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2277
|
+
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
|
|
2184
2278
|
var _this$store$customer;
|
|
2185
2279
|
var tempOrder;
|
|
2186
|
-
return _regeneratorRuntime().wrap(function
|
|
2187
|
-
while (1) switch (
|
|
2280
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
2281
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
2188
2282
|
case 0:
|
|
2189
|
-
|
|
2283
|
+
_context33.next = 2;
|
|
2190
2284
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "restoreOrder", this).call(this);
|
|
2191
2285
|
case 2:
|
|
2192
|
-
tempOrder =
|
|
2286
|
+
tempOrder = _context33.sent;
|
|
2193
2287
|
this.clearOrderCustomer();
|
|
2194
2288
|
(_this$store$customer = this.store.customer) === null || _this$store$customer === void 0 || _this$store$customer.setSelectedCustomer(null);
|
|
2195
|
-
return
|
|
2289
|
+
return _context33.abrupt("return", tempOrder);
|
|
2196
2290
|
case 6:
|
|
2197
2291
|
case "end":
|
|
2198
|
-
return
|
|
2292
|
+
return _context33.stop();
|
|
2199
2293
|
}
|
|
2200
|
-
},
|
|
2294
|
+
}, _callee33, this);
|
|
2201
2295
|
}));
|
|
2202
2296
|
function restoreOrder() {
|
|
2203
2297
|
return _restoreOrder.apply(this, arguments);
|
|
@@ -2217,12 +2311,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2217
2311
|
}, {
|
|
2218
2312
|
key: "refreshDiscountConfigAfterOrderCustomerChange",
|
|
2219
2313
|
value: function refreshDiscountConfigAfterOrderCustomerChange(customerId) {
|
|
2220
|
-
var _this$store$order$
|
|
2314
|
+
var _this$store$order$get6,
|
|
2221
2315
|
_this$store$order6,
|
|
2222
2316
|
_this$getOrderIdentit,
|
|
2223
|
-
|
|
2317
|
+
_this7 = this;
|
|
2224
2318
|
if (!customerId || customerId === 1) return Promise.resolve();
|
|
2225
|
-
var tempOrder = (_this$store$order$
|
|
2319
|
+
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);
|
|
2226
2320
|
var orderIdentity = (_this$getOrderIdentit = this.getOrderIdentity) === null || _this$getOrderIdentit === void 0 ? void 0 : _this$getOrderIdentit.call(this);
|
|
2227
2321
|
var orderId = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.order_id) || (orderIdentity === null || orderIdentity === void 0 ? void 0 : orderIdentity.orderId);
|
|
2228
2322
|
var action = !orderId || String(orderId).startsWith('local_order') ? 'create' : 'edit';
|
|
@@ -2232,50 +2326,50 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2232
2326
|
return this.orderCustomerDiscountRefreshInFlight;
|
|
2233
2327
|
}
|
|
2234
2328
|
var previousRefresh = this.orderCustomerDiscountRefreshInFlight;
|
|
2235
|
-
var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2236
|
-
var
|
|
2329
|
+
var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
|
|
2330
|
+
var _this7$store$order$ge, _this7$store$order, _this7$getOrderIdenti;
|
|
2237
2331
|
var currentCustomer, currentTempOrder, currentOrderIdentity, currentOrderId, currentAction, currentOrderTarget;
|
|
2238
|
-
return _regeneratorRuntime().wrap(function
|
|
2239
|
-
while (1) switch (
|
|
2332
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
2333
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
2240
2334
|
case 0:
|
|
2241
2335
|
if (!previousRefresh) {
|
|
2242
|
-
|
|
2336
|
+
_context34.next = 3;
|
|
2243
2337
|
break;
|
|
2244
2338
|
}
|
|
2245
|
-
|
|
2339
|
+
_context34.next = 3;
|
|
2246
2340
|
return previousRefresh.catch(function () {
|
|
2247
2341
|
return undefined;
|
|
2248
2342
|
});
|
|
2249
2343
|
case 3:
|
|
2250
|
-
currentCustomer =
|
|
2344
|
+
currentCustomer = _this7.store.order.getOrderCustomer();
|
|
2251
2345
|
if (!(!currentCustomer || Number(currentCustomer.customer_id) !== customerId)) {
|
|
2252
|
-
|
|
2346
|
+
_context34.next = 6;
|
|
2253
2347
|
break;
|
|
2254
2348
|
}
|
|
2255
|
-
return
|
|
2349
|
+
return _context34.abrupt("return");
|
|
2256
2350
|
case 6:
|
|
2257
|
-
currentTempOrder = (
|
|
2258
|
-
currentOrderIdentity = (
|
|
2351
|
+
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);
|
|
2352
|
+
currentOrderIdentity = (_this7$getOrderIdenti = _this7.getOrderIdentity) === null || _this7$getOrderIdenti === void 0 ? void 0 : _this7$getOrderIdenti.call(_this7);
|
|
2259
2353
|
currentOrderId = (currentTempOrder === null || currentTempOrder === void 0 ? void 0 : currentTempOrder.order_id) || (currentOrderIdentity === null || currentOrderIdentity === void 0 ? void 0 : currentOrderIdentity.orderId);
|
|
2260
2354
|
currentAction = !currentOrderId || String(currentOrderId).startsWith('local_order') ? 'create' : 'edit';
|
|
2261
2355
|
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'));
|
|
2262
2356
|
if (!("".concat(customerId, ":").concat(currentAction, ":").concat(currentOrderTarget) !== refreshTarget)) {
|
|
2263
|
-
|
|
2357
|
+
_context34.next = 13;
|
|
2264
2358
|
break;
|
|
2265
2359
|
}
|
|
2266
|
-
return
|
|
2360
|
+
return _context34.abrupt("return");
|
|
2267
2361
|
case 13:
|
|
2268
|
-
|
|
2269
|
-
return
|
|
2362
|
+
_context34.next = 15;
|
|
2363
|
+
return _this7.loadDiscountConfig({
|
|
2270
2364
|
customerId: customerId,
|
|
2271
2365
|
action: action,
|
|
2272
2366
|
force: true
|
|
2273
2367
|
});
|
|
2274
2368
|
case 15:
|
|
2275
2369
|
case "end":
|
|
2276
|
-
return
|
|
2370
|
+
return _context34.stop();
|
|
2277
2371
|
}
|
|
2278
|
-
},
|
|
2372
|
+
}, _callee34);
|
|
2279
2373
|
}))();
|
|
2280
2374
|
this.orderCustomerDiscountRefreshInFlight = refreshTask;
|
|
2281
2375
|
this.orderCustomerDiscountRefreshCustomerId = customerId;
|
|
@@ -2283,10 +2377,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2283
2377
|
refreshTask.catch(function (error) {
|
|
2284
2378
|
console.error('Failed to load discount config after customer change:', error);
|
|
2285
2379
|
}).finally(function () {
|
|
2286
|
-
if (
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2380
|
+
if (_this7.orderCustomerDiscountRefreshInFlight !== refreshTask) return;
|
|
2381
|
+
_this7.orderCustomerDiscountRefreshInFlight = null;
|
|
2382
|
+
_this7.orderCustomerDiscountRefreshCustomerId = null;
|
|
2383
|
+
_this7.orderCustomerDiscountRefreshTarget = null;
|
|
2290
2384
|
});
|
|
2291
2385
|
return refreshTask;
|
|
2292
2386
|
}
|
|
@@ -2295,31 +2389,62 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2295
2389
|
value: function waitForOrderCustomerPromotionRefresh() {
|
|
2296
2390
|
return this.orderCustomerPromotionRefreshInFlight || Promise.resolve();
|
|
2297
2391
|
}
|
|
2392
|
+
|
|
2393
|
+
/** Wait before reading cart rows: member coupons can split or consolidate them. */
|
|
2394
|
+
}, {
|
|
2395
|
+
key: "waitForOrderCustomerRefresh",
|
|
2396
|
+
value: (function () {
|
|
2397
|
+
var _waitForOrderCustomerRefresh = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
|
|
2398
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
2399
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
2400
|
+
case 0:
|
|
2401
|
+
if (this.isMemberCartConsistencyEnabled()) {
|
|
2402
|
+
_context35.next = 2;
|
|
2403
|
+
break;
|
|
2404
|
+
}
|
|
2405
|
+
return _context35.abrupt("return");
|
|
2406
|
+
case 2:
|
|
2407
|
+
_context35.next = 4;
|
|
2408
|
+
return Promise.resolve();
|
|
2409
|
+
case 4:
|
|
2410
|
+
_context35.next = 6;
|
|
2411
|
+
return this.orderCustomerRefreshTask;
|
|
2412
|
+
case 6:
|
|
2413
|
+
case "end":
|
|
2414
|
+
return _context35.stop();
|
|
2415
|
+
}
|
|
2416
|
+
}, _callee35, this);
|
|
2417
|
+
}));
|
|
2418
|
+
function waitForOrderCustomerRefresh() {
|
|
2419
|
+
return _waitForOrderCustomerRefresh.apply(this, arguments);
|
|
2420
|
+
}
|
|
2421
|
+
return waitForOrderCustomerRefresh;
|
|
2422
|
+
}())
|
|
2298
2423
|
}, {
|
|
2299
2424
|
key: "prepareProductPriceQueryContext",
|
|
2300
2425
|
value: function () {
|
|
2301
|
-
var _prepareProductPriceQueryContext = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2426
|
+
var _prepareProductPriceQueryContext = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(customerId) {
|
|
2302
2427
|
var normalizedCustomerId, refreshTask, shouldWait;
|
|
2303
|
-
return _regeneratorRuntime().wrap(function
|
|
2304
|
-
while (1) switch (
|
|
2428
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
2429
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
2305
2430
|
case 0:
|
|
2306
|
-
|
|
2431
|
+
_context36.next = 2;
|
|
2307
2432
|
return Promise.resolve();
|
|
2308
2433
|
case 2:
|
|
2309
2434
|
normalizedCustomerId = Number(customerId || 0);
|
|
2310
2435
|
refreshTask = this.orderCustomerDiscountRefreshInFlight;
|
|
2311
2436
|
shouldWait = normalizedCustomerId > 1 && this.orderCustomerDiscountRefreshCustomerId === normalizedCustomerId && Boolean(refreshTask);
|
|
2312
2437
|
if (!(shouldWait && refreshTask)) {
|
|
2313
|
-
|
|
2438
|
+
_context36.next = 8;
|
|
2314
2439
|
break;
|
|
2315
2440
|
}
|
|
2316
|
-
|
|
2441
|
+
_context36.next = 8;
|
|
2317
2442
|
return refreshTask;
|
|
2318
2443
|
case 8:
|
|
2319
2444
|
case "end":
|
|
2320
|
-
return
|
|
2445
|
+
return _context36.stop();
|
|
2321
2446
|
}
|
|
2322
|
-
},
|
|
2447
|
+
}, _callee36, this);
|
|
2323
2448
|
}));
|
|
2324
2449
|
function prepareProductPriceQueryContext(_x19) {
|
|
2325
2450
|
return _prepareProductPriceQueryContext.apply(this, arguments);
|
|
@@ -2374,27 +2499,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2374
2499
|
}, {
|
|
2375
2500
|
key: "changeCustomerPage",
|
|
2376
2501
|
value: (function () {
|
|
2377
|
-
var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2502
|
+
var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(page, pageSize) {
|
|
2378
2503
|
var _result5;
|
|
2379
|
-
return _regeneratorRuntime().wrap(function
|
|
2380
|
-
while (1) switch (
|
|
2504
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
2505
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
2381
2506
|
case 0:
|
|
2382
|
-
|
|
2383
|
-
|
|
2507
|
+
_context37.prev = 0;
|
|
2508
|
+
_context37.next = 3;
|
|
2384
2509
|
return this.store.customer.changeCustomerPage(page, pageSize);
|
|
2385
2510
|
case 3:
|
|
2386
|
-
_result5 =
|
|
2387
|
-
return
|
|
2511
|
+
_result5 = _context37.sent;
|
|
2512
|
+
return _context37.abrupt("return", _result5);
|
|
2388
2513
|
case 7:
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
console.error('Failed to change customer page:',
|
|
2392
|
-
throw
|
|
2514
|
+
_context37.prev = 7;
|
|
2515
|
+
_context37.t0 = _context37["catch"](0);
|
|
2516
|
+
console.error('Failed to change customer page:', _context37.t0);
|
|
2517
|
+
throw _context37.t0;
|
|
2393
2518
|
case 11:
|
|
2394
2519
|
case "end":
|
|
2395
|
-
return
|
|
2520
|
+
return _context37.stop();
|
|
2396
2521
|
}
|
|
2397
|
-
},
|
|
2522
|
+
}, _callee37, this, [[0, 7]]);
|
|
2398
2523
|
}));
|
|
2399
2524
|
function changeCustomerPage(_x20, _x21) {
|
|
2400
2525
|
return _changeCustomerPage.apply(this, arguments);
|
|
@@ -2409,28 +2534,28 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2409
2534
|
}, {
|
|
2410
2535
|
key: "loadMoreCustomers",
|
|
2411
2536
|
value: (function () {
|
|
2412
|
-
var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2537
|
+
var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
|
|
2413
2538
|
var _result6;
|
|
2414
|
-
return _regeneratorRuntime().wrap(function
|
|
2415
|
-
while (1) switch (
|
|
2539
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
2540
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
2416
2541
|
case 0:
|
|
2417
|
-
|
|
2418
|
-
|
|
2542
|
+
_context38.prev = 0;
|
|
2543
|
+
_context38.next = 3;
|
|
2419
2544
|
return this.store.customer.loadMoreCustomers();
|
|
2420
2545
|
case 3:
|
|
2421
|
-
_result6 =
|
|
2546
|
+
_result6 = _context38.sent;
|
|
2422
2547
|
this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), _result6);
|
|
2423
|
-
return
|
|
2548
|
+
return _context38.abrupt("return", _result6);
|
|
2424
2549
|
case 8:
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
console.error('Failed to load more customers:',
|
|
2428
|
-
throw
|
|
2550
|
+
_context38.prev = 8;
|
|
2551
|
+
_context38.t0 = _context38["catch"](0);
|
|
2552
|
+
console.error('Failed to load more customers:', _context38.t0);
|
|
2553
|
+
throw _context38.t0;
|
|
2429
2554
|
case 12:
|
|
2430
2555
|
case "end":
|
|
2431
|
-
return
|
|
2556
|
+
return _context38.stop();
|
|
2432
2557
|
}
|
|
2433
|
-
},
|
|
2558
|
+
}, _callee38, this, [[0, 8]]);
|
|
2434
2559
|
}));
|
|
2435
2560
|
function loadMoreCustomers() {
|
|
2436
2561
|
return _loadMoreCustomers.apply(this, arguments);
|
|
@@ -2446,31 +2571,31 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2446
2571
|
}, {
|
|
2447
2572
|
key: "resetAndLoadCustomers",
|
|
2448
2573
|
value: (function () {
|
|
2449
|
-
var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2574
|
+
var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
|
|
2450
2575
|
var params,
|
|
2451
2576
|
_result7,
|
|
2452
|
-
|
|
2453
|
-
return _regeneratorRuntime().wrap(function
|
|
2454
|
-
while (1) switch (
|
|
2577
|
+
_args39 = arguments;
|
|
2578
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
2579
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
2455
2580
|
case 0:
|
|
2456
|
-
params =
|
|
2457
|
-
|
|
2458
|
-
|
|
2581
|
+
params = _args39.length > 0 && _args39[0] !== undefined ? _args39[0] : {};
|
|
2582
|
+
_context39.prev = 1;
|
|
2583
|
+
_context39.next = 4;
|
|
2459
2584
|
return this.store.customer.resetAndLoadCustomers(params);
|
|
2460
2585
|
case 4:
|
|
2461
|
-
_result7 =
|
|
2586
|
+
_result7 = _context39.sent;
|
|
2462
2587
|
this.core.effects.emit("".concat(this.name, ":onCustomerListReset"), _result7);
|
|
2463
|
-
return
|
|
2588
|
+
return _context39.abrupt("return", _result7);
|
|
2464
2589
|
case 9:
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
console.error('Failed to reset and load customers:',
|
|
2468
|
-
throw
|
|
2590
|
+
_context39.prev = 9;
|
|
2591
|
+
_context39.t0 = _context39["catch"](1);
|
|
2592
|
+
console.error('Failed to reset and load customers:', _context39.t0);
|
|
2593
|
+
throw _context39.t0;
|
|
2469
2594
|
case 13:
|
|
2470
2595
|
case "end":
|
|
2471
|
-
return
|
|
2596
|
+
return _context39.stop();
|
|
2472
2597
|
}
|
|
2473
|
-
},
|
|
2598
|
+
}, _callee39, this, [[1, 9]]);
|
|
2474
2599
|
}));
|
|
2475
2600
|
function resetAndLoadCustomers() {
|
|
2476
2601
|
return _resetAndLoadCustomers.apply(this, arguments);
|
|
@@ -2515,9 +2640,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2515
2640
|
}, {
|
|
2516
2641
|
key: "scanGlobalListener",
|
|
2517
2642
|
value: function scanGlobalListener(callback) {
|
|
2518
|
-
var
|
|
2643
|
+
var _this8 = this;
|
|
2519
2644
|
var localSearch = function localSearch(v) {
|
|
2520
|
-
return
|
|
2645
|
+
return _this8.store.products.findProductsByCodeOrBarcode(v);
|
|
2521
2646
|
};
|
|
2522
2647
|
var scanCallback = handleGlobalScan(this.request, localSearch, this.getSubmitOrderSalesChannel());
|
|
2523
2648
|
var safeCallback = function safeCallback(d) {
|
|
@@ -2631,16 +2756,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2631
2756
|
}, {
|
|
2632
2757
|
key: "getOtherParams",
|
|
2633
2758
|
value: (function () {
|
|
2634
|
-
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2635
|
-
return _regeneratorRuntime().wrap(function
|
|
2636
|
-
while (1) switch (
|
|
2759
|
+
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
|
|
2760
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
2761
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
2637
2762
|
case 0:
|
|
2638
|
-
return
|
|
2763
|
+
return _context40.abrupt("return", this.otherParams);
|
|
2639
2764
|
case 1:
|
|
2640
2765
|
case "end":
|
|
2641
|
-
return
|
|
2766
|
+
return _context40.stop();
|
|
2642
2767
|
}
|
|
2643
|
-
},
|
|
2768
|
+
}, _callee40, this);
|
|
2644
2769
|
}));
|
|
2645
2770
|
function getOtherParams() {
|
|
2646
2771
|
return _getOtherParams.apply(this, arguments);
|
|
@@ -2750,7 +2875,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2750
2875
|
var _extra$date,
|
|
2751
2876
|
_extra$presetStartTim,
|
|
2752
2877
|
_this$getOrderSession,
|
|
2753
|
-
|
|
2878
|
+
_this9 = this,
|
|
2754
2879
|
_this$otherParams10;
|
|
2755
2880
|
var state = this.store.bookingContext.getState();
|
|
2756
2881
|
var date = (_extra$date = extra === null || extra === void 0 ? void 0 : extra.date) !== null && _extra$date !== void 0 ? _extra$date : state.date;
|
|
@@ -2763,7 +2888,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2763
2888
|
}, extra || {}), {}, {
|
|
2764
2889
|
orderSessionId: (_this$getOrderSession = this.getOrderSessionId()) !== null && _this$getOrderSession !== void 0 ? _this$getOrderSession : undefined,
|
|
2765
2890
|
isOrderSessionCurrent: function isOrderSessionCurrent(sessionId) {
|
|
2766
|
-
return
|
|
2891
|
+
return _this9.isOrderSessionCurrent(sessionId);
|
|
2767
2892
|
},
|
|
2768
2893
|
platform: String(((_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.platform) || '').trim().toLowerCase()
|
|
2769
2894
|
});
|
|
@@ -2861,17 +2986,17 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2861
2986
|
key: "buildAddProductCtx",
|
|
2862
2987
|
value: function buildAddProductCtx(extra) {
|
|
2863
2988
|
var _extra$date2,
|
|
2864
|
-
|
|
2989
|
+
_ref15,
|
|
2865
2990
|
_this$getOrderCustome4,
|
|
2866
2991
|
_this$getOrderCustome5,
|
|
2867
|
-
_this$store$order$
|
|
2992
|
+
_this$store$order$get7,
|
|
2868
2993
|
_extra$presetStartTim2,
|
|
2869
2994
|
_this$getOrderSession2,
|
|
2870
|
-
|
|
2995
|
+
_this10 = this,
|
|
2871
2996
|
_this$otherParams11;
|
|
2872
2997
|
var bookingContextState = this.store.bookingContext.getState();
|
|
2873
2998
|
var date = (_extra$date2 = extra === null || extra === void 0 ? void 0 : extra.date) !== null && _extra$date2 !== void 0 ? _extra$date2 : bookingContextState.date;
|
|
2874
|
-
var orderCustomerId = (
|
|
2999
|
+
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;
|
|
2875
3000
|
return _objectSpread(_objectSpread({
|
|
2876
3001
|
bookingConfig: bookingContextState.bookingConfig,
|
|
2877
3002
|
resourcesOrigin: bookingContextState.resourcesOrigin,
|
|
@@ -2883,7 +3008,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2883
3008
|
channel: this.getSubmitOrderSalesChannel(),
|
|
2884
3009
|
orderSessionId: (_this$getOrderSession2 = this.getOrderSessionId()) !== null && _this$getOrderSession2 !== void 0 ? _this$getOrderSession2 : undefined,
|
|
2885
3010
|
isOrderSessionCurrent: function isOrderSessionCurrent(sessionId) {
|
|
2886
|
-
return
|
|
3011
|
+
return _this10.isOrderSessionCurrent(sessionId);
|
|
2887
3012
|
},
|
|
2888
3013
|
platform: String(((_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.platform) || '').trim().toLowerCase()
|
|
2889
3014
|
});
|
|
@@ -2987,16 +3112,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2987
3112
|
}, {
|
|
2988
3113
|
key: "updateProductInOrder",
|
|
2989
3114
|
value: (function () {
|
|
2990
|
-
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2991
|
-
return _regeneratorRuntime().wrap(function
|
|
2992
|
-
while (1) switch (
|
|
3115
|
+
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(params) {
|
|
3116
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
3117
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
2993
3118
|
case 0:
|
|
2994
|
-
return
|
|
3119
|
+
return _context41.abrupt("return", this.updateOrderProduct(params));
|
|
2995
3120
|
case 1:
|
|
2996
3121
|
case "end":
|
|
2997
|
-
return
|
|
3122
|
+
return _context41.stop();
|
|
2998
3123
|
}
|
|
2999
|
-
},
|
|
3124
|
+
}, _callee41, this);
|
|
3000
3125
|
}));
|
|
3001
3126
|
function updateProductInOrder(_x22) {
|
|
3002
3127
|
return _updateProductInOrder.apply(this, arguments);
|
|
@@ -3020,24 +3145,24 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3020
3145
|
}, {
|
|
3021
3146
|
key: "handleGlobalScanCode",
|
|
3022
3147
|
value: (function () {
|
|
3023
|
-
var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3024
|
-
var
|
|
3148
|
+
var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(code, bridge) {
|
|
3149
|
+
var _this11 = this;
|
|
3025
3150
|
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;
|
|
3026
|
-
return _regeneratorRuntime().wrap(function
|
|
3027
|
-
while (1) switch (
|
|
3151
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
3152
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
3028
3153
|
case 0:
|
|
3029
3154
|
trimmed = typeof code === 'string' ? code.trim() : '';
|
|
3030
3155
|
if (trimmed) {
|
|
3031
|
-
|
|
3156
|
+
_context43.next = 4;
|
|
3032
3157
|
break;
|
|
3033
3158
|
}
|
|
3034
3159
|
bridge === null || bridge === void 0 || (_bridge$onNotify = bridge.onNotify) === null || _bridge$onNotify === void 0 || _bridge$onNotify.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
3035
|
-
return
|
|
3160
|
+
return _context43.abrupt("return", {
|
|
3036
3161
|
status: 'failed',
|
|
3037
3162
|
reason: 'empty_code'
|
|
3038
3163
|
});
|
|
3039
3164
|
case 4:
|
|
3040
|
-
|
|
3165
|
+
_context43.prev = 4;
|
|
3041
3166
|
// Capture before lookup/UI awaits, so a result cannot land in a new cart.
|
|
3042
3167
|
// Unscoped POS Order modules return a no-op guard.
|
|
3043
3168
|
beforeScanCommit = this.store.order.createCartIntentCommitGuard('add_product');
|
|
@@ -3064,23 +3189,23 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3064
3189
|
} : undefined
|
|
3065
3190
|
}) : undefined;
|
|
3066
3191
|
if (!((guardedBridge === null || guardedBridge === void 0 ? void 0 : guardedBridge.scanScope) === 'product-voucher')) {
|
|
3067
|
-
|
|
3192
|
+
_context43.next = 16;
|
|
3068
3193
|
break;
|
|
3069
3194
|
}
|
|
3070
3195
|
if (guardedBridge.applyPromotionCode) {
|
|
3071
|
-
|
|
3196
|
+
_context43.next = 12;
|
|
3072
3197
|
break;
|
|
3073
3198
|
}
|
|
3074
|
-
return
|
|
3199
|
+
return _context43.abrupt("return", {
|
|
3075
3200
|
status: 'failed',
|
|
3076
3201
|
reason: 'no_bridge'
|
|
3077
3202
|
});
|
|
3078
3203
|
case 12:
|
|
3079
|
-
|
|
3204
|
+
_context43.next = 14;
|
|
3080
3205
|
return guardedBridge.applyPromotionCode(trimmed);
|
|
3081
3206
|
case 14:
|
|
3082
|
-
promotion =
|
|
3083
|
-
return
|
|
3207
|
+
promotion = _context43.sent;
|
|
3208
|
+
return _context43.abrupt("return", ((_promotion$isAccepted = promotion.isAccepted) !== null && _promotion$isAccepted !== void 0 ? _promotion$isAccepted : promotion.isAvailable) ? {
|
|
3084
3209
|
status: 'success',
|
|
3085
3210
|
kind: 'promotion'
|
|
3086
3211
|
} : {
|
|
@@ -3089,23 +3214,23 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3089
3214
|
});
|
|
3090
3215
|
case 16:
|
|
3091
3216
|
localSearch = function localSearch(v) {
|
|
3092
|
-
return
|
|
3217
|
+
return _this11.store.products.findProductsByCodeOrBarcode(v);
|
|
3093
3218
|
};
|
|
3094
3219
|
scanCallback = handleGlobalScan(this.request, localSearch, this.getSubmitOrderSalesChannel());
|
|
3095
|
-
|
|
3220
|
+
_context43.next = 20;
|
|
3096
3221
|
return scanCallback({
|
|
3097
3222
|
type: 'nativeScanner',
|
|
3098
3223
|
value: trimmed
|
|
3099
3224
|
});
|
|
3100
3225
|
case 20:
|
|
3101
|
-
raw =
|
|
3226
|
+
raw = _context43.sent;
|
|
3102
3227
|
formatted = formatGlobalScanResult(raw, trimmed);
|
|
3103
3228
|
if (formatted) {
|
|
3104
|
-
|
|
3229
|
+
_context43.next = 25;
|
|
3105
3230
|
break;
|
|
3106
3231
|
}
|
|
3107
3232
|
bridge === null || bridge === void 0 || (_bridge$onNotify2 = bridge.onNotify) === null || _bridge$onNotify2 === void 0 || _bridge$onNotify2.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
3108
|
-
return
|
|
3233
|
+
return _context43.abrupt("return", {
|
|
3109
3234
|
status: 'failed',
|
|
3110
3235
|
reason: 'not_found'
|
|
3111
3236
|
});
|
|
@@ -3113,73 +3238,73 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3113
3238
|
host = {
|
|
3114
3239
|
setOrderCustomer: function setOrderCustomer(customer) {
|
|
3115
3240
|
beforeScanCommit();
|
|
3116
|
-
|
|
3241
|
+
_this11.setOrderCustomer(customer);
|
|
3117
3242
|
},
|
|
3118
3243
|
getOrderCustomerSnapshot: function getOrderCustomerSnapshot() {
|
|
3119
|
-
return
|
|
3244
|
+
return _this11.getOrderCustomerSnapshot();
|
|
3120
3245
|
},
|
|
3121
3246
|
resolveCustomerById: function resolveCustomerById(customerId) {
|
|
3122
|
-
return
|
|
3247
|
+
return _this11.resolveCustomerById(customerId);
|
|
3123
3248
|
},
|
|
3124
3249
|
getBusinessCode: function getBusinessCode() {
|
|
3125
|
-
var
|
|
3126
|
-
return (
|
|
3250
|
+
var _this11$otherParams;
|
|
3251
|
+
return (_this11$otherParams = _this11.otherParams) === null || _this11$otherParams === void 0 ? void 0 : _this11$otherParams.businessCode;
|
|
3127
3252
|
},
|
|
3128
3253
|
buildAddProductCtx: function buildAddProductCtx(extra) {
|
|
3129
|
-
return
|
|
3254
|
+
return _this11.buildAddProductCtx(extra);
|
|
3130
3255
|
},
|
|
3131
3256
|
decideAddProduct: function decideAddProduct(item, options) {
|
|
3132
|
-
return
|
|
3257
|
+
return _this11.decideAddProduct(item, options);
|
|
3133
3258
|
},
|
|
3134
3259
|
decideAfterDetail: function decideAfterDetail(cacheItem, options) {
|
|
3135
|
-
return
|
|
3260
|
+
return _this11.decideAfterDetail(cacheItem, options);
|
|
3136
3261
|
},
|
|
3137
3262
|
transformDetailToProductAndBooking: function transformDetailToProductAndBooking(input) {
|
|
3138
|
-
return
|
|
3263
|
+
return _this11.transformDetailToProductAndBooking(input);
|
|
3139
3264
|
},
|
|
3140
3265
|
addProductToOrder: function addProductToOrder(product, booking) {
|
|
3141
3266
|
beforeScanCommit();
|
|
3142
|
-
return
|
|
3267
|
+
return _this11.addProductToOrder(product, booking);
|
|
3143
3268
|
},
|
|
3144
3269
|
refreshWalletAssets: function refreshWalletAssets(params) {
|
|
3145
|
-
return
|
|
3270
|
+
return _this11.refreshWalletAssets(params);
|
|
3146
3271
|
},
|
|
3147
3272
|
scanWalletAsset: function scanWalletAsset(scanCode) {
|
|
3148
3273
|
beforeScanCommit();
|
|
3149
|
-
return
|
|
3274
|
+
return _this11.scanWalletAsset(scanCode);
|
|
3150
3275
|
}
|
|
3151
3276
|
};
|
|
3152
3277
|
if (!((guardedBridge === null || guardedBridge === void 0 ? void 0 : guardedBridge.scanScope) === 'product-voucher-collection')) {
|
|
3153
|
-
|
|
3278
|
+
_context43.next = 32;
|
|
3154
3279
|
break;
|
|
3155
3280
|
}
|
|
3156
|
-
|
|
3281
|
+
_context43.next = 29;
|
|
3157
3282
|
return applyProductVoucherCollectionScan(_objectSpread(_objectSpread({}, host), {}, {
|
|
3158
3283
|
loadCustomerDiscounts: function () {
|
|
3159
|
-
var _loadCustomerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3160
|
-
var
|
|
3284
|
+
var _loadCustomerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42() {
|
|
3285
|
+
var _this11$getOrderCusto;
|
|
3161
3286
|
var customerId;
|
|
3162
|
-
return _regeneratorRuntime().wrap(function
|
|
3163
|
-
while (1) switch (
|
|
3287
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
|
3288
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
3164
3289
|
case 0:
|
|
3165
3290
|
beforeScanCommit();
|
|
3166
|
-
customerId = Number(((
|
|
3291
|
+
customerId = Number(((_this11$getOrderCusto = _this11.getOrderCustomer()) === null || _this11$getOrderCusto === void 0 ? void 0 : _this11$getOrderCusto.customer_id) || 0);
|
|
3167
3292
|
if (!(customerId <= 1)) {
|
|
3168
|
-
|
|
3293
|
+
_context42.next = 4;
|
|
3169
3294
|
break;
|
|
3170
3295
|
}
|
|
3171
|
-
return
|
|
3296
|
+
return _context42.abrupt("return", []);
|
|
3172
3297
|
case 4:
|
|
3173
|
-
|
|
3174
|
-
return
|
|
3298
|
+
_context42.next = 6;
|
|
3299
|
+
return _this11.refreshDiscountConfigAfterOrderCustomerChange(customerId);
|
|
3175
3300
|
case 6:
|
|
3176
3301
|
beforeScanCommit();
|
|
3177
|
-
return
|
|
3302
|
+
return _context42.abrupt("return", _this11.getDiscountList());
|
|
3178
3303
|
case 8:
|
|
3179
3304
|
case "end":
|
|
3180
|
-
return
|
|
3305
|
+
return _context42.stop();
|
|
3181
3306
|
}
|
|
3182
|
-
},
|
|
3307
|
+
}, _callee42);
|
|
3183
3308
|
}));
|
|
3184
3309
|
function loadCustomerDiscounts() {
|
|
3185
3310
|
return _loadCustomerDiscounts.apply(this, arguments);
|
|
@@ -3188,49 +3313,49 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3188
3313
|
}()
|
|
3189
3314
|
}), formatted, guardedBridge);
|
|
3190
3315
|
case 29:
|
|
3191
|
-
|
|
3192
|
-
|
|
3316
|
+
_context43.t0 = _context43.sent;
|
|
3317
|
+
_context43.next = 35;
|
|
3193
3318
|
break;
|
|
3194
3319
|
case 32:
|
|
3195
|
-
|
|
3320
|
+
_context43.next = 34;
|
|
3196
3321
|
return applyGlobalScan(host, formatted, guardedBridge);
|
|
3197
3322
|
case 34:
|
|
3198
|
-
|
|
3323
|
+
_context43.t0 = _context43.sent;
|
|
3199
3324
|
case 35:
|
|
3200
|
-
_result8 =
|
|
3325
|
+
_result8 = _context43.t0;
|
|
3201
3326
|
bridge === null || bridge === void 0 || (_bridge$refresh = bridge.refresh) === null || _bridge$refresh === void 0 || _bridge$refresh.call(bridge);
|
|
3202
|
-
return
|
|
3327
|
+
return _context43.abrupt("return", _result8);
|
|
3203
3328
|
case 40:
|
|
3204
|
-
|
|
3205
|
-
|
|
3329
|
+
_context43.prev = 40;
|
|
3330
|
+
_context43.t1 = _context43["catch"](4);
|
|
3206
3331
|
if (!((bridge === null || bridge === void 0 ? void 0 : bridge.scanScope) === 'product-voucher-collection')) {
|
|
3207
|
-
|
|
3332
|
+
_context43.next = 46;
|
|
3208
3333
|
break;
|
|
3209
3334
|
}
|
|
3210
3335
|
if (!(((_bridge$isCurrent = bridge.isCurrent) === null || _bridge$isCurrent === void 0 ? void 0 : _bridge$isCurrent.call(bridge)) === false)) {
|
|
3211
|
-
|
|
3336
|
+
_context43.next = 45;
|
|
3212
3337
|
break;
|
|
3213
3338
|
}
|
|
3214
|
-
return
|
|
3339
|
+
return _context43.abrupt("return", {
|
|
3215
3340
|
status: 'cancelled'
|
|
3216
3341
|
});
|
|
3217
3342
|
case 45:
|
|
3218
|
-
return
|
|
3343
|
+
return _context43.abrupt("return", {
|
|
3219
3344
|
status: 'failed',
|
|
3220
3345
|
reason: 'entry_resolution_failed'
|
|
3221
3346
|
});
|
|
3222
3347
|
case 46:
|
|
3223
|
-
console.error('[BookingTicket] handleGlobalScanCode failed',
|
|
3348
|
+
console.error('[BookingTicket] handleGlobalScanCode failed', _context43.t1);
|
|
3224
3349
|
bridge === null || bridge === void 0 || (_bridge$onNotify3 = bridge.onNotify) === null || _bridge$onNotify3 === void 0 || _bridge$onNotify3.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
3225
|
-
return
|
|
3350
|
+
return _context43.abrupt("return", {
|
|
3226
3351
|
status: 'failed',
|
|
3227
3352
|
reason: 'not_found'
|
|
3228
3353
|
});
|
|
3229
3354
|
case 49:
|
|
3230
3355
|
case "end":
|
|
3231
|
-
return
|
|
3356
|
+
return _context43.stop();
|
|
3232
3357
|
}
|
|
3233
|
-
},
|
|
3358
|
+
}, _callee43, this, [[4, 40]]);
|
|
3234
3359
|
}));
|
|
3235
3360
|
function handleGlobalScanCode(_x23, _x24) {
|
|
3236
3361
|
return _handleGlobalScanCode.apply(this, arguments);
|
|
@@ -3240,37 +3365,37 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3240
3365
|
}, {
|
|
3241
3366
|
key: "getGlobalScanCodeType",
|
|
3242
3367
|
value: (function () {
|
|
3243
|
-
var _getGlobalScanCodeType = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3244
|
-
var
|
|
3368
|
+
var _getGlobalScanCodeType = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(code) {
|
|
3369
|
+
var _this12 = this,
|
|
3245
3370
|
_formatGlobalScanResu,
|
|
3246
3371
|
_formatGlobalScanResu2;
|
|
3247
3372
|
var trimmed, scan, raw;
|
|
3248
|
-
return _regeneratorRuntime().wrap(function
|
|
3249
|
-
while (1) switch (
|
|
3373
|
+
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
3374
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
3250
3375
|
case 0:
|
|
3251
3376
|
trimmed = typeof code === 'string' ? code.trim() : '';
|
|
3252
3377
|
if (trimmed) {
|
|
3253
|
-
|
|
3378
|
+
_context44.next = 3;
|
|
3254
3379
|
break;
|
|
3255
3380
|
}
|
|
3256
|
-
return
|
|
3381
|
+
return _context44.abrupt("return", null);
|
|
3257
3382
|
case 3:
|
|
3258
3383
|
scan = handleGlobalScan(this.request, function (value) {
|
|
3259
|
-
return
|
|
3384
|
+
return _this12.store.products.findProductsByCodeOrBarcode(value);
|
|
3260
3385
|
}, this.getSubmitOrderSalesChannel());
|
|
3261
|
-
|
|
3386
|
+
_context44.next = 6;
|
|
3262
3387
|
return scan({
|
|
3263
3388
|
type: 'nativeScanner',
|
|
3264
3389
|
value: trimmed
|
|
3265
3390
|
});
|
|
3266
3391
|
case 6:
|
|
3267
|
-
raw =
|
|
3268
|
-
return
|
|
3392
|
+
raw = _context44.sent;
|
|
3393
|
+
return _context44.abrupt("return", (_formatGlobalScanResu = (_formatGlobalScanResu2 = formatGlobalScanResult(raw, trimmed)) === null || _formatGlobalScanResu2 === void 0 ? void 0 : _formatGlobalScanResu2.searchType) !== null && _formatGlobalScanResu !== void 0 ? _formatGlobalScanResu : null);
|
|
3269
3394
|
case 8:
|
|
3270
3395
|
case "end":
|
|
3271
|
-
return
|
|
3396
|
+
return _context44.stop();
|
|
3272
3397
|
}
|
|
3273
|
-
},
|
|
3398
|
+
}, _callee44, this);
|
|
3274
3399
|
}));
|
|
3275
3400
|
function getGlobalScanCodeType(_x25) {
|
|
3276
3401
|
return _getGlobalScanCodeType.apply(this, arguments);
|
|
@@ -3292,7 +3417,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3292
3417
|
}, {
|
|
3293
3418
|
key: "buildAddTimeOrderLine",
|
|
3294
3419
|
value: function buildAddTimeOrderLine(input, bookingUid) {
|
|
3295
|
-
var _input$num, _product$id, _product$product_id,
|
|
3420
|
+
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;
|
|
3296
3421
|
var product = input === null || input === void 0 ? void 0 : input.product;
|
|
3297
3422
|
if (!product || _typeof(product) !== 'object') {
|
|
3298
3423
|
throw new Error('[BookingTicket] addAddTimeProductToBooking: product 不能为空');
|
|
@@ -3303,8 +3428,8 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3303
3428
|
var payload = {
|
|
3304
3429
|
id: (_product$id = product.id) !== null && _product$id !== void 0 ? _product$id : product.product_id,
|
|
3305
3430
|
product_id: (_product$product_id = product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : product.id,
|
|
3306
|
-
product_variant_id: (
|
|
3307
|
-
variant_id: (
|
|
3431
|
+
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,
|
|
3432
|
+
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,
|
|
3308
3433
|
quantity: quantity,
|
|
3309
3434
|
num: quantity,
|
|
3310
3435
|
price: price,
|
|
@@ -3313,8 +3438,8 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3313
3438
|
line_total: price,
|
|
3314
3439
|
total: price,
|
|
3315
3440
|
product_sku: product.product_sku,
|
|
3316
|
-
option: (
|
|
3317
|
-
bundle: (
|
|
3441
|
+
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 : [],
|
|
3442
|
+
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 : []
|
|
3318
3443
|
};
|
|
3319
3444
|
var orderLine = this.transformBaseProductToOrderProduct({
|
|
3320
3445
|
payload: payload,
|
|
@@ -3354,11 +3479,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3354
3479
|
}, {
|
|
3355
3480
|
key: "addAddTimeProductToBooking",
|
|
3356
3481
|
value: (function () {
|
|
3357
|
-
var _addAddTimeProductToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3358
|
-
return _regeneratorRuntime().wrap(function
|
|
3359
|
-
while (1) switch (
|
|
3482
|
+
var _addAddTimeProductToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(input) {
|
|
3483
|
+
return _regeneratorRuntime().wrap(function _callee45$(_context45) {
|
|
3484
|
+
while (1) switch (_context45.prev = _context45.next) {
|
|
3360
3485
|
case 0:
|
|
3361
|
-
return
|
|
3486
|
+
return _context45.abrupt("return", this.addAddTimeProductsToBooking({
|
|
3362
3487
|
booking: input.booking,
|
|
3363
3488
|
products: [input],
|
|
3364
3489
|
coveredMinutes: input.coveredMinutes,
|
|
@@ -3366,9 +3491,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3366
3491
|
}));
|
|
3367
3492
|
case 1:
|
|
3368
3493
|
case "end":
|
|
3369
|
-
return
|
|
3494
|
+
return _context45.stop();
|
|
3370
3495
|
}
|
|
3371
|
-
},
|
|
3496
|
+
}, _callee45, this);
|
|
3372
3497
|
}));
|
|
3373
3498
|
function addAddTimeProductToBooking(_x26) {
|
|
3374
3499
|
return _addAddTimeProductToBooking.apply(this, arguments);
|
|
@@ -3388,27 +3513,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3388
3513
|
}, {
|
|
3389
3514
|
key: "addAddTimeProductsToBooking",
|
|
3390
3515
|
value: (function () {
|
|
3391
|
-
var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3392
|
-
var
|
|
3516
|
+
var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(input) {
|
|
3517
|
+
var _this13 = this,
|
|
3393
3518
|
_input$bookingPatch;
|
|
3394
3519
|
var bookingUid, orderLines, coveredMinutes, bookingTimePatch, result, _iterator2, _step2, line;
|
|
3395
|
-
return _regeneratorRuntime().wrap(function
|
|
3396
|
-
while (1) switch (
|
|
3520
|
+
return _regeneratorRuntime().wrap(function _callee46$(_context46) {
|
|
3521
|
+
while (1) switch (_context46.prev = _context46.next) {
|
|
3397
3522
|
case 0:
|
|
3398
3523
|
bookingUid = resolveBookingUidForAddTime(input === null || input === void 0 ? void 0 : input.booking);
|
|
3399
3524
|
if (bookingUid) {
|
|
3400
|
-
|
|
3525
|
+
_context46.next = 3;
|
|
3401
3526
|
break;
|
|
3402
3527
|
}
|
|
3403
3528
|
throw new Error('[BookingTicket] addAddTimeProductToBooking: booking.metadata.unique_identification_number 缺失');
|
|
3404
3529
|
case 3:
|
|
3405
3530
|
orderLines = (input.products || []).map(function (line) {
|
|
3406
3531
|
return {
|
|
3407
|
-
product:
|
|
3532
|
+
product: _this13.buildAddTimeOrderLine(line, bookingUid)
|
|
3408
3533
|
};
|
|
3409
3534
|
});
|
|
3410
3535
|
if (this.store.order) {
|
|
3411
|
-
|
|
3536
|
+
_context46.next = 6;
|
|
3412
3537
|
break;
|
|
3413
3538
|
}
|
|
3414
3539
|
throw new Error('order 模块未初始化');
|
|
@@ -3422,53 +3547,53 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3422
3547
|
});
|
|
3423
3548
|
}
|
|
3424
3549
|
if (!(typeof this.store.order.addProductsToOrder === 'function')) {
|
|
3425
|
-
|
|
3550
|
+
_context46.next = 11;
|
|
3426
3551
|
break;
|
|
3427
3552
|
}
|
|
3428
|
-
return
|
|
3553
|
+
return _context46.abrupt("return", this.store.order.addProductsToOrder(orderLines));
|
|
3429
3554
|
case 11:
|
|
3430
3555
|
result = [];
|
|
3431
3556
|
_iterator2 = _createForOfIteratorHelper(orderLines);
|
|
3432
|
-
|
|
3557
|
+
_context46.prev = 13;
|
|
3433
3558
|
_iterator2.s();
|
|
3434
3559
|
case 15:
|
|
3435
3560
|
if ((_step2 = _iterator2.n()).done) {
|
|
3436
|
-
|
|
3561
|
+
_context46.next = 29;
|
|
3437
3562
|
break;
|
|
3438
3563
|
}
|
|
3439
3564
|
line = _step2.value;
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3565
|
+
_context46.t0 = result.splice;
|
|
3566
|
+
_context46.t1 = result;
|
|
3567
|
+
_context46.t2 = [0, result.length];
|
|
3568
|
+
_context46.t3 = _toConsumableArray;
|
|
3569
|
+
_context46.next = 23;
|
|
3445
3570
|
return this.addProductToOrder(line.product);
|
|
3446
3571
|
case 23:
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3572
|
+
_context46.t4 = _context46.sent;
|
|
3573
|
+
_context46.t5 = (0, _context46.t3)(_context46.t4);
|
|
3574
|
+
_context46.t6 = _context46.t2.concat.call(_context46.t2, _context46.t5);
|
|
3575
|
+
_context46.t0.apply.call(_context46.t0, _context46.t1, _context46.t6);
|
|
3451
3576
|
case 27:
|
|
3452
|
-
|
|
3577
|
+
_context46.next = 15;
|
|
3453
3578
|
break;
|
|
3454
3579
|
case 29:
|
|
3455
|
-
|
|
3580
|
+
_context46.next = 34;
|
|
3456
3581
|
break;
|
|
3457
3582
|
case 31:
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
_iterator2.e(
|
|
3583
|
+
_context46.prev = 31;
|
|
3584
|
+
_context46.t7 = _context46["catch"](13);
|
|
3585
|
+
_iterator2.e(_context46.t7);
|
|
3461
3586
|
case 34:
|
|
3462
|
-
|
|
3587
|
+
_context46.prev = 34;
|
|
3463
3588
|
_iterator2.f();
|
|
3464
|
-
return
|
|
3589
|
+
return _context46.finish(34);
|
|
3465
3590
|
case 37:
|
|
3466
|
-
return
|
|
3591
|
+
return _context46.abrupt("return", result);
|
|
3467
3592
|
case 38:
|
|
3468
3593
|
case "end":
|
|
3469
|
-
return
|
|
3594
|
+
return _context46.stop();
|
|
3470
3595
|
}
|
|
3471
|
-
},
|
|
3596
|
+
}, _callee46, this, [[13, 31, 34, 37]]);
|
|
3472
3597
|
}));
|
|
3473
3598
|
function addAddTimeProductsToBooking(_x27) {
|
|
3474
3599
|
return _addAddTimeProductsToBooking.apply(this, arguments);
|
|
@@ -3478,47 +3603,47 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3478
3603
|
}, {
|
|
3479
3604
|
key: "setOtherParams",
|
|
3480
3605
|
value: function () {
|
|
3481
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3482
|
-
var
|
|
3483
|
-
var
|
|
3484
|
-
|
|
3606
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(params) {
|
|
3607
|
+
var _this14 = this;
|
|
3608
|
+
var _ref22,
|
|
3609
|
+
_ref22$cover,
|
|
3485
3610
|
cover,
|
|
3486
3611
|
nextParams,
|
|
3487
3612
|
invoiceContextChanged,
|
|
3488
|
-
|
|
3489
|
-
return _regeneratorRuntime().wrap(function
|
|
3490
|
-
while (1) switch (
|
|
3613
|
+
_args47 = arguments;
|
|
3614
|
+
return _regeneratorRuntime().wrap(function _callee47$(_context47) {
|
|
3615
|
+
while (1) switch (_context47.prev = _context47.next) {
|
|
3491
3616
|
case 0:
|
|
3492
|
-
|
|
3617
|
+
_ref22 = _args47.length > 1 && _args47[1] !== undefined ? _args47[1] : {}, _ref22$cover = _ref22.cover, cover = _ref22$cover === void 0 ? false : _ref22$cover;
|
|
3493
3618
|
nextParams = cover ? params : _objectSpread(_objectSpread({}, this.otherParams), params);
|
|
3494
3619
|
if (['businessCode', 'business_code', 'channel', 'platform', 'shop_id', 'tenantId', 'cacheId'].some(function (key) {
|
|
3495
|
-
var
|
|
3496
|
-
return (nextParams === null || nextParams === void 0 ? void 0 : nextParams[key]) !== ((
|
|
3620
|
+
var _this14$otherParams;
|
|
3621
|
+
return (nextParams === null || nextParams === void 0 ? void 0 : nextParams[key]) !== ((_this14$otherParams = _this14.otherParams) === null || _this14$otherParams === void 0 ? void 0 : _this14$otherParams[key]);
|
|
3497
3622
|
})) this.orderCustomerContactRequest = null;
|
|
3498
|
-
|
|
3623
|
+
_context47.next = 5;
|
|
3499
3624
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "setOtherParams", this).call(this, params, {
|
|
3500
3625
|
cover: cover
|
|
3501
3626
|
});
|
|
3502
3627
|
case 5:
|
|
3503
3628
|
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');
|
|
3504
3629
|
if (!invoiceContextChanged) {
|
|
3505
|
-
|
|
3630
|
+
_context47.next = 9;
|
|
3506
3631
|
break;
|
|
3507
3632
|
}
|
|
3508
|
-
|
|
3633
|
+
_context47.next = 9;
|
|
3509
3634
|
return this.prepareInvoiceTemplateAtSolutionReady(Object.prototype.hasOwnProperty.call(params, 'openData') ? this.getInjectedOpenDataConfig() : undefined);
|
|
3510
3635
|
case 9:
|
|
3511
3636
|
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'))) {
|
|
3512
|
-
|
|
3637
|
+
_context47.next = 12;
|
|
3513
3638
|
break;
|
|
3514
3639
|
}
|
|
3515
|
-
|
|
3640
|
+
_context47.next = 12;
|
|
3516
3641
|
return this.configureIdGeneratorFromOpenData();
|
|
3517
3642
|
case 12:
|
|
3518
3643
|
case "end":
|
|
3519
|
-
return
|
|
3644
|
+
return _context47.stop();
|
|
3520
3645
|
}
|
|
3521
|
-
},
|
|
3646
|
+
}, _callee47, this);
|
|
3522
3647
|
}));
|
|
3523
3648
|
function setOtherParams(_x28) {
|
|
3524
3649
|
return _setOtherParams.apply(this, arguments);
|
|
@@ -3537,15 +3662,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3537
3662
|
}, {
|
|
3538
3663
|
key: "handlePrintWristband",
|
|
3539
3664
|
value: function () {
|
|
3540
|
-
var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3665
|
+
var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(params) {
|
|
3541
3666
|
var _this$getOrderIdentit2;
|
|
3542
3667
|
var deviceTask, deviceId, idempotencyKey;
|
|
3543
|
-
return _regeneratorRuntime().wrap(function
|
|
3544
|
-
while (1) switch (
|
|
3668
|
+
return _regeneratorRuntime().wrap(function _callee48$(_context48) {
|
|
3669
|
+
while (1) switch (_context48.prev = _context48.next) {
|
|
3545
3670
|
case 0:
|
|
3546
3671
|
deviceTask = this.getDeviceTaskPlugin();
|
|
3547
3672
|
if (deviceTask !== null && deviceTask !== void 0 && deviceTask.dispatch) {
|
|
3548
|
-
|
|
3673
|
+
_context48.next = 4;
|
|
3549
3674
|
break;
|
|
3550
3675
|
}
|
|
3551
3676
|
this.logger.addLog({
|
|
@@ -3555,7 +3680,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3555
3680
|
voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
|
|
3556
3681
|
}
|
|
3557
3682
|
});
|
|
3558
|
-
return
|
|
3683
|
+
return _context48.abrupt("return");
|
|
3559
3684
|
case 4:
|
|
3560
3685
|
this.logger.addLog({
|
|
3561
3686
|
type: 'info',
|
|
@@ -3564,10 +3689,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3564
3689
|
voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
|
|
3565
3690
|
}
|
|
3566
3691
|
});
|
|
3567
|
-
|
|
3692
|
+
_context48.next = 7;
|
|
3568
3693
|
return this.getShortNumberOrDeviceId();
|
|
3569
3694
|
case 7:
|
|
3570
|
-
deviceId =
|
|
3695
|
+
deviceId = _context48.sent;
|
|
3571
3696
|
idempotencyKey = createUuidV4();
|
|
3572
3697
|
deviceTask.dispatch({
|
|
3573
3698
|
action: 'print_all',
|
|
@@ -3590,9 +3715,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3590
3715
|
});
|
|
3591
3716
|
case 10:
|
|
3592
3717
|
case "end":
|
|
3593
|
-
return
|
|
3718
|
+
return _context48.stop();
|
|
3594
3719
|
}
|
|
3595
|
-
},
|
|
3720
|
+
}, _callee48, this);
|
|
3596
3721
|
}));
|
|
3597
3722
|
function handlePrintWristband(_x29) {
|
|
3598
3723
|
return _handlePrintWristband.apply(this, arguments);
|
|
@@ -3615,11 +3740,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3615
3740
|
}, {
|
|
3616
3741
|
key: "handleRedeem",
|
|
3617
3742
|
value: function () {
|
|
3618
|
-
var _handleRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3619
|
-
var _this$store$order8, _this$store$order8$ge, _this$store$order9,
|
|
3743
|
+
var _handleRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(params) {
|
|
3744
|
+
var _this$store$order8, _this$store$order8$ge, _this$store$order9, _ref23, _tempOrder$order_id2;
|
|
3620
3745
|
var voucherIds, status, voucherIdSet, tempOrder, vouchers, hasUpdatedVoucher, nextVouchers, write, identity, externalSaleNumber, orderId, orderLookup;
|
|
3621
|
-
return _regeneratorRuntime().wrap(function
|
|
3622
|
-
while (1) switch (
|
|
3746
|
+
return _regeneratorRuntime().wrap(function _callee49$(_context49) {
|
|
3747
|
+
while (1) switch (_context49.prev = _context49.next) {
|
|
3623
3748
|
case 0:
|
|
3624
3749
|
voucherIds = Array.isArray(params.voucher_ids) ? params.voucher_ids : [];
|
|
3625
3750
|
status = params.is_checkin ? 'used' : 'unused';
|
|
@@ -3643,7 +3768,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3643
3768
|
});
|
|
3644
3769
|
});
|
|
3645
3770
|
if (!(tempOrder && hasUpdatedVoucher)) {
|
|
3646
|
-
|
|
3771
|
+
_context49.next = 17;
|
|
3647
3772
|
break;
|
|
3648
3773
|
}
|
|
3649
3774
|
write = this.replaceTempOrder(_objectSpread(_objectSpread({}, tempOrder), {}, {
|
|
@@ -3652,20 +3777,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3652
3777
|
preserveOrderSessionId: this.getOrderSessionId() || undefined
|
|
3653
3778
|
});
|
|
3654
3779
|
this.redeemStatusWrite = write;
|
|
3655
|
-
|
|
3656
|
-
|
|
3780
|
+
_context49.prev = 11;
|
|
3781
|
+
_context49.next = 14;
|
|
3657
3782
|
return write;
|
|
3658
3783
|
case 14:
|
|
3659
|
-
|
|
3784
|
+
_context49.prev = 14;
|
|
3660
3785
|
if (this.redeemStatusWrite === write) this.redeemStatusWrite = undefined;
|
|
3661
|
-
return
|
|
3786
|
+
return _context49.finish(14);
|
|
3662
3787
|
case 17:
|
|
3663
3788
|
this.core.effects.emit("".concat(this.name, ":onVouchersChange"), {});
|
|
3664
3789
|
if (!(voucherIds.length === 0)) {
|
|
3665
|
-
|
|
3790
|
+
_context49.next = 20;
|
|
3666
3791
|
break;
|
|
3667
3792
|
}
|
|
3668
|
-
return
|
|
3793
|
+
return _context49.abrupt("return", {
|
|
3669
3794
|
code: 200,
|
|
3670
3795
|
status: true,
|
|
3671
3796
|
message: '',
|
|
@@ -3674,9 +3799,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3674
3799
|
case 20:
|
|
3675
3800
|
identity = this.getOrderIdentity();
|
|
3676
3801
|
externalSaleNumber = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.external_sale_number) || (identity === null || identity === void 0 ? void 0 : identity.externalSaleNumber) || undefined;
|
|
3677
|
-
orderId = (
|
|
3802
|
+
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;
|
|
3678
3803
|
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;
|
|
3679
|
-
return
|
|
3804
|
+
return _context49.abrupt("return", this.request.post('/machinecode/batch', {
|
|
3680
3805
|
ids: voucherIds,
|
|
3681
3806
|
status: status,
|
|
3682
3807
|
order_lookup: orderLookup,
|
|
@@ -3687,9 +3812,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3687
3812
|
}));
|
|
3688
3813
|
case 25:
|
|
3689
3814
|
case "end":
|
|
3690
|
-
return
|
|
3815
|
+
return _context49.stop();
|
|
3691
3816
|
}
|
|
3692
|
-
},
|
|
3817
|
+
}, _callee49, this, [[11,, 14, 17]]);
|
|
3693
3818
|
}));
|
|
3694
3819
|
function handleRedeem(_x30) {
|
|
3695
3820
|
return _handleRedeem.apply(this, arguments);
|
|
@@ -3699,25 +3824,25 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3699
3824
|
}, {
|
|
3700
3825
|
key: "updateTicketArrival",
|
|
3701
3826
|
value: function () {
|
|
3702
|
-
var _updateTicketArrival = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3827
|
+
var _updateTicketArrival = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(voucherIds) {
|
|
3703
3828
|
var _this$store$order10,
|
|
3704
3829
|
_this$store$order10$g,
|
|
3705
|
-
|
|
3830
|
+
_this15 = this;
|
|
3706
3831
|
var window, tempOrder, log, operation, arrivalTime, session, updateArrival, completion;
|
|
3707
|
-
return _regeneratorRuntime().wrap(function
|
|
3708
|
-
while (1) switch (
|
|
3832
|
+
return _regeneratorRuntime().wrap(function _callee51$(_context51) {
|
|
3833
|
+
while (1) switch (_context51.prev = _context51.next) {
|
|
3709
3834
|
case 0:
|
|
3710
3835
|
window = this.getRedeemArrivalWindow();
|
|
3711
3836
|
tempOrder = (_this$store$order10 = this.store.order) === null || _this$store$order10 === void 0 || (_this$store$order10$g = _this$store$order10.getTempOrder) === null || _this$store$order10$g === void 0 ? void 0 : _this$store$order10$g.call(_this$store$order10);
|
|
3712
3837
|
log = createArrivalLogger(this.logger, tempOrder, voucherIds);
|
|
3713
3838
|
if (!(!window || !tempOrder)) {
|
|
3714
|
-
|
|
3839
|
+
_context51.next = 6;
|
|
3715
3840
|
break;
|
|
3716
3841
|
}
|
|
3717
3842
|
log('skipped', {
|
|
3718
3843
|
reason: !window ? 'no_effective_window' : 'missing_order'
|
|
3719
3844
|
});
|
|
3720
|
-
return
|
|
3845
|
+
return _context51.abrupt("return");
|
|
3721
3846
|
case 6:
|
|
3722
3847
|
log('started', {
|
|
3723
3848
|
early_minutes: window.earlyMinutes,
|
|
@@ -3727,24 +3852,24 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3727
3852
|
arrivalTime = new Date();
|
|
3728
3853
|
session = this.getOrderSessionId();
|
|
3729
3854
|
updateArrival = /*#__PURE__*/function () {
|
|
3730
|
-
var
|
|
3731
|
-
var
|
|
3855
|
+
var _ref24 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50() {
|
|
3856
|
+
var _this15$store$order, _this15$store$order$g, _next$summary;
|
|
3732
3857
|
var current, sameOrder, order, arrival, next, query, checkout, latest, patch, voucherTimes;
|
|
3733
|
-
return _regeneratorRuntime().wrap(function
|
|
3734
|
-
while (1) switch (
|
|
3858
|
+
return _regeneratorRuntime().wrap(function _callee50$(_context50) {
|
|
3859
|
+
while (1) switch (_context50.prev = _context50.next) {
|
|
3735
3860
|
case 0:
|
|
3736
|
-
if (!
|
|
3737
|
-
|
|
3861
|
+
if (!_this15.redeemStatusWrite) {
|
|
3862
|
+
_context50.next = 3;
|
|
3738
3863
|
break;
|
|
3739
3864
|
}
|
|
3740
|
-
|
|
3741
|
-
return
|
|
3865
|
+
_context50.next = 3;
|
|
3866
|
+
return _this15.redeemStatusWrite.catch(function () {});
|
|
3742
3867
|
case 3:
|
|
3743
|
-
current = (
|
|
3868
|
+
current = (_this15$store$order = _this15.store.order) === null || _this15$store$order === void 0 || (_this15$store$order$g = _this15$store$order.getTempOrder) === null || _this15$store$order$g === void 0 ? void 0 : _this15$store$order$g.call(_this15$store$order);
|
|
3744
3869
|
sameOrder = function sameOrder() {
|
|
3745
|
-
var
|
|
3746
|
-
var active = (
|
|
3747
|
-
return active && (session == null ||
|
|
3870
|
+
var _this15$store$order2, _this15$store$order2$;
|
|
3871
|
+
var active = (_this15$store$order2 = _this15.store.order) === null || _this15$store$order2 === void 0 || (_this15$store$order2$ = _this15$store$order2.getTempOrder) === null || _this15$store$order2$ === void 0 ? void 0 : _this15$store$order2$.call(_this15$store$order2);
|
|
3872
|
+
return active && (session == null || _this15.getOrderSessionId() === session) && active.order_id === tempOrder.order_id && active.external_sale_number === tempOrder.external_sale_number;
|
|
3748
3873
|
};
|
|
3749
3874
|
order = current && sameOrder() ? current : tempOrder;
|
|
3750
3875
|
arrival = applyRedeemArrival(order, new Set(voucherIds.map(String)), arrivalTime, window, function (reason) {
|
|
@@ -3753,51 +3878,51 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3753
3878
|
});
|
|
3754
3879
|
});
|
|
3755
3880
|
if (arrival) {
|
|
3756
|
-
|
|
3881
|
+
_context50.next = 9;
|
|
3757
3882
|
break;
|
|
3758
3883
|
}
|
|
3759
|
-
return
|
|
3884
|
+
return _context50.abrupt("return");
|
|
3760
3885
|
case 9:
|
|
3761
3886
|
next = _objectSpread(_objectSpread({}, order), arrival);
|
|
3762
|
-
|
|
3763
|
-
|
|
3887
|
+
_context50.t0 = buildArrivalCheckoutQuery;
|
|
3888
|
+
_context50.t1 = next;
|
|
3764
3889
|
if (!((_next$summary = next.summary) !== null && _next$summary !== void 0)) {
|
|
3765
|
-
|
|
3890
|
+
_context50.next = 16;
|
|
3766
3891
|
break;
|
|
3767
3892
|
}
|
|
3768
|
-
|
|
3769
|
-
|
|
3893
|
+
_context50.t2 = _next$summary;
|
|
3894
|
+
_context50.next = 24;
|
|
3770
3895
|
break;
|
|
3771
3896
|
case 16:
|
|
3772
3897
|
if (!sameOrder()) {
|
|
3773
|
-
|
|
3898
|
+
_context50.next = 22;
|
|
3774
3899
|
break;
|
|
3775
3900
|
}
|
|
3776
|
-
|
|
3777
|
-
return
|
|
3901
|
+
_context50.next = 19;
|
|
3902
|
+
return _this15.getSummary();
|
|
3778
3903
|
case 19:
|
|
3779
|
-
|
|
3780
|
-
|
|
3904
|
+
_context50.t3 = _context50.sent;
|
|
3905
|
+
_context50.next = 23;
|
|
3781
3906
|
break;
|
|
3782
3907
|
case 22:
|
|
3783
|
-
|
|
3908
|
+
_context50.t3 = undefined;
|
|
3784
3909
|
case 23:
|
|
3785
|
-
|
|
3910
|
+
_context50.t2 = _context50.t3;
|
|
3786
3911
|
case 24:
|
|
3787
|
-
|
|
3788
|
-
query = (0,
|
|
3912
|
+
_context50.t4 = _context50.t2;
|
|
3913
|
+
query = (0, _context50.t0)(_context50.t1, _context50.t4);
|
|
3789
3914
|
operation = 'checkout';
|
|
3790
3915
|
log('checkout_requested', {
|
|
3791
3916
|
bookings: describeChangedBookings(order.bookings, arrival.bookings)
|
|
3792
3917
|
});
|
|
3793
|
-
|
|
3794
|
-
return
|
|
3918
|
+
_context50.next = 30;
|
|
3919
|
+
return _this15.store.order.submitSalesOrder({
|
|
3795
3920
|
query: query
|
|
3796
3921
|
});
|
|
3797
3922
|
case 30:
|
|
3798
|
-
checkout =
|
|
3923
|
+
checkout = _context50.sent;
|
|
3799
3924
|
if (!((checkout === null || checkout === void 0 ? void 0 : checkout.status) === false || (checkout === null || checkout === void 0 ? void 0 : checkout.code) != null && checkout.code !== 200)) {
|
|
3800
|
-
|
|
3925
|
+
_context50.next = 34;
|
|
3801
3926
|
break;
|
|
3802
3927
|
}
|
|
3803
3928
|
log('checkout_rejected', {
|
|
@@ -3805,44 +3930,44 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3805
3930
|
status: checkout.status,
|
|
3806
3931
|
message: checkout.message
|
|
3807
3932
|
}, true);
|
|
3808
|
-
return
|
|
3933
|
+
return _context50.abrupt("return", checkout);
|
|
3809
3934
|
case 34:
|
|
3810
3935
|
log('checkout_accepted', {
|
|
3811
3936
|
code: checkout === null || checkout === void 0 ? void 0 : checkout.code
|
|
3812
3937
|
});
|
|
3813
3938
|
operation = 'local_update';
|
|
3814
|
-
if (!
|
|
3815
|
-
|
|
3939
|
+
if (!_this15.redeemStatusWrite) {
|
|
3940
|
+
_context50.next = 39;
|
|
3816
3941
|
break;
|
|
3817
3942
|
}
|
|
3818
|
-
|
|
3819
|
-
return
|
|
3943
|
+
_context50.next = 39;
|
|
3944
|
+
return _this15.redeemStatusWrite.catch(function () {});
|
|
3820
3945
|
case 39:
|
|
3821
3946
|
if (!sameOrder()) {
|
|
3822
|
-
|
|
3947
|
+
_context50.next = 52;
|
|
3823
3948
|
break;
|
|
3824
3949
|
}
|
|
3825
|
-
latest =
|
|
3950
|
+
latest = _this15.store.order.getTempOrder();
|
|
3826
3951
|
patch = applyRedeemArrival(latest, new Set(voucherIds.map(String)), arrivalTime, window);
|
|
3827
3952
|
if (!patch) {
|
|
3828
|
-
|
|
3953
|
+
_context50.next = 49;
|
|
3829
3954
|
break;
|
|
3830
3955
|
}
|
|
3831
|
-
|
|
3832
|
-
return
|
|
3833
|
-
preserveOrderSessionId:
|
|
3956
|
+
_context50.next = 45;
|
|
3957
|
+
return _this15.replaceTempOrder(_objectSpread(_objectSpread({}, latest), patch), {
|
|
3958
|
+
preserveOrderSessionId: _this15.getOrderSessionId() || undefined
|
|
3834
3959
|
});
|
|
3835
3960
|
case 45:
|
|
3836
3961
|
log('local_updated');
|
|
3837
|
-
|
|
3838
|
-
|
|
3962
|
+
_this15.core.effects.emit("".concat(_this15.name, ":onVouchersChange"), {});
|
|
3963
|
+
_context50.next = 50;
|
|
3839
3964
|
break;
|
|
3840
3965
|
case 49:
|
|
3841
3966
|
log('local_skipped', {
|
|
3842
3967
|
reason: 'no_pending_change'
|
|
3843
3968
|
});
|
|
3844
3969
|
case 50:
|
|
3845
|
-
|
|
3970
|
+
_context50.next = 53;
|
|
3846
3971
|
break;
|
|
3847
3972
|
case 52:
|
|
3848
3973
|
log('local_skipped', {
|
|
@@ -3859,17 +3984,17 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3859
3984
|
};
|
|
3860
3985
|
}
|
|
3861
3986
|
});
|
|
3862
|
-
return
|
|
3987
|
+
return _context50.abrupt("return", Object.keys(voucherTimes).length ? _objectSpread(_objectSpread({}, checkout), {}, {
|
|
3863
3988
|
voucher_times: voucherTimes
|
|
3864
3989
|
}) : checkout);
|
|
3865
3990
|
case 56:
|
|
3866
3991
|
case "end":
|
|
3867
|
-
return
|
|
3992
|
+
return _context50.stop();
|
|
3868
3993
|
}
|
|
3869
|
-
},
|
|
3994
|
+
}, _callee50);
|
|
3870
3995
|
}));
|
|
3871
3996
|
return function updateArrival() {
|
|
3872
|
-
return
|
|
3997
|
+
return _ref24.apply(this, arguments);
|
|
3873
3998
|
};
|
|
3874
3999
|
}();
|
|
3875
4000
|
completion = this.arrivalQueue.then(updateArrival).catch(function (error) {
|
|
@@ -3880,12 +4005,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3880
4005
|
throw error;
|
|
3881
4006
|
});
|
|
3882
4007
|
this.arrivalQueue = completion.then(function () {}, function () {});
|
|
3883
|
-
return
|
|
4008
|
+
return _context51.abrupt("return", completion);
|
|
3884
4009
|
case 14:
|
|
3885
4010
|
case "end":
|
|
3886
|
-
return
|
|
4011
|
+
return _context51.stop();
|
|
3887
4012
|
}
|
|
3888
|
-
},
|
|
4013
|
+
}, _callee51, this);
|
|
3889
4014
|
}));
|
|
3890
4015
|
function updateTicketArrival(_x31) {
|
|
3891
4016
|
return _updateTicketArrival.apply(this, arguments);
|
|
@@ -3899,13 +4024,13 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3899
4024
|
}, {
|
|
3900
4025
|
key: "destroy",
|
|
3901
4026
|
value: (function () {
|
|
3902
|
-
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4027
|
+
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52() {
|
|
3903
4028
|
var _this$scan;
|
|
3904
|
-
return _regeneratorRuntime().wrap(function
|
|
3905
|
-
while (1) switch (
|
|
4029
|
+
return _regeneratorRuntime().wrap(function _callee52$(_context52) {
|
|
4030
|
+
while (1) switch (_context52.prev = _context52.next) {
|
|
3906
4031
|
case 0:
|
|
3907
4032
|
this.orderCustomerContactRequest = null;
|
|
3908
|
-
|
|
4033
|
+
_context52.next = 3;
|
|
3909
4034
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "destroy", this).call(this);
|
|
3910
4035
|
case 3:
|
|
3911
4036
|
try {
|
|
@@ -3916,9 +4041,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3916
4041
|
scanCache.clear();
|
|
3917
4042
|
case 5:
|
|
3918
4043
|
case "end":
|
|
3919
|
-
return
|
|
4044
|
+
return _context52.stop();
|
|
3920
4045
|
}
|
|
3921
|
-
},
|
|
4046
|
+
}, _callee52, this);
|
|
3922
4047
|
}));
|
|
3923
4048
|
function destroy() {
|
|
3924
4049
|
return _destroy.apply(this, arguments);
|