@pisell/private-materials 6.11.175 → 6.11.177

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.
@@ -93,7 +93,10 @@ export function ReservationBookingDetailModal(props) {
93
93
  var productCardSources = useMemo(function () {
94
94
  if (!raw) return [];
95
95
  return parseBookingProducts(raw).map(function (line, i) {
96
- return bookingProductLineToProductCardData(line, i);
96
+ var _engineContext$appHel, _engineContext$appHel2;
97
+ return bookingProductLineToProductCardData(line, i, {
98
+ app: engineContext === null || engineContext === void 0 || (_engineContext$appHel = engineContext.appHelper) === null || _engineContext$appHel === void 0 || (_engineContext$appHel = _engineContext$appHel.utils) === null || _engineContext$appHel === void 0 || (_engineContext$appHel2 = _engineContext$appHel.getApp) === null || _engineContext$appHel2 === void 0 ? void 0 : _engineContext$appHel2.call(_engineContext$appHel)
99
+ });
97
100
  });
98
101
  }, [raw]);
99
102
  useEffect(function () {
@@ -137,10 +140,10 @@ export function ReservationBookingDetailModal(props) {
137
140
  }, [tableRow, sceneElementName]);
138
141
  var canShow = Boolean(open && raw != null && roomCardData != null);
139
142
  var handleActionCellClick = useCallback(function (key, e) {
140
- var _engineContext$appHel;
143
+ var _engineContext$appHel3;
141
144
  stopUiClick(e);
142
145
  if (!raw) return;
143
- var _ref2 = ((_engineContext$appHel = engineContext.appHelper) === null || _engineContext$appHel === void 0 ? void 0 : _engineContext$appHel.utils) || {},
146
+ var _ref2 = ((_engineContext$appHel3 = engineContext.appHelper) === null || _engineContext$appHel3 === void 0 ? void 0 : _engineContext$appHel3.utils) || {},
144
147
  action = _ref2.action,
145
148
  NativePage = _ref2.NativePage;
146
149
  var orderId = resolveOrderIdForHostActions(raw);
@@ -189,7 +192,7 @@ export function ReservationBookingDetailModal(props) {
189
192
  type: 'webpos.handlePrint',
190
193
  data: {
191
194
  data: raw,
192
- type: '2'
195
+ type: '0'
193
196
  },
194
197
  callback: function callback() {}
195
198
  });
@@ -7,4 +7,4 @@ import type { productType } from '../../../../../../materials/src/components/pro
7
7
  /**
8
8
  * @param line booking.products 或 order.products 同源结构(与 api-bookings-demo 一致)
9
9
  */
10
- export declare function bookingProductLineToProductCardData(line: Record<string, unknown>, index: number): productType;
10
+ export declare function bookingProductLineToProductCardData(line: Record<string, unknown>, index: number, setting: any): productType;
@@ -197,10 +197,10 @@ function resolveProductNumericId(line, index) {
197
197
  /**
198
198
  * @param line booking.products 或 order.products 同源结构(与 api-bookings-demo 一致)
199
199
  */
200
- export function bookingProductLineToProductCardData(line, index) {
201
- var _line$resource_id, _ref, _line$image;
200
+ export function bookingProductLineToProductCardData(line, index, setting) {
201
+ var _setting$app, _setting$app$translat, _line$resource_id, _ref, _line$image;
202
202
  var titleObj = line.product_title;
203
- var name = pickLocalizedText(titleObj) || str(line.name) || str(line.title) || '—';
203
+ var name = (setting === null || setting === void 0 || (_setting$app = setting.app) === null || _setting$app === void 0 || (_setting$app = _setting$app.locales) === null || _setting$app === void 0 || (_setting$app$translat = _setting$app.translation) === null || _setting$app$translat === void 0 ? void 0 : _setting$app$translat.call(_setting$app, titleObj)) || pickLocalizedText(titleObj) || str(line.name) || str(line.title) || '—';
204
204
  var sku = line.product_sku;
205
205
  var qty = Math.max(1, Math.round(parseMoneyNumber(line.product_quantity) || 1));
206
206
  var _resolveMainLineAmoun = resolveMainLineAmounts(line, qty),
@@ -108,7 +108,12 @@ function ReservationBookingDetailModal(props) {
108
108
  const productCardSources = (0, import_react.useMemo)(() => {
109
109
  if (!raw) return [];
110
110
  return parseBookingProducts(raw).map(
111
- (line, i) => (0, import_bookingProductToProductCard.bookingProductLineToProductCardData)(line, i)
111
+ (line, i) => {
112
+ var _a, _b, _c;
113
+ return (0, import_bookingProductToProductCard.bookingProductLineToProductCardData)(line, i, {
114
+ app: (_c = (_b = (_a = engineContext == null ? void 0 : engineContext.appHelper) == null ? void 0 : _a.utils) == null ? void 0 : _b.getApp) == null ? void 0 : _c.call(_b)
115
+ });
116
+ }
112
117
  );
113
118
  }, [raw]);
114
119
  (0, import_react.useEffect)(() => {
@@ -192,7 +197,7 @@ function ReservationBookingDetailModal(props) {
192
197
  type: "webpos.handlePrint",
193
198
  data: {
194
199
  data: raw,
195
- type: "2"
200
+ type: "0"
196
201
  },
197
202
  callback: () => {
198
203
  }
@@ -7,4 +7,4 @@ import type { productType } from '../../../../../../materials/src/components/pro
7
7
  /**
8
8
  * @param line booking.products 或 order.products 同源结构(与 api-bookings-demo 一致)
9
9
  */
10
- export declare function bookingProductLineToProductCardData(line: Record<string, unknown>, index: number): productType;
10
+ export declare function bookingProductLineToProductCardData(line: Record<string, unknown>, index: number, setting: any): productType;
@@ -171,9 +171,10 @@ function resolveProductNumericId(line, index) {
171
171
  const n = Number(String(pid ?? "").replace(/\D/g, ""));
172
172
  return Number.isFinite(n) && n > 0 ? n : index;
173
173
  }
174
- function bookingProductLineToProductCardData(line, index) {
174
+ function bookingProductLineToProductCardData(line, index, setting) {
175
+ var _a, _b, _c;
175
176
  const titleObj = line.product_title;
176
- const name = pickLocalizedText(titleObj) || str(line.name) || str(line.title) || "—";
177
+ const name = ((_c = (_b = (_a = setting == null ? void 0 : setting.app) == null ? void 0 : _a.locales) == null ? void 0 : _b.translation) == null ? void 0 : _c.call(_b, titleObj)) || pickLocalizedText(titleObj) || str(line.name) || str(line.title) || "—";
177
178
  const sku = line.product_sku;
178
179
  const qty = Math.max(
179
180
  1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "6.11.175",
3
+ "version": "6.11.177",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",