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