@pisell/pisellos 2.2.326 → 2.2.328
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/dataVariant/evaluator.d.ts +2 -1
- package/dist/model/strategy/adapter/dataVariant/evaluator.js +60 -15
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/modules/OpenData/index.d.ts +8 -1
- package/dist/modules/OpenData/index.js +276 -95
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/server/index.d.ts +3 -0
- package/dist/server/index.js +857 -598
- package/dist/server/modules/order/index.d.ts +1 -0
- package/dist/server/modules/order/index.js +51 -51
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/Sales/index.d.ts +2 -5
- package/dist/solution/Sales/index.js +117 -143
- package/dist/solution/Sales/types.d.ts +6 -0
- package/dist/solution/Sales/types.js +2 -0
- package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +2 -1
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +40 -6
- package/lib/modules/OpenData/index.d.ts +8 -1
- package/lib/modules/OpenData/index.js +123 -21
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/server/index.d.ts +3 -0
- package/lib/server/index.js +155 -18
- package/lib/server/modules/order/index.d.ts +1 -0
- package/lib/server/modules/order/index.js +4 -3
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/Sales/index.d.ts +2 -5
- package/lib/solution/Sales/index.js +32 -66
- package/lib/solution/Sales/types.d.ts +6 -0
- package/lib/solution/Sales/types.js +1 -0
- package/package.json +1 -1
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1
3
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
2
4
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
3
5
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
@@ -15,6 +17,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
15
17
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
16
18
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
17
19
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
20
|
+
import { cloneDeep } from 'lodash-es';
|
|
18
21
|
import { BaseModule } from "../BaseModule";
|
|
19
22
|
import { computeAvailability, getDefaultInvoiceTemplateSettings, normalizeInvoiceLayoutFromTemplateSettings, normalizeInvoiceTemplateSettings, normalizeRawInvoiceTemplateSettings } from "./utils";
|
|
20
23
|
export * from "./types";
|
|
@@ -40,6 +43,7 @@ function isLegacyInvoiceTemplate(value) {
|
|
|
40
43
|
var numericLike = /^[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?$/i;
|
|
41
44
|
return !numericLike.test(normalized);
|
|
42
45
|
}
|
|
46
|
+
var INVOICE_OPEN_DATA_CACHE_TTL = 5 * 60 * 1000;
|
|
43
47
|
export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
|
|
44
48
|
_inherits(OpenDataModule, _BaseModule);
|
|
45
49
|
var _super = _createSuper(OpenDataModule);
|
|
@@ -59,6 +63,8 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
59
63
|
_defineProperty(_assertThisInitialized(_this), "otherParams", {});
|
|
60
64
|
_defineProperty(_assertThisInitialized(_this), "fetchRevision", 0);
|
|
61
65
|
_defineProperty(_assertThisInitialized(_this), "invoiceTemplateCacheRevision", 0);
|
|
66
|
+
_defineProperty(_assertThisInitialized(_this), "printInvoiceTemplates", new Map());
|
|
67
|
+
_defineProperty(_assertThisInitialized(_this), "lastManualPrintKey", void 0);
|
|
62
68
|
_defineProperty(_assertThisInitialized(_this), "invoiceTemplateDocumentCache", new Map());
|
|
63
69
|
_defineProperty(_assertThisInitialized(_this), "invoiceTemplateDocumentInFlight", new Map());
|
|
64
70
|
return _this;
|
|
@@ -141,46 +147,25 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
141
147
|
key: "fetchOpenData",
|
|
142
148
|
value: function () {
|
|
143
149
|
var _fetchOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
|
|
144
|
-
var
|
|
145
|
-
var fetchRevision, getData, shopId, tenantId, headers, response, data, resolvedInvoiceTemplate;
|
|
150
|
+
var fetchRevision, response, data, resolvedInvoiceTemplate;
|
|
146
151
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
147
152
|
while (1) switch (_context2.prev = _context2.next) {
|
|
148
153
|
case 0:
|
|
149
154
|
fetchRevision = ++this.fetchRevision;
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
_context2.next = 5;
|
|
154
|
-
break;
|
|
155
|
-
}
|
|
156
|
-
throw new Error('[OpenDataModule] 无法获取 shop_id');
|
|
157
|
-
case 5:
|
|
158
|
-
tenantId = getData === null || getData === void 0 ? void 0 : getData('tenant_id');
|
|
159
|
-
headers = {};
|
|
160
|
-
if (tenantId) headers['Tenant-Id'] = String(tenantId);
|
|
161
|
-
_context2.next = 10;
|
|
162
|
-
return this.request.post("/open/my-pisell/".concat(shopId, "/setting"), {
|
|
163
|
-
scope: params.scope,
|
|
164
|
-
target: params.target,
|
|
165
|
-
section_code: params.section_code
|
|
166
|
-
}, {
|
|
167
|
-
pisell2: true,
|
|
168
|
-
isPisell2: true,
|
|
169
|
-
prefix: false,
|
|
170
|
-
headers: headers
|
|
171
|
-
});
|
|
172
|
-
case 10:
|
|
155
|
+
_context2.next = 3;
|
|
156
|
+
return this.requestOpenData(params);
|
|
157
|
+
case 3:
|
|
173
158
|
response = _context2.sent;
|
|
174
159
|
if (!((response === null || response === void 0 ? void 0 : response.status) === false)) {
|
|
175
|
-
_context2.next =
|
|
160
|
+
_context2.next = 6;
|
|
176
161
|
break;
|
|
177
162
|
}
|
|
178
163
|
throw new Error((response === null || response === void 0 ? void 0 : response.message) || '获取 OpenData 配置失败');
|
|
179
|
-
case
|
|
164
|
+
case 6:
|
|
180
165
|
data = (response === null || response === void 0 ? void 0 : response.data) || {};
|
|
181
|
-
_context2.next =
|
|
166
|
+
_context2.next = 9;
|
|
182
167
|
return this.resolveInvoiceTemplateSettings(data, params.target);
|
|
183
|
-
case
|
|
168
|
+
case 9:
|
|
184
169
|
resolvedInvoiceTemplate = _context2.sent;
|
|
185
170
|
// clearCache() 或后续请求发生后,旧响应不得复活已失效的 target 配置。
|
|
186
171
|
if (fetchRevision === this.fetchRevision) {
|
|
@@ -189,7 +174,7 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
189
174
|
this.commitInvoiceTemplateSettings(params.target, resolvedInvoiceTemplate);
|
|
190
175
|
}
|
|
191
176
|
return _context2.abrupt("return", data);
|
|
192
|
-
case
|
|
177
|
+
case 12:
|
|
193
178
|
case "end":
|
|
194
179
|
return _context2.stop();
|
|
195
180
|
}
|
|
@@ -200,6 +185,187 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
200
185
|
}
|
|
201
186
|
return fetchOpenData;
|
|
202
187
|
}()
|
|
188
|
+
}, {
|
|
189
|
+
key: "requestOpenData",
|
|
190
|
+
value: function requestOpenData(params) {
|
|
191
|
+
var _this$appPlugin, _this$appPlugin$getDa;
|
|
192
|
+
var background = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
193
|
+
var getData = (_this$appPlugin = this.appPlugin) === null || _this$appPlugin === void 0 || (_this$appPlugin$getDa = _this$appPlugin.getData) === null || _this$appPlugin$getDa === void 0 ? void 0 : _this$appPlugin$getDa.call(_this$appPlugin);
|
|
194
|
+
var shopId = getData === null || getData === void 0 ? void 0 : getData('shop_id');
|
|
195
|
+
var tenantId = getData === null || getData === void 0 ? void 0 : getData('tenant_id');
|
|
196
|
+
if (!shopId) throw new Error('[OpenDataModule] 无法获取 shop_id');
|
|
197
|
+
return this.request.post("/open/my-pisell/".concat(encodeURIComponent(String(shopId)), "/setting"), {
|
|
198
|
+
scope: params.scope,
|
|
199
|
+
target: params.target,
|
|
200
|
+
section_code: params.section_code
|
|
201
|
+
}, _objectSpread({
|
|
202
|
+
pisell2: true,
|
|
203
|
+
isPisell2: true,
|
|
204
|
+
prefix: false,
|
|
205
|
+
headers: tenantId ? {
|
|
206
|
+
'Tenant-Id': String(tenantId)
|
|
207
|
+
} : {}
|
|
208
|
+
}, background ? {
|
|
209
|
+
customToast: function customToast() {},
|
|
210
|
+
manualErrorHandling: true,
|
|
211
|
+
skipErrorHandler: true
|
|
212
|
+
} : {}));
|
|
213
|
+
}
|
|
214
|
+
}, {
|
|
215
|
+
key: "loadCloudInvoiceTemplate",
|
|
216
|
+
value: function loadCloudInvoiceTemplate(target) {
|
|
217
|
+
return this.loadPrintInvoiceTemplate(target, 'cloud');
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/** 手动和云单打印共用已成功解析的模板及进行中的请求。每个订单仍单独派单。 */
|
|
221
|
+
}, {
|
|
222
|
+
key: "loadPrintInvoiceTemplate",
|
|
223
|
+
value: (function () {
|
|
224
|
+
var _loadPrintInvoiceTemplate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(target, mode) {
|
|
225
|
+
var _this2 = this,
|
|
226
|
+
_entry;
|
|
227
|
+
var skipDocument, key, revision, assertCurrent, manualSwitch, entry, refresh, next, result;
|
|
228
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
229
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
230
|
+
case 0:
|
|
231
|
+
skipDocument = mode === 'manual' && this.shouldSkipInvoiceTemplateDocument();
|
|
232
|
+
key = this.buildInvoiceCacheKey(target, skipDocument);
|
|
233
|
+
revision = this.invoiceTemplateCacheRevision;
|
|
234
|
+
assertCurrent = function assertCurrent() {
|
|
235
|
+
if (revision !== _this2.invoiceTemplateCacheRevision || key !== _this2.buildInvoiceCacheKey(target, skipDocument)) {
|
|
236
|
+
throw new Error('Invoice 配置已失效');
|
|
237
|
+
}
|
|
238
|
+
}; // 手动切换打印入口时沿用原有行为,重新读取该入口的 Documents 选择。
|
|
239
|
+
manualSwitch = mode === 'manual' && this.lastManualPrintKey !== undefined && this.lastManualPrintKey !== key;
|
|
240
|
+
if (mode === 'manual') this.lastManualPrintKey = key;
|
|
241
|
+
entry = this.printInvoiceTemplates.get(key);
|
|
242
|
+
refresh = ((_entry = entry) === null || _entry === void 0 ? void 0 : _entry.expiresAt) !== undefined && (Date.now() >= entry.expiresAt || manualSwitch || mode === 'cloud' && entry.manualFallback);
|
|
243
|
+
if (!entry || refresh) {
|
|
244
|
+
next = {
|
|
245
|
+
manualFallback: false,
|
|
246
|
+
request: this.fetchPrintInvoiceTemplate(target, skipDocument, assertCurrent).then(function (result) {
|
|
247
|
+
assertCurrent();
|
|
248
|
+
next.expiresAt = Date.now() + INVOICE_OPEN_DATA_CACHE_TTL;
|
|
249
|
+
// 只有手动打印可复用文档读取失败后的 DEFAULT 回退。
|
|
250
|
+
if ('documentError' in result) {
|
|
251
|
+
if (mode === 'cloud') throw result.documentError;
|
|
252
|
+
next.manualFallback = true;
|
|
253
|
+
next.request = Promise.resolve({
|
|
254
|
+
settings: getDefaultInvoiceTemplateSettings()
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
return result;
|
|
258
|
+
}).catch(function (error) {
|
|
259
|
+
if (_this2.printInvoiceTemplates.get(key) === next) _this2.printInvoiceTemplates.delete(key);
|
|
260
|
+
throw error;
|
|
261
|
+
})
|
|
262
|
+
};
|
|
263
|
+
this.printInvoiceTemplates.set(key, next);
|
|
264
|
+
entry = next;
|
|
265
|
+
}
|
|
266
|
+
_context3.next = 11;
|
|
267
|
+
return entry.request;
|
|
268
|
+
case 11:
|
|
269
|
+
result = _context3.sent;
|
|
270
|
+
assertCurrent();
|
|
271
|
+
if (!('documentError' in result)) {
|
|
272
|
+
_context3.next = 15;
|
|
273
|
+
break;
|
|
274
|
+
}
|
|
275
|
+
throw result.documentError;
|
|
276
|
+
case 15:
|
|
277
|
+
return _context3.abrupt("return", cloneDeep(result.settings));
|
|
278
|
+
case 16:
|
|
279
|
+
case "end":
|
|
280
|
+
return _context3.stop();
|
|
281
|
+
}
|
|
282
|
+
}, _callee3, this);
|
|
283
|
+
}));
|
|
284
|
+
function loadPrintInvoiceTemplate(_x4, _x5) {
|
|
285
|
+
return _loadPrintInvoiceTemplate.apply(this, arguments);
|
|
286
|
+
}
|
|
287
|
+
return loadPrintInvoiceTemplate;
|
|
288
|
+
}())
|
|
289
|
+
}, {
|
|
290
|
+
key: "fetchPrintInvoiceTemplate",
|
|
291
|
+
value: function () {
|
|
292
|
+
var _fetchPrintInvoiceTemplate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(target, skipDocument, assertCurrent) {
|
|
293
|
+
var response, raw, documentId;
|
|
294
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
295
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
296
|
+
case 0:
|
|
297
|
+
_context4.next = 2;
|
|
298
|
+
return this.requestOpenData({
|
|
299
|
+
scope: 'board',
|
|
300
|
+
target: target,
|
|
301
|
+
section_code: ['documents']
|
|
302
|
+
}, true);
|
|
303
|
+
case 2:
|
|
304
|
+
response = _context4.sent;
|
|
305
|
+
assertCurrent();
|
|
306
|
+
if (!((response === null || response === void 0 ? void 0 : response.status) !== true || response.code !== 200 || !isRecord(response.data))) {
|
|
307
|
+
_context4.next = 6;
|
|
308
|
+
break;
|
|
309
|
+
}
|
|
310
|
+
throw new Error((response === null || response === void 0 ? void 0 : response.message) || 'Cloud Invoice settings unavailable');
|
|
311
|
+
case 6:
|
|
312
|
+
if (!skipDocument) {
|
|
313
|
+
_context4.next = 8;
|
|
314
|
+
break;
|
|
315
|
+
}
|
|
316
|
+
return _context4.abrupt("return", {
|
|
317
|
+
settings: getDefaultInvoiceTemplateSettings()
|
|
318
|
+
});
|
|
319
|
+
case 8:
|
|
320
|
+
raw = response.data['documents.invoice_template'];
|
|
321
|
+
documentId = resolveInvoiceDocumentId(raw);
|
|
322
|
+
if (!documentId) {
|
|
323
|
+
_context4.next = 21;
|
|
324
|
+
break;
|
|
325
|
+
}
|
|
326
|
+
_context4.prev = 11;
|
|
327
|
+
_context4.next = 14;
|
|
328
|
+
return this.fetchInvoiceTemplateDocument(documentId, true);
|
|
329
|
+
case 14:
|
|
330
|
+
_context4.t0 = _context4.sent;
|
|
331
|
+
return _context4.abrupt("return", {
|
|
332
|
+
settings: _context4.t0
|
|
333
|
+
});
|
|
334
|
+
case 18:
|
|
335
|
+
_context4.prev = 18;
|
|
336
|
+
_context4.t1 = _context4["catch"](11);
|
|
337
|
+
return _context4.abrupt("return", {
|
|
338
|
+
documentError: _context4.t1
|
|
339
|
+
});
|
|
340
|
+
case 21:
|
|
341
|
+
if (!(raw == null || typeof raw === 'string' && !raw.trim())) {
|
|
342
|
+
_context4.next = 23;
|
|
343
|
+
break;
|
|
344
|
+
}
|
|
345
|
+
return _context4.abrupt("return", {
|
|
346
|
+
settings: getDefaultInvoiceTemplateSettings()
|
|
347
|
+
});
|
|
348
|
+
case 23:
|
|
349
|
+
if (!isLegacyInvoiceTemplate(raw)) {
|
|
350
|
+
_context4.next = 25;
|
|
351
|
+
break;
|
|
352
|
+
}
|
|
353
|
+
return _context4.abrupt("return", {
|
|
354
|
+
settings: normalizeInvoiceTemplateSettings(response.data)
|
|
355
|
+
});
|
|
356
|
+
case 25:
|
|
357
|
+
throw new Error('Cloud Invoice template identifier is invalid');
|
|
358
|
+
case 26:
|
|
359
|
+
case "end":
|
|
360
|
+
return _context4.stop();
|
|
361
|
+
}
|
|
362
|
+
}, _callee4, this, [[11, 18]]);
|
|
363
|
+
}));
|
|
364
|
+
function fetchPrintInvoiceTemplate(_x6, _x7, _x8) {
|
|
365
|
+
return _fetchPrintInvoiceTemplate.apply(this, arguments);
|
|
366
|
+
}
|
|
367
|
+
return fetchPrintInvoiceTemplate;
|
|
368
|
+
}()
|
|
203
369
|
}, {
|
|
204
370
|
key: "getOpenData",
|
|
205
371
|
value: function getOpenData() {
|
|
@@ -222,7 +388,7 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
222
388
|
var documentId = resolveInvoiceDocumentId((_this$store$data = this.store.data) === null || _this$store$data === void 0 ? void 0 : _this$store$data['documents.invoice_template']);
|
|
223
389
|
if (documentId) {
|
|
224
390
|
var target = this.store.invoiceTemplateTarget;
|
|
225
|
-
if (!target || this.store.invoiceTemplateCacheKey !== this.
|
|
391
|
+
if (!target || this.store.invoiceTemplateCacheKey !== this.buildInvoiceCacheKey(target, documentId)) {
|
|
226
392
|
return getDefaultInvoiceTemplateSettings();
|
|
227
393
|
}
|
|
228
394
|
}
|
|
@@ -236,10 +402,10 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
236
402
|
}, {
|
|
237
403
|
key: "ensureInvoiceTemplateSettings",
|
|
238
404
|
value: function () {
|
|
239
|
-
var _ensureInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
405
|
+
var _ensureInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(target, openDataConfig) {
|
|
240
406
|
var normalizedTarget, config, fetchRevision, resolved;
|
|
241
|
-
return _regeneratorRuntime().wrap(function
|
|
242
|
-
while (1) switch (
|
|
407
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
408
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
243
409
|
case 0:
|
|
244
410
|
normalizedTarget = String(target || '').trim();
|
|
245
411
|
if (openDataConfig && openDataConfig !== this.store.data) {
|
|
@@ -252,31 +418,31 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
252
418
|
}
|
|
253
419
|
config = this.store.data;
|
|
254
420
|
if (!(!normalizedTarget || !config)) {
|
|
255
|
-
|
|
421
|
+
_context5.next = 5;
|
|
256
422
|
break;
|
|
257
423
|
}
|
|
258
|
-
return
|
|
424
|
+
return _context5.abrupt("return", getDefaultInvoiceTemplateSettings());
|
|
259
425
|
case 5:
|
|
260
426
|
fetchRevision = this.fetchRevision;
|
|
261
|
-
|
|
427
|
+
_context5.next = 8;
|
|
262
428
|
return this.resolveInvoiceTemplateSettings(config, normalizedTarget);
|
|
263
429
|
case 8:
|
|
264
|
-
resolved =
|
|
430
|
+
resolved = _context5.sent;
|
|
265
431
|
if (!(fetchRevision !== this.fetchRevision || this.store.data !== config)) {
|
|
266
|
-
|
|
432
|
+
_context5.next = 11;
|
|
267
433
|
break;
|
|
268
434
|
}
|
|
269
|
-
return
|
|
435
|
+
return _context5.abrupt("return", getDefaultInvoiceTemplateSettings());
|
|
270
436
|
case 11:
|
|
271
437
|
this.commitInvoiceTemplateSettings(normalizedTarget, resolved);
|
|
272
|
-
return
|
|
438
|
+
return _context5.abrupt("return", normalizeRawInvoiceTemplateSettings(resolved.settings));
|
|
273
439
|
case 13:
|
|
274
440
|
case "end":
|
|
275
|
-
return
|
|
441
|
+
return _context5.stop();
|
|
276
442
|
}
|
|
277
|
-
},
|
|
443
|
+
}, _callee5, this);
|
|
278
444
|
}));
|
|
279
|
-
function ensureInvoiceTemplateSettings(
|
|
445
|
+
function ensureInvoiceTemplateSettings(_x9, _x10) {
|
|
280
446
|
return _ensureInvoiceTemplateSettings.apply(this, arguments);
|
|
281
447
|
}
|
|
282
448
|
return ensureInvoiceTemplateSettings;
|
|
@@ -292,17 +458,17 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
292
458
|
}, {
|
|
293
459
|
key: "resolveInvoiceTemplateSettings",
|
|
294
460
|
value: function () {
|
|
295
|
-
var _resolveInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
296
|
-
var
|
|
461
|
+
var _resolveInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(config, target) {
|
|
462
|
+
var _this3 = this;
|
|
297
463
|
var rawTemplate, documentId, cacheKey, cachedSettings, request, cacheRevision;
|
|
298
|
-
return _regeneratorRuntime().wrap(function
|
|
299
|
-
while (1) switch (
|
|
464
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
465
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
300
466
|
case 0:
|
|
301
467
|
if (!this.shouldSkipInvoiceTemplateDocument()) {
|
|
302
|
-
|
|
468
|
+
_context6.next = 2;
|
|
303
469
|
break;
|
|
304
470
|
}
|
|
305
|
-
return
|
|
471
|
+
return _context6.abrupt("return", {
|
|
306
472
|
settings: getDefaultInvoiceTemplateSettings(),
|
|
307
473
|
documentId: null,
|
|
308
474
|
cacheKey: null
|
|
@@ -311,21 +477,21 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
311
477
|
rawTemplate = config['documents.invoice_template'];
|
|
312
478
|
documentId = resolveInvoiceDocumentId(rawTemplate);
|
|
313
479
|
if (documentId) {
|
|
314
|
-
|
|
480
|
+
_context6.next = 6;
|
|
315
481
|
break;
|
|
316
482
|
}
|
|
317
|
-
return
|
|
483
|
+
return _context6.abrupt("return", {
|
|
318
484
|
settings: isLegacyInvoiceTemplate(rawTemplate) ? normalizeInvoiceTemplateSettings(config) : getDefaultInvoiceTemplateSettings(),
|
|
319
485
|
documentId: null,
|
|
320
486
|
cacheKey: null
|
|
321
487
|
});
|
|
322
488
|
case 6:
|
|
323
|
-
cacheKey = this.
|
|
489
|
+
cacheKey = this.buildInvoiceCacheKey(target, documentId);
|
|
324
490
|
if (!(this.store.invoiceTemplateTarget === target && this.store.invoiceTemplateDocumentId === documentId && this.store.invoiceTemplateCacheKey === cacheKey && isRecord(this.store.invoiceTemplateSettings))) {
|
|
325
|
-
|
|
491
|
+
_context6.next = 9;
|
|
326
492
|
break;
|
|
327
493
|
}
|
|
328
|
-
return
|
|
494
|
+
return _context6.abrupt("return", {
|
|
329
495
|
settings: normalizeRawInvoiceTemplateSettings(this.store.invoiceTemplateSettings),
|
|
330
496
|
documentId: documentId,
|
|
331
497
|
cacheKey: cacheKey
|
|
@@ -333,10 +499,10 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
333
499
|
case 9:
|
|
334
500
|
cachedSettings = this.invoiceTemplateDocumentCache.get(cacheKey);
|
|
335
501
|
if (!cachedSettings) {
|
|
336
|
-
|
|
502
|
+
_context6.next = 12;
|
|
337
503
|
break;
|
|
338
504
|
}
|
|
339
|
-
return
|
|
505
|
+
return _context6.abrupt("return", {
|
|
340
506
|
settings: normalizeRawInvoiceTemplateSettings(cachedSettings),
|
|
341
507
|
documentId: documentId,
|
|
342
508
|
cacheKey: cacheKey
|
|
@@ -346,96 +512,109 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
346
512
|
if (!request) {
|
|
347
513
|
cacheRevision = this.invoiceTemplateCacheRevision;
|
|
348
514
|
request = this.fetchInvoiceTemplateDocument(documentId).catch(function (error) {
|
|
349
|
-
|
|
515
|
+
_this3.logInvoiceTemplateDocumentFallback(error, target, documentId);
|
|
350
516
|
return getDefaultInvoiceTemplateSettings();
|
|
351
517
|
}).then(function (settings) {
|
|
352
518
|
var normalized = normalizeRawInvoiceTemplateSettings(settings);
|
|
353
|
-
if (cacheRevision ===
|
|
354
|
-
|
|
519
|
+
if (cacheRevision === _this3.invoiceTemplateCacheRevision) {
|
|
520
|
+
_this3.invoiceTemplateDocumentCache.set(cacheKey, normalized);
|
|
355
521
|
}
|
|
356
522
|
return normalized;
|
|
357
523
|
}).finally(function () {
|
|
358
|
-
if (
|
|
359
|
-
|
|
524
|
+
if (_this3.invoiceTemplateDocumentInFlight.get(cacheKey) === request) {
|
|
525
|
+
_this3.invoiceTemplateDocumentInFlight.delete(cacheKey);
|
|
360
526
|
}
|
|
361
527
|
});
|
|
362
528
|
this.invoiceTemplateDocumentInFlight.set(cacheKey, request);
|
|
363
529
|
}
|
|
364
|
-
|
|
530
|
+
_context6.next = 16;
|
|
365
531
|
return request;
|
|
366
532
|
case 16:
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
return
|
|
371
|
-
settings:
|
|
372
|
-
documentId:
|
|
373
|
-
cacheKey:
|
|
533
|
+
_context6.t0 = _context6.sent;
|
|
534
|
+
_context6.t1 = documentId;
|
|
535
|
+
_context6.t2 = cacheKey;
|
|
536
|
+
return _context6.abrupt("return", {
|
|
537
|
+
settings: _context6.t0,
|
|
538
|
+
documentId: _context6.t1,
|
|
539
|
+
cacheKey: _context6.t2
|
|
374
540
|
});
|
|
375
541
|
case 20:
|
|
376
542
|
case "end":
|
|
377
|
-
return
|
|
543
|
+
return _context6.stop();
|
|
378
544
|
}
|
|
379
|
-
},
|
|
545
|
+
}, _callee6, this);
|
|
380
546
|
}));
|
|
381
|
-
function resolveInvoiceTemplateSettings(
|
|
547
|
+
function resolveInvoiceTemplateSettings(_x11, _x12) {
|
|
382
548
|
return _resolveInvoiceTemplateSettings.apply(this, arguments);
|
|
383
549
|
}
|
|
384
550
|
return resolveInvoiceTemplateSettings;
|
|
385
551
|
}()
|
|
386
552
|
}, {
|
|
387
|
-
key: "
|
|
388
|
-
value: function
|
|
553
|
+
key: "buildInvoiceCacheKey",
|
|
554
|
+
value: function buildInvoiceCacheKey(target, variant) {
|
|
389
555
|
var _this$appPlugin2, _this$appPlugin2$getD, _getData, _getData2;
|
|
390
556
|
var getData = (_this$appPlugin2 = this.appPlugin) === null || _this$appPlugin2 === void 0 || (_this$appPlugin2$getD = _this$appPlugin2.getData) === null || _this$appPlugin2$getD === void 0 ? void 0 : _this$appPlugin2$getD.call(_this$appPlugin2);
|
|
391
|
-
return JSON.stringify([(_getData = getData === null || getData === void 0 ? void 0 : getData('tenant_id')) !== null && _getData !== void 0 ? _getData : null, (_getData2 = getData === null || getData === void 0 ? void 0 : getData('shop_id')) !== null && _getData2 !== void 0 ? _getData2 : null, target,
|
|
557
|
+
return JSON.stringify([(_getData = getData === null || getData === void 0 ? void 0 : getData('tenant_id')) !== null && _getData !== void 0 ? _getData : null, (_getData2 = getData === null || getData === void 0 ? void 0 : getData('shop_id')) !== null && _getData2 !== void 0 ? _getData2 : null, target, variant]);
|
|
392
558
|
}
|
|
393
559
|
}, {
|
|
394
560
|
key: "fetchInvoiceTemplateDocument",
|
|
395
561
|
value: function () {
|
|
396
|
-
var _fetchInvoiceTemplateDocument = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
397
|
-
var
|
|
398
|
-
|
|
399
|
-
|
|
562
|
+
var _fetchInvoiceTemplateDocument = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(documentId) {
|
|
563
|
+
var strict,
|
|
564
|
+
response,
|
|
565
|
+
document,
|
|
566
|
+
_args7 = arguments;
|
|
567
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
568
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
400
569
|
case 0:
|
|
401
|
-
|
|
402
|
-
|
|
570
|
+
strict = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : false;
|
|
571
|
+
_context7.next = 3;
|
|
572
|
+
return this.request.get("/document:get?filterByTk=".concat(encodeURIComponent(documentId)), {}, _objectSpread({
|
|
403
573
|
isNocobase: true,
|
|
404
574
|
prefix: false,
|
|
405
575
|
headers: {
|
|
406
576
|
'x-data-source': 'pisell2'
|
|
407
577
|
},
|
|
408
578
|
customToast: function customToast() {}
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
|
|
579
|
+
}, strict ? {
|
|
580
|
+
manualErrorHandling: true,
|
|
581
|
+
skipErrorHandler: true
|
|
582
|
+
} : {}));
|
|
583
|
+
case 3:
|
|
584
|
+
response = _context7.sent;
|
|
412
585
|
document = response === null || response === void 0 ? void 0 : response.data;
|
|
413
586
|
if (!(!document || resolveInvoiceDocumentId(document.id) !== documentId)) {
|
|
414
|
-
|
|
587
|
+
_context7.next = 7;
|
|
415
588
|
break;
|
|
416
589
|
}
|
|
417
590
|
throw new Error("Invoice Document ".concat(documentId, " \u8FD4\u56DE\u7684 ID \u4E0D\u5339\u914D"));
|
|
418
|
-
case
|
|
591
|
+
case 7:
|
|
419
592
|
if (!(document.deleted_at !== null && document.deleted_at !== undefined)) {
|
|
420
|
-
|
|
593
|
+
_context7.next = 9;
|
|
421
594
|
break;
|
|
422
595
|
}
|
|
423
596
|
throw new Error("Invoice Document ".concat(documentId, " \u5DF2\u88AB\u5220\u9664"));
|
|
424
|
-
case
|
|
597
|
+
case 9:
|
|
425
598
|
if (!(!isRecord(document.data) || !isRecord(document.data.template_settings))) {
|
|
426
|
-
|
|
599
|
+
_context7.next = 11;
|
|
427
600
|
break;
|
|
428
601
|
}
|
|
429
602
|
throw new Error("Invoice Document ".concat(documentId, " \u7F3A\u5C11 template_settings"));
|
|
430
|
-
case 10:
|
|
431
|
-
return _context5.abrupt("return", normalizeRawInvoiceTemplateSettings(document.data.template_settings));
|
|
432
603
|
case 11:
|
|
604
|
+
if (!(strict && (typeof document.data.template_settings.template !== 'string' || !document.data.template_settings.template.trim()))) {
|
|
605
|
+
_context7.next = 13;
|
|
606
|
+
break;
|
|
607
|
+
}
|
|
608
|
+
throw new Error("Invoice Document ".concat(documentId, " \u7F3A\u5C11 template"));
|
|
609
|
+
case 13:
|
|
610
|
+
return _context7.abrupt("return", normalizeRawInvoiceTemplateSettings(document.data.template_settings));
|
|
611
|
+
case 14:
|
|
433
612
|
case "end":
|
|
434
|
-
return
|
|
613
|
+
return _context7.stop();
|
|
435
614
|
}
|
|
436
|
-
},
|
|
615
|
+
}, _callee7, this);
|
|
437
616
|
}));
|
|
438
|
-
function fetchInvoiceTemplateDocument(
|
|
617
|
+
function fetchInvoiceTemplateDocument(_x13) {
|
|
439
618
|
return _fetchInvoiceTemplateDocument.apply(this, arguments);
|
|
440
619
|
}
|
|
441
620
|
return fetchInvoiceTemplateDocument;
|
|
@@ -462,6 +641,8 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
462
641
|
value: function clearCache() {
|
|
463
642
|
this.fetchRevision += 1;
|
|
464
643
|
this.invoiceTemplateCacheRevision += 1;
|
|
644
|
+
this.printInvoiceTemplates.clear();
|
|
645
|
+
this.lastManualPrintKey = undefined;
|
|
465
646
|
this.invoiceTemplateDocumentCache.clear();
|
|
466
647
|
this.invoiceTemplateDocumentInFlight.clear();
|
|
467
648
|
this.store.data = null;
|
|
@@ -640,7 +640,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
640
640
|
generateIdempotencyToken(): string;
|
|
641
641
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
642
642
|
createOrder(params: CommitOrderParams['query']): {
|
|
643
|
-
type: "
|
|
643
|
+
type: "appointment_booking" | "virtual";
|
|
644
644
|
platform: string;
|
|
645
645
|
sales_channel: string;
|
|
646
646
|
order_sales_channel: string;
|
|
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
|
|
|
49
49
|
getCategories(): ProductCategory[];
|
|
50
50
|
setOtherParams(key: string, value: any): void;
|
|
51
51
|
getOtherParams(): any;
|
|
52
|
-
getProductType(): "
|
|
52
|
+
getProductType(): "duration" | "normal" | "session";
|
|
53
53
|
}
|
package/dist/server/index.d.ts
CHANGED
|
@@ -546,8 +546,11 @@ declare class Server {
|
|
|
546
546
|
private shouldLookupLocalPrintOrder;
|
|
547
547
|
private getLocalPrintOrderLookup;
|
|
548
548
|
private mergeLocalPrintOrderInput;
|
|
549
|
+
private loadCloudInvoiceOrder;
|
|
550
|
+
private handleCloudOrderInvoice;
|
|
549
551
|
private handleLocalPrintOrder;
|
|
550
552
|
private normalizeRequestedReceiptLocales;
|
|
553
|
+
private rebuildOrderReceipt;
|
|
551
554
|
private handleLocalOrderReceiptSnapshot;
|
|
552
555
|
private handleMachinecodeBatchMeta;
|
|
553
556
|
private resolveMachinecodeBatchMetadataLookup;
|