@pisell/private-materials 6.12.355 → 6.12.356
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.js +12 -12
- package/build/lowcode/view.js +12 -12
- package/es/components/bigSale/components/BookingFloatingPanel/useBookingPanelController.js +0 -1
- package/es/components/bigSale/components/ProductList/index.js +0 -1
- package/es/components/bigSale/components/TimeBar/index.js +0 -1
- package/es/components/bigSale/dialog.js +0 -1
- package/es/components/bigSale/hooks/useBigSaleContext.js +0 -1
- package/es/components/bigSale/hooks/useSelectFloorMapResourceForBigSale.js +0 -1
- package/es/components/bigSale/index.js +0 -1
- package/es/components/bigSale/templates/Kiosk/index.js +0 -1
- package/es/components/sharedSecondaryBigSale/SharedSecondaryBigSaleReceiver.js +0 -1
- package/es/index.js +0 -2
- package/es/plus/invoice/README.md +8 -2
- package/es/plus/invoice/ReceiptRenderer.js +1 -1
- package/es/plus/invoice/receipt.d.ts +2 -0
- package/es/plus/invoice/receipt.js +38 -8
- package/es/plus/invoice/receiptTranslations.js +8 -2
- package/es/plus/multiCurrencySettlement/index.js +1 -1
- package/es/plus/pisellReservation/data/bookingToReservationTables.js +1 -1
- package/es/plus/pisellReservation/floorMap/floorPlanApi.js +1 -1
- package/es/plus/pisellReservation/floorMap/reservationMock.js +1 -1
- package/es/plus/saasDevice/devicePasscodes/model.js +4 -4
- package/es/plus/saleDetail/Base.js +0 -1
- package/es/plus/saleDetail/components/Client/hooks/useClientSelectorProps.js +0 -1
- package/es/plus/saleDetail/components/DetailActions/PrintAction.js +0 -1
- package/es/plus/saleDetail/components/DetailActions/index.js +0 -1
- package/es/plus/saleDetail/components/SummaryFinancialSections/index.js +0 -1
- package/es/plus/saleDetail/index.js +0 -1
- package/es/plus/saleDetail/tmpl/B/components/Dish/index.js +0 -1
- package/es/plus/saleDetail/tmpl/B/components/Invoice/useInvoiceReceiptPreview.js +19 -13
- package/es/plus/saleDetail/tmpl/B/index.js +0 -1
- package/es/plus/salesSdk/utils/addProductWithFlowDebounced.js +1 -1
- package/es/plus/salesSdk/utils/bookingDate.js +1 -1
- package/es/plus/salesSdk/utils/enrichCartLineHolderDisplay.js +1 -1
- package/es/plus/walletPassGallery/components/timelineSection/index.js +4 -4
- package/es/private-materials/lowcode/authmodal/meta.d.ts +1 -0
- package/es/pro/Login2.0/AuthModal.d.ts +1 -1
- package/es/pro/Login2.0/index.d.ts +2 -2
- package/es/pro/Login2.0/shared/types.d.ts +1 -1
- package/lib/plus/invoice/README.md +8 -2
- package/lib/plus/invoice/ReceiptRenderer.js +1 -1
- package/lib/plus/invoice/receipt.d.ts +2 -0
- package/lib/plus/invoice/receipt.js +38 -8
- package/lib/plus/invoice/receiptTranslations.js +8 -2
- package/lib/plus/saleDetail/tmpl/B/components/Invoice/useInvoiceReceiptPreview.js +18 -12
- package/package.json +3 -3
- package/es/plus/pisellReservation/index.js +0 -17
- package/es/plus/salesSdk/index.js +0 -54
|
@@ -320,12 +320,8 @@ function findLocaleKey(data, candidate) {
|
|
|
320
320
|
const lowerCandidate = candidate.toLowerCase().replace(/-/g, "_");
|
|
321
321
|
return Object.keys(data).find((key) => key.toLowerCase().replace(/-/g, "_") === lowerCandidate);
|
|
322
322
|
}
|
|
323
|
-
function selectSmallTicketLocale(data, appLocale, primaryLocale) {
|
|
324
|
-
const candidates = [
|
|
325
|
-
...localeCandidates(appLocale),
|
|
326
|
-
"en",
|
|
327
|
-
...localeCandidates(primaryLocale || "")
|
|
328
|
-
];
|
|
323
|
+
function selectSmallTicketLocale(data, appLocale, primaryLocale, allowFallback = true) {
|
|
324
|
+
const candidates = [...localeCandidates(appLocale), ...allowFallback ? ["en", ...localeCandidates(primaryLocale || "")] : []];
|
|
329
325
|
for (const candidate of candidates) {
|
|
330
326
|
const key = findLocaleKey(data, candidate);
|
|
331
327
|
if (key && hasLocalePayload(data[key])) return {
|
|
@@ -333,7 +329,7 @@ function selectSmallTicketLocale(data, appLocale, primaryLocale) {
|
|
|
333
329
|
locale: key
|
|
334
330
|
};
|
|
335
331
|
}
|
|
336
|
-
const first = Object.keys(data).find((key) => hasLocalePayload(data[key]));
|
|
332
|
+
const first = allowFallback ? Object.keys(data).find((key) => hasLocalePayload(data[key])) : void 0;
|
|
337
333
|
return first ? {
|
|
338
334
|
data: data[first],
|
|
339
335
|
locale: first
|
|
@@ -365,6 +361,40 @@ function _resolveInvoiceLayoutConfig() {
|
|
|
365
361
|
});
|
|
366
362
|
return _resolveInvoiceLayoutConfig.apply(this, arguments);
|
|
367
363
|
}
|
|
364
|
+
const INVOICE_PREVIEW_LANGUAGES = {
|
|
365
|
+
en: ["en"],
|
|
366
|
+
zh_cn: ["zh_CN"],
|
|
367
|
+
zh_hk: ["zh_HK"],
|
|
368
|
+
ja: ["ja"],
|
|
369
|
+
pt: ["pt"],
|
|
370
|
+
cn_en: ["en", "zh_CN"],
|
|
371
|
+
ja_en: ["ja", "en"]
|
|
372
|
+
};
|
|
373
|
+
/** Use the first enabled print mode once, regardless of its copy count. */
|
|
374
|
+
function resolveInvoicePreviewConfig(_x2) {
|
|
375
|
+
return _resolveInvoicePreviewConfig.apply(this, arguments);
|
|
376
|
+
}
|
|
377
|
+
function _resolveInvoicePreviewConfig() {
|
|
378
|
+
_resolveInvoicePreviewConfig = require_asyncToGenerator._asyncToGenerator(function* (salesModule) {
|
|
379
|
+
if (typeof (salesModule === null || salesModule === void 0 ? void 0 : salesModule.getInvoiceTemplateSettings) === "function") {
|
|
380
|
+
const settings = yield salesModule.getInvoiceTemplateSettings();
|
|
381
|
+
if (isRecord(settings)) {
|
|
382
|
+
const layout = normalizeInvoiceLayoutConfig({ module: settings.modules });
|
|
383
|
+
if (typeof settings.template === "string" && settings.template.trim() && settings.template.trim().toUpperCase() !== "DEFAULT" && isRecord(settings.language)) for (const [rawCode, count] of Object.entries(settings.language)) {
|
|
384
|
+
if (typeof count !== "number" || !Number.isFinite(count) || count <= 0) continue;
|
|
385
|
+
const locales = INVOICE_PREVIEW_LANGUAGES[rawCode.trim().toLowerCase().replace(/-/g, "_")];
|
|
386
|
+
if (Array.isArray(locales)) return {
|
|
387
|
+
layout,
|
|
388
|
+
locales: [...locales]
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
return { layout };
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
return { layout: yield resolveInvoiceLayoutConfig(salesModule) };
|
|
395
|
+
});
|
|
396
|
+
return _resolveInvoicePreviewConfig.apply(this, arguments);
|
|
397
|
+
}
|
|
368
398
|
function text(value) {
|
|
369
399
|
return value === void 0 || value === null ? "" : String(value).trim();
|
|
370
400
|
}
|
|
@@ -906,7 +936,7 @@ exports.getReceiptProductTotal = getReceiptProductTotal;
|
|
|
906
936
|
exports.isSmallTicketData = isSmallTicketData;
|
|
907
937
|
exports.multiplyReceiptMoney = multiplyReceiptMoney;
|
|
908
938
|
exports.receiptMoneyValuesDiffer = receiptMoneyValuesDiffer;
|
|
909
|
-
exports.
|
|
939
|
+
exports.resolveInvoicePreviewConfig = resolveInvoicePreviewConfig;
|
|
910
940
|
exports.resolveSmallTicketData = resolveSmallTicketData;
|
|
911
941
|
exports.selectSmallTicketLocale = selectSmallTicketLocale;
|
|
912
942
|
exports.subtractReceiptMoney = subtractReceiptMoney;
|
|
@@ -42,9 +42,14 @@ function receiptLabel(receipt, key) {
|
|
|
42
42
|
return bilingualText(require_receipt.getReceiptLabel(receipt.locale, key), receipt.secondary && require_receipt.getReceiptLabel(receipt.secondary.locale, key));
|
|
43
43
|
}
|
|
44
44
|
function mergeTranslatedRows(primary, secondary, locale, secondaryLocale, sharedValues = false) {
|
|
45
|
+
const primaryRows = new Set(primary);
|
|
45
46
|
return pairReceiptEntries(primary, secondary, (row) => row.receipt_key).flatMap(({ primary: row, secondary: other }) => {
|
|
46
|
-
const
|
|
47
|
-
const
|
|
47
|
+
const labelLocale = primaryRows.has(row) ? locale : secondaryLocale;
|
|
48
|
+
const item = require_receipt.getReceiptLabel(labelLocale, row.item || "");
|
|
49
|
+
const result = [require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, row), {}, {
|
|
50
|
+
item,
|
|
51
|
+
labelLocale
|
|
52
|
+
})];
|
|
48
53
|
if (!other) return result;
|
|
49
54
|
let secondItem = require_receipt.getReceiptLabel(secondaryLocale, other.item || "");
|
|
50
55
|
if (row.receipt_key === "settlement/tax-included") secondItem = secondItem.replace(/\s-?[^\s\d]*\d[\d,.]*\s(?=\()/, " ");
|
|
@@ -53,6 +58,7 @@ function mergeTranslatedRows(primary, secondary, locale, secondaryLocale, shared
|
|
|
53
58
|
if (!secondItem && !secondValue) return result;
|
|
54
59
|
result.push(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, other), {}, {
|
|
55
60
|
item: secondItem,
|
|
61
|
+
labelLocale: secondaryLocale,
|
|
56
62
|
value: secondValue,
|
|
57
63
|
receipt_key: `${other.receipt_key}/secondary`
|
|
58
64
|
}));
|
|
@@ -82,13 +82,12 @@ function useInvoiceReceiptPreview(context) {
|
|
|
82
82
|
setState(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, LOADING_STATE), {}, { scope }));
|
|
83
83
|
(function() {
|
|
84
84
|
var _ref3 = require_asyncToGenerator._asyncToGenerator(function* () {
|
|
85
|
-
var _bookingTicket$getFor;
|
|
86
85
|
const { appLocale, bookingTicket, engineContext, orderId, platform, previewCreatedAt, salesDetail, salesModule, tempOrder } = scope;
|
|
87
|
-
const layout = yield require_receipt.
|
|
86
|
+
const { layout, locales } = yield require_receipt.resolveInvoicePreviewConfig(salesModule);
|
|
88
87
|
if (cancelled) return null;
|
|
89
88
|
const mustFilter = require_invoiceVisibility.requiresInvoiceDataFiltering(layout);
|
|
90
89
|
const needsPaymentTimeKeys = require_invoiceVisibility.requiresInvoicePaymentTimeKeys(layout);
|
|
91
|
-
const useSharedConfig = require_invoiceVisibility.hasInvoiceDetailSettings(layout) || mustFilter;
|
|
90
|
+
const useSharedConfig = require_invoiceVisibility.hasInvoiceDetailSettings(layout) || mustFilter || Boolean(locales);
|
|
92
91
|
const isVirtualOrder = require_index.isVirtualSettlementTempOrder(tempOrder) || require_index.isVirtualSettlementTempOrder(salesDetail === null || salesDetail === void 0 ? void 0 : salesDetail.raw);
|
|
93
92
|
const legacyVirtualResult = {
|
|
94
93
|
receipt: null,
|
|
@@ -98,11 +97,12 @@ function useInvoiceReceiptPreview(context) {
|
|
|
98
97
|
};
|
|
99
98
|
if (isVirtualOrder && !useSharedConfig) return legacyVirtualResult;
|
|
100
99
|
const requiresSource = isVirtualOrder && useSharedConfig;
|
|
100
|
+
const requiresFreshSnapshot = mustFilter || needsPaymentTimeKeys || requiresSource || ((locales === null || locales === void 0 ? void 0 : locales.length) || 0) > 1;
|
|
101
101
|
const embeddedSnapshot = require_receipt.resolveSmallTicketData(salesDetail, tempOrder);
|
|
102
102
|
const { snapshot, source } = yield function() {
|
|
103
103
|
var _ref2 = require_asyncToGenerator._asyncToGenerator(function* () {
|
|
104
104
|
if (platform !== "h5" && orderId !== null && orderId !== void 0) try {
|
|
105
|
-
const freshSnapshot = yield require_serve.getLocalOrderReceiptSnapshot(orderId, [appLocale], layout);
|
|
105
|
+
const freshSnapshot = yield require_serve.getLocalOrderReceiptSnapshot(orderId, locales || [appLocale], layout);
|
|
106
106
|
if (!freshSnapshot || !require_receipt.isSmallTicketData(freshSnapshot.small_ticket_data)) throw new Error("Receipt snapshot is unavailable");
|
|
107
107
|
if (mustFilter && freshSnapshot.template_visibility_applied !== true) throw new Error("Receipt snapshot does not support template filtering");
|
|
108
108
|
if (needsPaymentTimeKeys && !require_invoiceVisibility.hasInvoicePaymentTimeKeys(freshSnapshot.small_ticket_data)) throw new Error("Receipt snapshot does not identify payment history times");
|
|
@@ -112,10 +112,10 @@ function useInvoiceReceiptPreview(context) {
|
|
|
112
112
|
source: freshSnapshot.source || null
|
|
113
113
|
};
|
|
114
114
|
} catch (error) {
|
|
115
|
-
if (
|
|
115
|
+
if (requiresFreshSnapshot) throw error;
|
|
116
116
|
console.warn("[SaleDetail.Invoice] Failed to rebuild local receipt snapshot", error);
|
|
117
117
|
}
|
|
118
|
-
if (
|
|
118
|
+
if (requiresFreshSnapshot) throw new Error("A template-aware local receipt snapshot is required");
|
|
119
119
|
return {
|
|
120
120
|
snapshot: embeddedSnapshot || (orderId !== null && orderId !== void 0 ? yield require_serve.getOrderSmallTicketData(orderId) : null),
|
|
121
121
|
source: null
|
|
@@ -129,17 +129,23 @@ function useInvoiceReceiptPreview(context) {
|
|
|
129
129
|
const isVirtualSource = require_index.isVirtualSettlementTempOrder(source);
|
|
130
130
|
if (isVirtualSource && !useSharedConfig) return legacyVirtualResult;
|
|
131
131
|
const shopInfo = getShopInfo(engineContext);
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
132
|
+
const buildReceipt = (locale) => {
|
|
133
|
+
var _bookingTicket$getFor;
|
|
134
|
+
const selected = require_receipt.selectSmallTicketLocale(snapshot, locale, shopInfo.primary_locale, !locales);
|
|
135
|
+
if (!selected) throw new Error(`Receipt language data is unavailable: ${locale}`);
|
|
136
|
+
return require_receipt.buildInvoiceReceiptViewModel({
|
|
137
|
+
data: require_invoiceVisibility.isInvoiceResourceTitleVisible(layout) ? require_formTitleDisplay.withDisplayedReceiptFormTitles(selected.data, (bookingTicket === null || bookingTicket === void 0 || (_bookingTicket$getFor = bookingTicket.getFormTitleMap) === null || _bookingTicket$getFor === void 0 ? void 0 : _bookingTicket$getFor.call(bookingTicket)) || {}, selected.locale, (salesDetail === null || salesDetail === void 0 ? void 0 : salesDetail.bookings) || []) : selected.data,
|
|
137
138
|
layout,
|
|
138
139
|
locale: selected.locale,
|
|
139
140
|
previewTime: require_receipt.formatReceiptPreviewTime(previewCreatedAt, selected.locale),
|
|
140
141
|
shopLogo: getShopLogo(shopInfo),
|
|
141
142
|
taxNumberLabel: shopInfo.tax_number_title || (String(shopInfo.tax_country_code || "").toUpperCase() === "AU" ? "ABN" : void 0)
|
|
142
|
-
})
|
|
143
|
+
});
|
|
144
|
+
};
|
|
145
|
+
const receipt = buildReceipt((locales === null || locales === void 0 ? void 0 : locales[0]) || appLocale);
|
|
146
|
+
if (locales === null || locales === void 0 ? void 0 : locales[1]) receipt.secondary = buildReceipt(locales[1]);
|
|
147
|
+
return {
|
|
148
|
+
receipt,
|
|
143
149
|
source,
|
|
144
150
|
useLegacyVirtualCurrencyInvoice: false,
|
|
145
151
|
useVirtualCurrencyReceipt: useSharedConfig && isVirtualSource
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pisell/private-materials",
|
|
3
|
-
"version": "6.12.
|
|
3
|
+
"version": "6.12.356",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"module": "./es/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -76,8 +76,8 @@
|
|
|
76
76
|
"@pisell/pi-payment-sdk": "0.0.4",
|
|
77
77
|
"@pisell/utils": "3.0.7",
|
|
78
78
|
"@pisell/icon": "0.0.11",
|
|
79
|
-
"@pisell/
|
|
80
|
-
"@pisell/
|
|
79
|
+
"@pisell/materials": "6.12.86",
|
|
80
|
+
"@pisell/date-picker": "3.0.12"
|
|
81
81
|
},
|
|
82
82
|
"peerDependencies": {
|
|
83
83
|
"react": "^18.0.0",
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import "./serve/formResourcePage.js";
|
|
2
|
-
import "./floorRoomCard/mapRowToFloorRoomCardData.js";
|
|
3
|
-
import "./floorRoomCard/ReservationFloorRoomCard.js";
|
|
4
|
-
import "./floorMap/reservationMock.js";
|
|
5
|
-
import "./floorMap/floorPlanApi.js";
|
|
6
|
-
import "./reservationConstants.js";
|
|
7
|
-
import "./data/bookingToReservationTables.js";
|
|
8
|
-
import "./data/formResourceToReservationTables.js";
|
|
9
|
-
import "./data/salesEmbeddedResourceToTableRows.js";
|
|
10
|
-
import "./floorMap/reservationCards.js";
|
|
11
|
-
import "./PisellReservation.js";
|
|
12
|
-
import "./PisellReservationBookingPage.js";
|
|
13
|
-
import "./PisellVenueControlPage.js";
|
|
14
|
-
import "./PisellVenueWallPage.js";
|
|
15
|
-
import "./PisellReservationTablePage.js";
|
|
16
|
-
import "./components/SelectFloorMapResourceDialog.js";
|
|
17
|
-
export {};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import "./hosts/createInstanceHostBridge.js";
|
|
2
|
-
import "./holderConfirm/createHolderConfirmBridge.js";
|
|
3
|
-
import "./giftSelect/createGiftSelectBridge.js";
|
|
4
|
-
import "./context/SalesSdkHostBridgesContext.js";
|
|
5
|
-
import "./utils/formatHolderOptions.js";
|
|
6
|
-
import "./utils/enrichCartLineHolderDisplay.js";
|
|
7
|
-
import "./context/SalesSdkHolderContext.js";
|
|
8
|
-
import "../multiCurrencySettlement/index.js";
|
|
9
|
-
import "./utils/customerAuthGate.js";
|
|
10
|
-
import "./context/SalesSdkBusinessAvailabilityContext.js";
|
|
11
|
-
import "./utils/appendPromotionTags.js";
|
|
12
|
-
import "./utils/productSkuOptions.js";
|
|
13
|
-
import "./context/SalesSdkUIHostsContext.js";
|
|
14
|
-
import "./utils/runAddProductFlow.js";
|
|
15
|
-
import "./components/showAddToCartToast.js";
|
|
16
|
-
import "./utils/resolveAddProductDebounceKey.js";
|
|
17
|
-
import "./utils/identity.js";
|
|
18
|
-
import "./utils/resolveInCartQuantityForAddToast.js";
|
|
19
|
-
import "./utils/addProductWithFlowDebounced.js";
|
|
20
|
-
import "./utils/bookingDate.js";
|
|
21
|
-
import "./utils/holderSubmitValidation.js";
|
|
22
|
-
import "./utils/removeOrderProducts.js";
|
|
23
|
-
import "./selectors.js";
|
|
24
|
-
import "./utils/enrich.js";
|
|
25
|
-
import "./giftSelect/createOpenGiftSelectHost.js";
|
|
26
|
-
import "./utils/ensureHoldersBeforeSubmit.js";
|
|
27
|
-
import "./hooks/useSalesSdk.js";
|
|
28
|
-
import "./bookingEditService/BookingEditServiceDrawer.js";
|
|
29
|
-
import "./hosts/BookingEditHostRenderer.js";
|
|
30
|
-
import "./hosts/CustomerAuthHostRenderer.js";
|
|
31
|
-
import "./hooks/useSalesSdkCart.js";
|
|
32
|
-
import "./hooks/useSalesSdkCustomer.js";
|
|
33
|
-
import "./normalProductDetail/NormalProductDetailHostRenderer.js";
|
|
34
|
-
import "./hosts/createOpenBookingEditHost.js";
|
|
35
|
-
import "./hosts/createOpenMultiDaySelectHost.js";
|
|
36
|
-
import "./hosts/createOpenHolderSelectHost.js";
|
|
37
|
-
import "./hosts/createOpenCustomerAuthHost.js";
|
|
38
|
-
import "./demo/hosts/legacyOpenProductDetail.js";
|
|
39
|
-
import "./hosts/createCompositeOpenProductDetailHost.js";
|
|
40
|
-
import "./normalProductDetail/createOpenNormalProductDetailHost.js";
|
|
41
|
-
import "./normalProductDetail/createOpenBookingSelectionFlowHost.js";
|
|
42
|
-
import "./giftSelect/GiftSelectModal.js";
|
|
43
|
-
import "./giftSelect/GiftSelectHostRenderer.js";
|
|
44
|
-
import "./allergy/AllergySelectionModal.js";
|
|
45
|
-
import "./context/SalesSdkProvider.js";
|
|
46
|
-
import "./context/SalesSdkDishContext.js";
|
|
47
|
-
import "./context/SalesSdkBookingContext.js";
|
|
48
|
-
import "./hooks/useSalesSdkSummary.js";
|
|
49
|
-
import "./hooks/useSalesSdkProducts.js";
|
|
50
|
-
import "./demo/index.js";
|
|
51
|
-
import "./hooks/useSalesSdkDish.js";
|
|
52
|
-
import "./hooks/useCurrentSalesSdkDish.js";
|
|
53
|
-
import "./hooks/useSyncOsModule.js";
|
|
54
|
-
export {};
|