@pisell/pisellos 2.3.176 → 2.3.178
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/OpenData/utils.d.ts +1 -1
- package/dist/modules/OpenData/utils.js +3 -2
- package/dist/shared/receipt/customerInvoiceLanguages.d.ts +1 -1
- package/dist/shared/receipt/customerInvoiceLanguages.js +5 -3
- package/dist/solution/ScanOrder/index.js +10 -5
- package/lib/modules/OpenData/utils.d.ts +1 -1
- package/lib/modules/OpenData/utils.js +3 -2
- package/lib/shared/receipt/customerInvoiceLanguages.d.ts +1 -1
- package/lib/shared/receipt/customerInvoiceLanguages.js +5 -3
- package/lib/solution/ScanOrder/index.js +5 -0
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ export declare function getDefaultInvoiceLayoutConfig(): InvoiceLayoutConfig;
|
|
|
3
3
|
export declare function getDefaultInvoiceTemplateSettings(): InvoiceTemplateSettings;
|
|
4
4
|
/**
|
|
5
5
|
* 将非 DEFAULT Invoice 模板启用的语言转换为 small_ticket_data locale。
|
|
6
|
-
*
|
|
6
|
+
* 双语打印模式展开为各语言的数据;展示顺序仍由 template_settings.language 决定。
|
|
7
7
|
*/
|
|
8
8
|
export declare function resolveInvoiceReceiptLocales(settings?: InvoiceTemplateSettings | null): string[];
|
|
9
9
|
/**
|
|
@@ -51,12 +51,13 @@ var INVOICE_RECEIPT_LOCALE_MAPPING = {
|
|
|
51
51
|
zh_hk: ['zh_HK'],
|
|
52
52
|
ja: ['ja'],
|
|
53
53
|
pt: ['pt'],
|
|
54
|
-
cn_en: ['en', 'zh_CN']
|
|
54
|
+
cn_en: ['en', 'zh_CN'],
|
|
55
|
+
ja_en: ['ja', 'en']
|
|
55
56
|
};
|
|
56
57
|
|
|
57
58
|
/**
|
|
58
59
|
* 将非 DEFAULT Invoice 模板启用的语言转换为 small_ticket_data locale。
|
|
59
|
-
*
|
|
60
|
+
* 双语打印模式展开为各语言的数据;展示顺序仍由 template_settings.language 决定。
|
|
60
61
|
*/
|
|
61
62
|
export function resolveInvoiceReceiptLocales(settings) {
|
|
62
63
|
if (typeof (settings === null || settings === void 0 ? void 0 : settings.template) !== 'string' || settings.template.trim().length === 0 || settings.template.trim().toUpperCase() === 'DEFAULT' || !isRecord(settings.language)) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type CustomerInvoiceLanguageCode = 'en' | 'zh_CN' | 'zh_HK' | 'ja' | 'pt' | 'cn_en';
|
|
1
|
+
export type CustomerInvoiceLanguageCode = 'en' | 'zh_CN' | 'zh_HK' | 'ja' | 'pt' | 'cn_en' | 'ja_en';
|
|
2
2
|
export interface CustomerInvoiceLanguageOption {
|
|
3
3
|
code: CustomerInvoiceLanguageCode;
|
|
4
4
|
locales: string[];
|
|
@@ -25,15 +25,17 @@ var aliases = {
|
|
|
25
25
|
pt_br: 'pt',
|
|
26
26
|
pt_pt: 'pt',
|
|
27
27
|
cn_en: 'cn_en',
|
|
28
|
-
en_cn: 'cn_en'
|
|
28
|
+
en_cn: 'cn_en',
|
|
29
|
+
ja_en: 'ja_en'
|
|
29
30
|
};
|
|
30
31
|
export function normalizeCustomerInvoiceLanguage(value) {
|
|
31
32
|
return aliases[value.trim().toLowerCase().replace(/-/g, '_')];
|
|
32
33
|
}
|
|
33
34
|
function option(code) {
|
|
35
|
+
var locales = code === 'cn_en' ? ['en', 'zh_CN'] : code === 'ja_en' ? ['ja', 'en'] : [code];
|
|
34
36
|
return {
|
|
35
37
|
code: code,
|
|
36
|
-
locales:
|
|
38
|
+
locales: locales
|
|
37
39
|
};
|
|
38
40
|
}
|
|
39
41
|
|
|
@@ -55,6 +57,6 @@ export function resolveCustomerInvoiceLanguages(language, pageLocale) {
|
|
|
55
57
|
var normalized = normalizeCustomerInvoiceLanguage(pageLocale);
|
|
56
58
|
// A page locale is a single language, never a bilingual printer mode.
|
|
57
59
|
var requested = pageLocale.toLowerCase().replace(/_/g, '-');
|
|
58
|
-
var fallback = normalized && normalized !== 'cn_en' ? normalized : requested.startsWith('zh-tw') || requested.startsWith('zh-hk') ? 'zh_HK' : requested.startsWith('zh') ? 'zh_CN' : requested.startsWith('ja') ? 'ja' : requested.startsWith('pt') ? 'pt' : 'en';
|
|
60
|
+
var fallback = normalized && normalized !== 'cn_en' && normalized !== 'ja_en' ? normalized : requested.startsWith('zh-tw') || requested.startsWith('zh-hk') ? 'zh_HK' : requested.startsWith('zh') ? 'zh_CN' : requested.startsWith('ja') ? 'ja' : requested.startsWith('pt') ? 'pt' : 'en';
|
|
59
61
|
return [option(fallback)];
|
|
60
62
|
}
|
|
@@ -3431,8 +3431,8 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3431
3431
|
key: "syncAdditionalOrderFromResource",
|
|
3432
3432
|
value: function () {
|
|
3433
3433
|
var _syncAdditionalOrderFromResource = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(resourceId) {
|
|
3434
|
-
var _ref10, _ref11, _ref12, _this$store$resource5, _this$store$resource6, _occupyDetails$2, _this$store$resource7, _this$otherParams21, _this$store$order8;
|
|
3435
|
-
var tempOrder, normalizedResourceId, _result, occupyDetails, occupyDetail, resourceSelectType, allowAddItems, result;
|
|
3434
|
+
var _ref10, _ref11, _ref12, _this$store$resource5, _this$store$resource6, _occupyDetails$2, _this$store$resource7, _this$otherParams21, _this$store$resource8, _this$store$order8;
|
|
3435
|
+
var tempOrder, normalizedResourceId, _result, occupyDetails, occupyDetail, resourceSelectType, allowAddItems, result, resourceState;
|
|
3436
3436
|
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
3437
3437
|
while (1) switch (_context43.prev = _context43.next) {
|
|
3438
3438
|
case 0:
|
|
@@ -3481,6 +3481,11 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3481
3481
|
tempOrder.resource_id = normalizedResourceId;
|
|
3482
3482
|
tempOrder.relation_id = toPositiveString(occupyDetail === null || occupyDetail === void 0 ? void 0 : occupyDetail.form_record_id) || normalizedResourceId || tempOrder.relation_id;
|
|
3483
3483
|
tempOrder.table_form_id = toPositiveString(occupyDetail === null || occupyDetail === void 0 ? void 0 : occupyDetail.form_id) || tempOrder.table_form_id;
|
|
3484
|
+
// 冲突后转加餐需同步模式,否则重试仍会携带整单数据走 checkout。
|
|
3485
|
+
resourceState = (_this$store$resource8 = this.store.resource) !== null && _this$store$resource8 !== void 0 ? _this$store$resource8 : this.normalizeResourceState(occupyDetail, resourceSelectType, true);
|
|
3486
|
+
resourceState.mode = 'additional_order';
|
|
3487
|
+
resourceState.order_id = result.order_id;
|
|
3488
|
+
this.store.resource = resourceState;
|
|
3484
3489
|
(_this$store$order8 = this.store.order) === null || _this$store$order8 === void 0 || _this$store$order8.persistTempOrder();
|
|
3485
3490
|
this.logMethodSuccess('syncAdditionalOrderFromResource', _objectSpread(_objectSpread({}, result), {}, {
|
|
3486
3491
|
resourceId: normalizedResourceId,
|
|
@@ -3488,7 +3493,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3488
3493
|
allowAddItems: allowAddItems
|
|
3489
3494
|
}));
|
|
3490
3495
|
return _context43.abrupt("return", result);
|
|
3491
|
-
case
|
|
3496
|
+
case 30:
|
|
3492
3497
|
case "end":
|
|
3493
3498
|
return _context43.stop();
|
|
3494
3499
|
}
|
|
@@ -3503,9 +3508,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3503
3508
|
}, {
|
|
3504
3509
|
key: "getReservationResourceSelectType",
|
|
3505
3510
|
value: function getReservationResourceSelectType() {
|
|
3506
|
-
var _this$store$
|
|
3511
|
+
var _this$store$resource9;
|
|
3507
3512
|
this.logMethodStart('getReservationResourceSelectType');
|
|
3508
|
-
var resourceSelectType = (_this$store$
|
|
3513
|
+
var resourceSelectType = (_this$store$resource9 = this.store.resource) === null || _this$store$resource9 === void 0 ? void 0 : _this$store$resource9.resourceSelectType;
|
|
3509
3514
|
var result = _objectSpread(_objectSpread({}, resourceSelectType ? {
|
|
3510
3515
|
resourceSelectType: resourceSelectType
|
|
3511
3516
|
} : {}), {}, {
|
|
@@ -3,7 +3,7 @@ export declare function getDefaultInvoiceLayoutConfig(): InvoiceLayoutConfig;
|
|
|
3
3
|
export declare function getDefaultInvoiceTemplateSettings(): InvoiceTemplateSettings;
|
|
4
4
|
/**
|
|
5
5
|
* 将非 DEFAULT Invoice 模板启用的语言转换为 small_ticket_data locale。
|
|
6
|
-
*
|
|
6
|
+
* 双语打印模式展开为各语言的数据;展示顺序仍由 template_settings.language 决定。
|
|
7
7
|
*/
|
|
8
8
|
export declare function resolveInvoiceReceiptLocales(settings?: InvoiceTemplateSettings | null): string[];
|
|
9
9
|
/**
|
|
@@ -51,12 +51,13 @@ const INVOICE_RECEIPT_LOCALE_MAPPING = {
|
|
|
51
51
|
zh_hk: ['zh_HK'],
|
|
52
52
|
ja: ['ja'],
|
|
53
53
|
pt: ['pt'],
|
|
54
|
-
cn_en: ['en', 'zh_CN']
|
|
54
|
+
cn_en: ['en', 'zh_CN'],
|
|
55
|
+
ja_en: ['ja', 'en']
|
|
55
56
|
};
|
|
56
57
|
|
|
57
58
|
/**
|
|
58
59
|
* 将非 DEFAULT Invoice 模板启用的语言转换为 small_ticket_data locale。
|
|
59
|
-
*
|
|
60
|
+
* 双语打印模式展开为各语言的数据;展示顺序仍由 template_settings.language 决定。
|
|
60
61
|
*/
|
|
61
62
|
function resolveInvoiceReceiptLocales(settings) {
|
|
62
63
|
if (typeof settings?.template !== 'string' || settings.template.trim().length === 0 || settings.template.trim().toUpperCase() === 'DEFAULT' || !isRecord(settings.language)) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type CustomerInvoiceLanguageCode = 'en' | 'zh_CN' | 'zh_HK' | 'ja' | 'pt' | 'cn_en';
|
|
1
|
+
export type CustomerInvoiceLanguageCode = 'en' | 'zh_CN' | 'zh_HK' | 'ja' | 'pt' | 'cn_en' | 'ja_en';
|
|
2
2
|
export interface CustomerInvoiceLanguageOption {
|
|
3
3
|
code: CustomerInvoiceLanguageCode;
|
|
4
4
|
locales: string[];
|
|
@@ -26,15 +26,17 @@ const aliases = {
|
|
|
26
26
|
pt_br: 'pt',
|
|
27
27
|
pt_pt: 'pt',
|
|
28
28
|
cn_en: 'cn_en',
|
|
29
|
-
en_cn: 'cn_en'
|
|
29
|
+
en_cn: 'cn_en',
|
|
30
|
+
ja_en: 'ja_en'
|
|
30
31
|
};
|
|
31
32
|
function normalizeCustomerInvoiceLanguage(value) {
|
|
32
33
|
return aliases[value.trim().toLowerCase().replace(/-/g, '_')];
|
|
33
34
|
}
|
|
34
35
|
function option(code) {
|
|
36
|
+
const locales = code === 'cn_en' ? ['en', 'zh_CN'] : code === 'ja_en' ? ['ja', 'en'] : [code];
|
|
35
37
|
return {
|
|
36
38
|
code,
|
|
37
|
-
locales
|
|
39
|
+
locales
|
|
38
40
|
};
|
|
39
41
|
}
|
|
40
42
|
|
|
@@ -53,6 +55,6 @@ function resolveCustomerInvoiceLanguages(language, pageLocale) {
|
|
|
53
55
|
const normalized = normalizeCustomerInvoiceLanguage(pageLocale);
|
|
54
56
|
// A page locale is a single language, never a bilingual printer mode.
|
|
55
57
|
const requested = pageLocale.toLowerCase().replace(/_/g, '-');
|
|
56
|
-
const fallback = normalized && normalized !== 'cn_en' ? normalized : requested.startsWith('zh-tw') || requested.startsWith('zh-hk') ? 'zh_HK' : requested.startsWith('zh') ? 'zh_CN' : requested.startsWith('ja') ? 'ja' : requested.startsWith('pt') ? 'pt' : 'en';
|
|
58
|
+
const fallback = normalized && normalized !== 'cn_en' && normalized !== 'ja_en' ? normalized : requested.startsWith('zh-tw') || requested.startsWith('zh-hk') ? 'zh_HK' : requested.startsWith('zh') ? 'zh_CN' : requested.startsWith('ja') ? 'ja' : requested.startsWith('pt') ? 'pt' : 'en';
|
|
57
59
|
return [option(fallback)];
|
|
58
60
|
}
|
|
@@ -2113,6 +2113,11 @@ class ScanOrderImpl extends _BaseSales.BaseSalesImpl {
|
|
|
2113
2113
|
tempOrder.resource_id = normalizedResourceId;
|
|
2114
2114
|
tempOrder.relation_id = (0, _utils.toPositiveString)(occupyDetail?.form_record_id) || normalizedResourceId || tempOrder.relation_id;
|
|
2115
2115
|
tempOrder.table_form_id = (0, _utils.toPositiveString)(occupyDetail?.form_id) || tempOrder.table_form_id;
|
|
2116
|
+
// 冲突后转加餐需同步模式,否则重试仍会携带整单数据走 checkout。
|
|
2117
|
+
const resourceState = this.store.resource ?? this.normalizeResourceState(occupyDetail, resourceSelectType, true);
|
|
2118
|
+
resourceState.mode = 'additional_order';
|
|
2119
|
+
resourceState.order_id = result.order_id;
|
|
2120
|
+
this.store.resource = resourceState;
|
|
2116
2121
|
this.store.order?.persistTempOrder();
|
|
2117
2122
|
this.logMethodSuccess('syncAdditionalOrderFromResource', {
|
|
2118
2123
|
...result,
|