@pisell/private-materials 6.11.657 → 6.11.659
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/preview.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 +1 -0
- package/es/components/bigSale/components/TimeBar/index.js +1 -0
- package/es/components/bigSale/dialog.js +1 -0
- package/es/components/bigSale/hooks/useBigSaleContext.js +1 -0
- package/es/components/bigSale/hooks/useBigSaleProductListConfig.js +0 -1
- package/es/components/bigSale/hooks/useSelectFloorMapResourceForBigSale.js +1 -0
- package/es/components/bigSale/hooks/useSyncBigSaleCartToCds.js +141 -75
- package/es/components/bigSale/index.js +1 -0
- package/es/components/bigSale/locales/index.js +15 -0
- package/es/components/bigSale/templates/Kiosk/index.js +1 -0
- package/es/components/sharedSecondaryBigSale/SharedSecondaryBigSaleReceiver.js +1 -0
- package/es/components/ticketBooking/components/addServiceVariant/addService.js +0 -1
- package/es/index.js +2 -0
- 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/pisellReservation/index.js +17 -0
- package/es/plus/saleDetail/Base.js +1 -0
- package/es/plus/saleDetail/components/Client/hooks/useClientSelectorProps.js +1 -0
- package/es/plus/saleDetail/components/DetailActions/index.js +1 -0
- package/es/plus/saleDetail/components/SummaryFinancialSections/index.js +1 -0
- package/es/plus/saleDetail/index.js +1 -0
- package/es/plus/saleDetail/tmpl/B/components/Dish/index.js +1 -0
- package/es/plus/saleDetail/tmpl/B/index.js +1 -0
- package/es/plus/salesSdk/index.js +51 -0
- package/es/plus/salesSdk/utils/addProductWithFlowDebounced.js +1 -1
- package/es/plus/salesSdk/utils/bookingDate.js +1 -1
- package/es/plus/salesSdk/utils/customerAuthGate.js +1 -1
- package/es/plus/salesSdk/utils/enrichCartLineHolderDisplay.js +1 -1
- package/es/pro/Login2.0/AuthModal.d.ts +1 -1
- package/es/pro/Login2.0/index.d.ts +2 -1
- package/es/pro/Login2.0/shared/types.d.ts +1 -1
- package/lib/components/bigSale/hooks/useSyncBigSaleCartToCds.js +143 -76
- package/lib/components/bigSale/locales/index.js +15 -0
- package/package.json +5 -5
- package/es/components/ticketBooking/components/ProductDisplayAdapter/index.js +0 -3
- package/es/private-materials/lowcode/authmodal/meta.d.ts +0 -1
|
@@ -0,0 +1,51 @@
|
|
|
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 "./utils/appendPromotionTags.js";
|
|
9
|
+
import "./context/SalesSdkUIHostsContext.js";
|
|
10
|
+
import "./utils/runAddProductFlow.js";
|
|
11
|
+
import "./components/showAddToCartToast.js";
|
|
12
|
+
import "./utils/resolveAddProductDebounceKey.js";
|
|
13
|
+
import "./utils/productSkuOptions.js";
|
|
14
|
+
import "./utils/identity.js";
|
|
15
|
+
import "./utils/resolveInCartQuantityForAddToast.js";
|
|
16
|
+
import "./utils/addProductWithFlowDebounced.js";
|
|
17
|
+
import "./utils/customerAuthGate.js";
|
|
18
|
+
import "./utils/bookingDate.js";
|
|
19
|
+
import "./utils/holderSubmitValidation.js";
|
|
20
|
+
import "./utils/removeOrderProducts.js";
|
|
21
|
+
import "./selectors.js";
|
|
22
|
+
import "./utils/enrich.js";
|
|
23
|
+
import "./giftSelect/createOpenGiftSelectHost.js";
|
|
24
|
+
import "./utils/ensureHoldersBeforeSubmit.js";
|
|
25
|
+
import "./hooks/useSalesSdk.js";
|
|
26
|
+
import "./bookingEditService/BookingEditServiceDrawer.js";
|
|
27
|
+
import "./hosts/BookingEditHostRenderer.js";
|
|
28
|
+
import "./hosts/CustomerAuthHostRenderer.js";
|
|
29
|
+
import "./hooks/useSalesSdkCart.js";
|
|
30
|
+
import "./hooks/useSalesSdkCustomer.js";
|
|
31
|
+
import "./normalProductDetail/NormalProductDetailHostRenderer.js";
|
|
32
|
+
import "./hosts/createOpenBookingEditHost.js";
|
|
33
|
+
import "./hosts/createOpenMultiDaySelectHost.js";
|
|
34
|
+
import "./hosts/createOpenHolderSelectHost.js";
|
|
35
|
+
import "./hosts/createOpenCustomerAuthHost.js";
|
|
36
|
+
import "./demo/hosts/legacyOpenProductDetail.js";
|
|
37
|
+
import "./hosts/createCompositeOpenProductDetailHost.js";
|
|
38
|
+
import "./normalProductDetail/createOpenNormalProductDetailHost.js";
|
|
39
|
+
import "./normalProductDetail/createOpenBookingSelectionFlowHost.js";
|
|
40
|
+
import "./giftSelect/GiftSelectModal.js";
|
|
41
|
+
import "./giftSelect/GiftSelectHostRenderer.js";
|
|
42
|
+
import "./context/SalesSdkProvider.js";
|
|
43
|
+
import "./context/SalesSdkDishContext.js";
|
|
44
|
+
import "./context/SalesSdkBookingContext.js";
|
|
45
|
+
import "./hooks/useSalesSdkSummary.js";
|
|
46
|
+
import "./hooks/useSalesSdkProducts.js";
|
|
47
|
+
import "./demo/index.js";
|
|
48
|
+
import "./hooks/useSalesSdkDish.js";
|
|
49
|
+
import "./hooks/useCurrentSalesSdkDish.js";
|
|
50
|
+
import "./hooks/useSyncOsModule.js";
|
|
51
|
+
export {};
|
|
@@ -31,4 +31,4 @@ function subscribeBookingDateChange(bookingTicket, callback) {
|
|
|
31
31
|
return typeof off === "function" ? off : () => {};
|
|
32
32
|
}
|
|
33
33
|
//#endregion
|
|
34
|
-
export { formatBookingDateTime, subscribeBookingDateChange };
|
|
34
|
+
export { BOOKING_CONTEXT_DATE_EVENT, formatBookingDateTime, subscribeBookingDateChange };
|
|
@@ -62,4 +62,4 @@ function normalizeCustomerAuthCustomer(value) {
|
|
|
62
62
|
return null;
|
|
63
63
|
}
|
|
64
64
|
//#endregion
|
|
65
|
-
export { isValidOrderCustomerId, normalizeCustomerAuthCustomer, resolveCustomerAuthCurrentCustomerId, shouldPromptCustomerAuthForProduct };
|
|
65
|
+
export { isHolderRequiredProduct, isKioskRuntime, isValidOrderCustomerId, normalizeCustomerAuthCustomer, resolveCustomerAuthCurrentCustomerId, shouldPromptCustomerAuthForProduct };
|
|
@@ -71,4 +71,4 @@ function buildHolderListRequestKey(params) {
|
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
//#endregion
|
|
74
|
-
export { buildHolderListRequestKey, buildHolderListRequestParams, enrichCartBookingHolderDisplay, resolveHolderDisplayConfig };
|
|
74
|
+
export { buildHolderListRequestKey, buildHolderListRequestParams, enrichCartBookingHolderDisplay, pickHolderIdFromBooking, resolveHolderDisplayConfig };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AuthMethodType, EmailAuthConfig, EmailRegistrationVerification, LoginFormData, OAuthConfig, PhoneAuthConfig, RegisterFormData, UIConfig, VerificationMethod } from "./shared/types.js";
|
|
1
2
|
import { Login2, Login2Config, Login2Events, Login2Props } from "./Login2.js";
|
|
2
3
|
import { Register2, Register2Config, Register2Events, Register2Props } from "./Register2.js";
|
|
3
|
-
import { AuthModal
|
|
4
|
+
import { AuthModal } from "./AuthModal.js";
|
|
@@ -226,4 +226,4 @@ interface RegisterFormData {
|
|
|
226
226
|
verification_token?: string;
|
|
227
227
|
}
|
|
228
228
|
//#endregion
|
|
229
|
-
export { AuthMethodType, EmailAuthConfig, LegalTermsConfig, LoginFormData, LoginMethodItem, OAuthConfig, PhoneAuthConfig, RegisterFormData, RegistrationMethodItem, UIConfig };
|
|
229
|
+
export { AuthMethodType, EmailAuthConfig, EmailRegistrationVerification, LegalTermsConfig, LoginFormData, LoginMethodItem, OAuthConfig, PhoneAuthConfig, RegisterFormData, RegistrationMethodItem, UIConfig, VerificationMethod };
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
require("../../../_virtual/_rolldown/runtime.js");
|
|
1
|
+
const require_runtime = require("../../../_virtual/_rolldown/runtime.js");
|
|
2
2
|
const require_objectSpread2 = require("../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
|
|
3
3
|
const require_useEngineContext = require("../../../hooks/useEngineContext.js");
|
|
4
|
+
const require_resolveLocalizedText = require("../../../plus/salesSdk/utils/resolveLocalizedText.js");
|
|
4
5
|
const require_useFixedPaymentMethodNameMap = require("../../../hooks/useFixedPaymentMethodNameMap.js");
|
|
5
6
|
const require_productSkuOptions = require("../../../plus/salesSdk/utils/productSkuOptions.js");
|
|
6
7
|
const require_utils = require("../../../plus/saleDetail/utils.js");
|
|
7
8
|
const require_formatTime = require("../utils/formatTime.js");
|
|
8
9
|
let react = require("react");
|
|
9
10
|
let _pisell_utils = require("@pisell/utils");
|
|
11
|
+
let decimal_js = require("decimal.js");
|
|
12
|
+
decimal_js = require_runtime.__toESM(decimal_js);
|
|
10
13
|
//#region src/components/bigSale/hooks/useSyncBigSaleCartToCds.ts
|
|
11
14
|
const EMPTY_CART_UPDATE = {
|
|
12
15
|
total: "0",
|
|
@@ -34,13 +37,12 @@ const toFiniteNumber = (value, fallback = 0) => {
|
|
|
34
37
|
};
|
|
35
38
|
const callLocaleText = (key, ...args) => {
|
|
36
39
|
const text = _pisell_utils.locales.getText(key);
|
|
37
|
-
return typeof text === "function" ? text(...args) : text;
|
|
40
|
+
return require_resolveLocalizedText.resolveLocalizedText(typeof text === "function" ? text(...args) : text);
|
|
38
41
|
};
|
|
39
42
|
const postCartUpdateToCds = (utils, data) => {
|
|
40
43
|
var _utils$interaction;
|
|
41
44
|
const postMessageToApp = utils === null || utils === void 0 || (_utils$interaction = utils.interaction) === null || _utils$interaction === void 0 || (_utils$interaction = _utils$interaction.utils) === null || _utils$interaction === void 0 ? void 0 : _utils$interaction.postMessageToApp;
|
|
42
45
|
if (typeof postMessageToApp !== "function") return;
|
|
43
|
-
console.log("postCartUpdateToCds data", data);
|
|
44
46
|
try {
|
|
45
47
|
postMessageToApp({
|
|
46
48
|
module: "cds",
|
|
@@ -159,107 +161,148 @@ const getProductFormatMessage = (cartLine, params) => {
|
|
|
159
161
|
appendBundleMessages(lines, product, currencySymbol);
|
|
160
162
|
return lines.length ? `${lines.join("\n")}\n` : "";
|
|
161
163
|
};
|
|
162
|
-
const collectDiscountFees = (product) => {
|
|
163
|
-
const discountList = toArray(product === null || product === void 0 ? void 0 : product.discount_list);
|
|
164
|
-
if (!discountList.length) return [];
|
|
165
|
-
return discountList.map((discount) => {
|
|
166
|
-
var _discount$discount;
|
|
167
|
-
return {
|
|
168
|
-
isReduce: (discount === null || discount === void 0 ? void 0 : discount.type) === "good_pass",
|
|
169
|
-
title: (discount === null || discount === void 0 || (_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.title) || "",
|
|
170
|
-
price: discount === null || discount === void 0 ? void 0 : discount.amount,
|
|
171
|
-
type: discount === null || discount === void 0 ? void 0 : discount.type
|
|
172
|
-
};
|
|
173
|
-
});
|
|
174
|
-
};
|
|
175
164
|
const isPendingWalletPayment = (payment) => {
|
|
176
165
|
const voucherId = payment === null || payment === void 0 ? void 0 : payment.voucher_id;
|
|
177
166
|
return (payment === null || payment === void 0 ? void 0 : payment.status) === "payment_pending" && voucherId !== void 0 && voucherId !== null && voucherId !== "" && Number(voucherId) !== 0;
|
|
178
167
|
};
|
|
179
|
-
const
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
168
|
+
const ORDER_PASS_TYPES = new Set(["good_pass", ...new Set(["discount_card", "product_discount_card"])]);
|
|
169
|
+
const WALLET_PAYMENT_CODES = new Set([
|
|
170
|
+
"PRODUCTVOUCHER",
|
|
171
|
+
"POINTCARD",
|
|
172
|
+
"GIFTCARD"
|
|
173
|
+
]);
|
|
174
|
+
const collectItemDiscountFees = (products) => {
|
|
175
|
+
const amount = products.reduce((total, product) => {
|
|
176
|
+
return toArray(product === null || product === void 0 ? void 0 : product.discount_list).filter((discount) => String((discount === null || discount === void 0 ? void 0 : discount.type) || "").toLowerCase() === "product").reduce((productTotal, discount) => productTotal.plus(toFiniteNumber(discount === null || discount === void 0 ? void 0 : discount.amount)), total);
|
|
177
|
+
}, new decimal_js.default(0));
|
|
178
|
+
if (!amount.gt(0)) return [];
|
|
179
|
+
return [{
|
|
180
|
+
isReduce: true,
|
|
181
|
+
title: callLocaleText("pisell2.big-sale.item-discount"),
|
|
182
|
+
price: amount.toNumber(),
|
|
183
|
+
type: "item_discount"
|
|
184
|
+
}];
|
|
196
185
|
};
|
|
197
|
-
const
|
|
198
|
-
|
|
186
|
+
const collectSurchargeFees = (summary) => {
|
|
187
|
+
const surchargeFees = toArray(summary === null || summary === void 0 ? void 0 : summary.surcharges).filter((surcharge) => toFiniteNumber(surcharge === null || surcharge === void 0 ? void 0 : surcharge.amount) > 0).map((surcharge) => ({
|
|
188
|
+
isReduce: false,
|
|
189
|
+
title: require_resolveLocalizedText.resolveLocalizedText(surcharge === null || surcharge === void 0 ? void 0 : surcharge.name) || callLocaleText("pisell2.sale-detail.surcharge"),
|
|
190
|
+
price: surcharge.amount,
|
|
191
|
+
type: "surcharge"
|
|
192
|
+
}));
|
|
193
|
+
if (surchargeFees.length) return surchargeFees;
|
|
194
|
+
if (toFiniteNumber(summary === null || summary === void 0 ? void 0 : summary.surcharge_fee) <= 0) return [];
|
|
195
|
+
return [{
|
|
196
|
+
isReduce: false,
|
|
197
|
+
title: callLocaleText("pisell2.sale-detail.surcharge"),
|
|
198
|
+
price: summary.surcharge_fee,
|
|
199
|
+
type: "surcharge"
|
|
200
|
+
}];
|
|
199
201
|
};
|
|
200
|
-
const
|
|
201
|
-
return toArray(
|
|
202
|
-
|
|
202
|
+
const collectOrderPassFees = (orderDiscounts) => {
|
|
203
|
+
return toArray(orderDiscounts).filter((discount) => {
|
|
204
|
+
const type = String((discount === null || discount === void 0 ? void 0 : discount.tag) || (discount === null || discount === void 0 ? void 0 : discount.type) || "").toLowerCase();
|
|
205
|
+
return ORDER_PASS_TYPES.has(type) && toFiniteNumber(discount === null || discount === void 0 ? void 0 : discount.savedAmount) > 0;
|
|
206
|
+
}).map((discount) => {
|
|
207
|
+
const type = String((discount === null || discount === void 0 ? void 0 : discount.tag) || (discount === null || discount === void 0 ? void 0 : discount.type) || "").toLowerCase();
|
|
208
|
+
return {
|
|
209
|
+
isReduce: true,
|
|
210
|
+
title: require_resolveLocalizedText.resolveLocalizedText(discount === null || discount === void 0 ? void 0 : discount.format_title),
|
|
211
|
+
price: discount === null || discount === void 0 ? void 0 : discount.savedAmount,
|
|
212
|
+
type: type === "good_pass" ? "good_pass" : "discount_card"
|
|
213
|
+
};
|
|
214
|
+
});
|
|
215
|
+
};
|
|
216
|
+
const collectWalletPaymentFees = (payments, locale) => {
|
|
217
|
+
return toArray(payments).filter((payment) => {
|
|
203
218
|
const code = String((payment === null || payment === void 0 ? void 0 : payment.code) || "").toUpperCase();
|
|
204
|
-
|
|
205
|
-
|
|
219
|
+
return isPendingWalletPayment(payment) && WALLET_PAYMENT_CODES.has(code);
|
|
220
|
+
}).map((payment) => {
|
|
221
|
+
var _payment$fund_record;
|
|
222
|
+
const methodName = require_useFixedPaymentMethodNameMap.resolveFixedPaymentMethodName(String((payment === null || payment === void 0 ? void 0 : payment.code) || "").toUpperCase(), locale);
|
|
223
|
+
const walletPassName = require_resolveLocalizedText.resolveLocalizedText(payment === null || payment === void 0 || (_payment$fund_record = payment.fund_record) === null || _payment$fund_record === void 0 ? void 0 : _payment$fund_record.wallet_pass_name);
|
|
224
|
+
const price = new decimal_js.default(toFiniteNumber(payment === null || payment === void 0 ? void 0 : payment.amount)).plus(toFiniteNumber(payment === null || payment === void 0 ? void 0 : payment.rounding_amount)).toFixed(2);
|
|
206
225
|
return {
|
|
226
|
+
isReduce: true,
|
|
207
227
|
title: walletPassName || methodName,
|
|
208
|
-
price
|
|
228
|
+
price,
|
|
209
229
|
type: "wallet_payment",
|
|
210
|
-
isReduce: true,
|
|
211
230
|
message: walletPassName && methodName && walletPassName !== methodName ? methodName : void 0
|
|
212
231
|
};
|
|
213
232
|
});
|
|
214
233
|
};
|
|
215
234
|
const buildCdsProductPayload = (cartLine, params) => {
|
|
216
|
-
var _product$
|
|
235
|
+
var _product$num, _note;
|
|
217
236
|
const { line, product } = cartLine;
|
|
218
237
|
const productFormatMessage = getProductFormatMessage(cartLine, params);
|
|
238
|
+
const price = toFiniteNumber(product === null || product === void 0 ? void 0 : product.selling_price);
|
|
239
|
+
const originalPrice = toFiniteNumber(product === null || product === void 0 ? void 0 : product.original_price, price);
|
|
219
240
|
const payload = {
|
|
220
241
|
productID: product === null || product === void 0 ? void 0 : product.product_id,
|
|
221
|
-
title: (product === null || product === void 0 ? void 0 : product.title)
|
|
242
|
+
title: require_resolveLocalizedText.resolveLocalizedText(product === null || product === void 0 ? void 0 : product.title),
|
|
222
243
|
cover: product === null || product === void 0 ? void 0 : product.cover,
|
|
223
|
-
price
|
|
244
|
+
price,
|
|
224
245
|
buyCount: (_product$num = product === null || product === void 0 ? void 0 : product.num) !== null && _product$num !== void 0 ? _product$num : 0,
|
|
225
246
|
productFormatMessage,
|
|
226
247
|
note: (_note = line === null || line === void 0 ? void 0 : line.note) !== null && _note !== void 0 ? _note : product === null || product === void 0 ? void 0 : product.note,
|
|
227
248
|
isWeightProduct: (0, _pisell_utils.resolveWeighingSnapshot)(product) ? 1 : 0
|
|
228
249
|
};
|
|
229
|
-
if (
|
|
230
|
-
var _product$original_pri;
|
|
231
|
-
payload.modifyPrice = Number((_product$original_pri = product === null || product === void 0 ? void 0 : product.original_price) !== null && _product$original_pri !== void 0 ? _product$original_pri : 0);
|
|
232
|
-
}
|
|
250
|
+
if (originalPrice !== price) payload.modifyPrice = originalPrice;
|
|
233
251
|
return payload;
|
|
234
252
|
};
|
|
235
253
|
const buildCartUpdatePayload = (context, params) => {
|
|
236
|
-
var _context$summary, _context$sales,
|
|
254
|
+
var _context$summary, _context$sales, _context$sales2, _bookingTicket$getOrd, _amountSnapshot$summa, _bookingTicket$getTem, _summary$product_orig, _context$cart, _ref, _amountSnapshot$total, _amountSnapshot$summa2, _amountSnapshot$summa3;
|
|
237
255
|
const cartLines = getCartProductLines(context === null || context === void 0 ? void 0 : context.cart);
|
|
238
256
|
if (!cartLines.length) return require_objectSpread2._objectSpread2({ currency_symbol: params.currencySymbol }, EMPTY_CART_UPDATE);
|
|
239
|
-
const
|
|
240
|
-
const
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
const summary = (
|
|
245
|
-
const
|
|
246
|
-
const
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
257
|
+
const products = cartLines.map((cartLine) => buildCdsProductPayload(cartLine, params));
|
|
258
|
+
const contextSummary = (_context$summary = context.summary) === null || _context$summary === void 0 ? void 0 : _context$summary.summary;
|
|
259
|
+
const tempOrder = (_context$sales = context.sales) === null || _context$sales === void 0 ? void 0 : _context$sales.tempOrder;
|
|
260
|
+
const bookingTicket = (_context$sales2 = context.sales) === null || _context$sales2 === void 0 ? void 0 : _context$sales2.bookingTicket;
|
|
261
|
+
const amountSnapshot = bookingTicket === null || bookingTicket === void 0 || (_bookingTicket$getOrd = bookingTicket.getOrderAmountSnapshot) === null || _bookingTicket$getOrd === void 0 ? void 0 : _bookingTicket$getOrd.call(bookingTicket);
|
|
262
|
+
const summary = (_amountSnapshot$summa = amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.summary) !== null && _amountSnapshot$summa !== void 0 ? _amountSnapshot$summa : contextSummary;
|
|
263
|
+
const currentTempOrder = (bookingTicket === null || bookingTicket === void 0 || (_bookingTicket$getTem = bookingTicket.getTempOrder) === null || _bookingTicket$getTem === void 0 ? void 0 : _bookingTicket$getTem.call(bookingTicket)) || tempOrder;
|
|
264
|
+
const payments = currentTempOrder === null || currentTempOrder === void 0 ? void 0 : currentTempOrder.payments;
|
|
265
|
+
const isTaxIncluded = Number(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.is_price_include_tax) === 1;
|
|
266
|
+
const cartProducts = cartLines.map((cartLine) => cartLine.product);
|
|
267
|
+
const fees = [
|
|
268
|
+
{
|
|
269
|
+
title: callLocaleText("pisell2.big-sale.subtotal"),
|
|
270
|
+
price: (_summary$product_orig = summary === null || summary === void 0 ? void 0 : summary.product_original_amount) !== null && _summary$product_orig !== void 0 ? _summary$product_orig : "0",
|
|
271
|
+
type: "subtotal",
|
|
272
|
+
message: callLocaleText("pisell2.big-sale.cart-items", products.length)
|
|
273
|
+
},
|
|
274
|
+
...collectItemDiscountFees(cartProducts),
|
|
275
|
+
...collectSurchargeFees(summary)
|
|
276
|
+
];
|
|
277
|
+
if (toFiniteNumber(summary === null || summary === void 0 ? void 0 : summary.tax_fee) > 0) {
|
|
278
|
+
const taxTitle = require_resolveLocalizedText.resolveLocalizedText(summary === null || summary === void 0 ? void 0 : summary.tax_title) || callLocaleText("pisell2.sale-detail.tax");
|
|
279
|
+
const taxIncludedTitle = callLocaleText(isTaxIncluded ? "pisell2.big-sale.tax-included" : "pisell2.big-sale.tax-not-included");
|
|
280
|
+
fees.push({
|
|
281
|
+
isReduce: false,
|
|
282
|
+
title: `${taxTitle} (${taxIncludedTitle})`,
|
|
283
|
+
price: summary === null || summary === void 0 ? void 0 : summary.tax_fee,
|
|
284
|
+
type: "tax"
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
const cartOrderPassFees = collectOrderPassFees(context === null || context === void 0 || (_context$cart = context.cart) === null || _context$cart === void 0 ? void 0 : _context$cart.discountList);
|
|
288
|
+
fees.push(...cartOrderPassFees.length ? cartOrderPassFees : collectOrderPassFees(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.discount_list));
|
|
289
|
+
if (toFiniteNumber(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.shop_discount) > 0) fees.push({
|
|
290
|
+
isReduce: true,
|
|
291
|
+
title: callLocaleText("pisell2.sale-detail.manual-order-adjustment"),
|
|
292
|
+
price: tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.shop_discount,
|
|
293
|
+
type: "order_discount"
|
|
253
294
|
});
|
|
254
|
-
|
|
295
|
+
fees.push(...collectWalletPaymentFees(payments, params.locale));
|
|
296
|
+
const effectiveAmountDue = require_utils.resolveEffectiveSaleDetailAmountDue({
|
|
297
|
+
baseSalesAmountGap: amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap,
|
|
255
298
|
amountGap: summary === null || summary === void 0 ? void 0 : summary.amount_gap,
|
|
256
|
-
fallbackAmount: (
|
|
257
|
-
orderPaidAmount: summary === null || summary === void 0 ? void 0 : summary.order_paid_amount,
|
|
299
|
+
fallbackAmount: (_ref = (_amountSnapshot$total = amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.totalAmount) !== null && _amountSnapshot$total !== void 0 ? _amountSnapshot$total : summary === null || summary === void 0 ? void 0 : summary.total_amount) !== null && _ref !== void 0 ? _ref : summary === null || summary === void 0 ? void 0 : summary.expect_amount,
|
|
300
|
+
orderPaidAmount: (_amountSnapshot$summa2 = amountSnapshot === null || amountSnapshot === void 0 || (_amountSnapshot$summa3 = amountSnapshot.summary) === null || _amountSnapshot$summa3 === void 0 ? void 0 : _amountSnapshot$summa3.order_paid_amount) !== null && _amountSnapshot$summa2 !== void 0 ? _amountSnapshot$summa2 : summary === null || summary === void 0 ? void 0 : summary.order_paid_amount,
|
|
258
301
|
payments
|
|
259
|
-
})
|
|
302
|
+
});
|
|
260
303
|
return {
|
|
261
304
|
currency_symbol: params.currencySymbol,
|
|
262
|
-
total: effectiveAmountDue
|
|
305
|
+
total: effectiveAmountDue.toFixed(2),
|
|
263
306
|
products,
|
|
264
307
|
fees
|
|
265
308
|
};
|
|
@@ -268,7 +311,7 @@ const buildCartUpdatePayload = (context, params) => {
|
|
|
268
311
|
* Standard 大促模板购物车变更时,向 Native CDS 同步购物车快照。
|
|
269
312
|
*/
|
|
270
313
|
function useSyncBigSaleCartToCds(context, options = {}) {
|
|
271
|
-
var _context$
|
|
314
|
+
var _context$cart2, _context$cart3, _context$cart4, _context$cart5, _context$summary2, _context$sales3, _context$sales4, _context$sales5, _context$sales7;
|
|
272
315
|
const engineContext = require_useEngineContext.default();
|
|
273
316
|
const { enabled = true } = options;
|
|
274
317
|
(0, react.useEffect)(() => {
|
|
@@ -281,13 +324,37 @@ function useSyncBigSaleCartToCds(context, options = {}) {
|
|
|
281
324
|
locale
|
|
282
325
|
}));
|
|
283
326
|
}, [
|
|
284
|
-
context === null || context === void 0 || (_context$
|
|
285
|
-
context === null || context === void 0 || (_context$
|
|
286
|
-
context === null || context === void 0 || (_context$
|
|
327
|
+
context === null || context === void 0 || (_context$cart2 = context.cart) === null || _context$cart2 === void 0 ? void 0 : _context$cart2.bookings,
|
|
328
|
+
context === null || context === void 0 || (_context$cart3 = context.cart) === null || _context$cart3 === void 0 ? void 0 : _context$cart3.discountList,
|
|
329
|
+
context === null || context === void 0 || (_context$cart4 = context.cart) === null || _context$cart4 === void 0 ? void 0 : _context$cart4.displayLines,
|
|
330
|
+
context === null || context === void 0 || (_context$cart5 = context.cart) === null || _context$cart5 === void 0 ? void 0 : _context$cart5.items,
|
|
287
331
|
context === null || context === void 0 || (_context$summary2 = context.summary) === null || _context$summary2 === void 0 ? void 0 : _context$summary2.summary,
|
|
288
|
-
context === null || context === void 0 || (_context$
|
|
289
|
-
context === null || context === void 0 || (_context$
|
|
290
|
-
context === null || context === void 0 || (_context$
|
|
332
|
+
context === null || context === void 0 || (_context$sales3 = context.sales) === null || _context$sales3 === void 0 ? void 0 : _context$sales3.tempOrder,
|
|
333
|
+
context === null || context === void 0 || (_context$sales4 = context.sales) === null || _context$sales4 === void 0 || (_context$sales4 = _context$sales4.tempOrder) === null || _context$sales4 === void 0 ? void 0 : _context$sales4.payments,
|
|
334
|
+
context === null || context === void 0 || (_context$sales5 = context.sales) === null || _context$sales5 === void 0 ? void 0 : _context$sales5.bookingTicket,
|
|
335
|
+
engineContext,
|
|
336
|
+
enabled
|
|
337
|
+
]);
|
|
338
|
+
(0, react.useEffect)(() => {
|
|
339
|
+
var _context$sales6, _engineContext$appHel2;
|
|
340
|
+
if (!enabled) return void 0;
|
|
341
|
+
const bookingTicket = context === null || context === void 0 || (_context$sales6 = context.sales) === null || _context$sales6 === void 0 ? void 0 : _context$sales6.bookingTicket;
|
|
342
|
+
if (!bookingTicket || typeof bookingTicket.effectsOn !== "function") return;
|
|
343
|
+
const utils = (engineContext === null || engineContext === void 0 || (_engineContext$appHel2 = engineContext.appHelper) === null || _engineContext$appHel2 === void 0 ? void 0 : _engineContext$appHel2.utils) || {};
|
|
344
|
+
const off = bookingTicket.effectsOn("onTempOrderReplaced", () => {
|
|
345
|
+
var _bookingTicket$getTem2;
|
|
346
|
+
const tempOrder = (_bookingTicket$getTem2 = bookingTicket.getTempOrder) === null || _bookingTicket$getTem2 === void 0 ? void 0 : _bookingTicket$getTem2.call(bookingTicket);
|
|
347
|
+
if (!tempOrder) return;
|
|
348
|
+
if (toArray(tempOrder.products).length > 0 || toArray(tempOrder.bookings).length > 0) return;
|
|
349
|
+
postCartUpdateToCds(utils, require_objectSpread2._objectSpread2({ currency_symbol: getCurrencySymbol(utils) }, EMPTY_CART_UPDATE));
|
|
350
|
+
});
|
|
351
|
+
return () => {
|
|
352
|
+
try {
|
|
353
|
+
off();
|
|
354
|
+
} catch (_unused) {}
|
|
355
|
+
};
|
|
356
|
+
}, [
|
|
357
|
+
context === null || context === void 0 || (_context$sales7 = context.sales) === null || _context$sales7 === void 0 ? void 0 : _context$sales7.bookingTicket,
|
|
291
358
|
engineContext,
|
|
292
359
|
enabled
|
|
293
360
|
]);
|
|
@@ -75,6 +75,9 @@ var locales_default = {
|
|
|
75
75
|
"pisell2.big-sale.action.checkout-cart": "Checkout",
|
|
76
76
|
"pisell2.big-sale.cart-items": (number) => `${number}items`,
|
|
77
77
|
"pisell2.big-sale.subtotal": "Subtotal",
|
|
78
|
+
"pisell2.big-sale.item-discount": "Item discount",
|
|
79
|
+
"pisell2.big-sale.tax-included": "Included",
|
|
80
|
+
"pisell2.big-sale.tax-not-included": "Not included",
|
|
78
81
|
"pisell2.big-sale.hour-minute": (hour, minute) => {
|
|
79
82
|
if (hour <= 0 && minute <= 0) return `0min`;
|
|
80
83
|
return `${hour > 0 ? `${hour}h` : ""}${hour > 0 && minute > 0 ? " " : ""}${minute > 0 ? `${minute}min` : ""}`;
|
|
@@ -181,6 +184,9 @@ var locales_default = {
|
|
|
181
184
|
"pisell2.big-sale.action.checkout-cart": "结账",
|
|
182
185
|
"pisell2.big-sale.cart-items": (number) => `${number}件商品`,
|
|
183
186
|
"pisell2.big-sale.subtotal": "小计",
|
|
187
|
+
"pisell2.big-sale.item-discount": "商品折扣",
|
|
188
|
+
"pisell2.big-sale.tax-included": "已包含",
|
|
189
|
+
"pisell2.big-sale.tax-not-included": "未包含",
|
|
184
190
|
"pisell2.big-sale.hour-minute": (hour, minute) => {
|
|
185
191
|
if (hour <= 0 && minute <= 0) return `0分钟`;
|
|
186
192
|
return `${hour > 0 ? `${hour}小时` : ""}${minute > 0 ? `${minute}分钟` : ""}`;
|
|
@@ -287,6 +293,9 @@ var locales_default = {
|
|
|
287
293
|
"pisell2.big-sale.action.checkout-cart": "結賬",
|
|
288
294
|
"pisell2.big-sale.cart-items": (number) => `${number}件商品`,
|
|
289
295
|
"pisell2.big-sale.subtotal": "小計",
|
|
296
|
+
"pisell2.big-sale.item-discount": "商品折扣",
|
|
297
|
+
"pisell2.big-sale.tax-included": "已包含",
|
|
298
|
+
"pisell2.big-sale.tax-not-included": "未包含",
|
|
290
299
|
"pisell2.big-sale.hour-minute": (hour, minute) => {
|
|
291
300
|
if (hour <= 0 && minute <= 0) return `0分鐘`;
|
|
292
301
|
return `${hour > 0 ? `${hour}小時` : ""}${minute > 0 ? `${minute}分鐘` : ""}`;
|
|
@@ -393,6 +402,9 @@ var locales_default = {
|
|
|
393
402
|
"pisell2.big-sale.action.checkout-cart": "チェックアウト",
|
|
394
403
|
"pisell2.big-sale.cart-items": (number) => `${number}件`,
|
|
395
404
|
"pisell2.big-sale.subtotal": "小計",
|
|
405
|
+
"pisell2.big-sale.item-discount": "商品割引",
|
|
406
|
+
"pisell2.big-sale.tax-included": "税込み",
|
|
407
|
+
"pisell2.big-sale.tax-not-included": "税別",
|
|
396
408
|
"pisell2.big-sale.hour-minute": (hour, minute) => {
|
|
397
409
|
if (hour <= 0 && minute <= 0) return `0分`;
|
|
398
410
|
return `${hour > 0 ? `${hour}時間` : ""}${hour > 0 && minute > 0 ? " " : ""}${minute > 0 ? `${minute}分` : ""}`;
|
|
@@ -499,6 +511,9 @@ var locales_default = {
|
|
|
499
511
|
"pisell2.big-sale.action.checkout-cart": "Checkout",
|
|
500
512
|
"pisell2.big-sale.cart-items": (number) => `${number}itens`,
|
|
501
513
|
"pisell2.big-sale.subtotal": "Subtotal",
|
|
514
|
+
"pisell2.big-sale.item-discount": "Desconto de item",
|
|
515
|
+
"pisell2.big-sale.tax-included": "Incluído",
|
|
516
|
+
"pisell2.big-sale.tax-not-included": "Não incluído",
|
|
502
517
|
"pisell2.big-sale.hour-minute": (hour, minute) => {
|
|
503
518
|
if (hour <= 0 && minute <= 0) return `0min`;
|
|
504
519
|
return `${hour > 0 ? `${hour}h` : ""}${hour > 0 && minute > 0 ? " " : ""}${minute > 0 ? `${minute}min` : ""}`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pisell/private-materials",
|
|
3
|
-
"version": "6.11.
|
|
3
|
+
"version": "6.11.659",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"module": "./es/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -69,11 +69,11 @@
|
|
|
69
69
|
"react-zoom-pan-pinch": "^3.7.0",
|
|
70
70
|
"styled-components": "^6.0.0-rc.3",
|
|
71
71
|
"use-sync-external-store": "^1.6.0",
|
|
72
|
-
"@pisell/date-picker": "3.0.10",
|
|
73
|
-
"@pisell/icon": "0.0.11",
|
|
74
|
-
"@pisell/utils": "3.0.4",
|
|
75
72
|
"@pisell/pi-payment-sdk": "0.0.3",
|
|
76
|
-
"@pisell/
|
|
73
|
+
"@pisell/utils": "3.0.4",
|
|
74
|
+
"@pisell/materials": "6.11.256",
|
|
75
|
+
"@pisell/icon": "0.0.11",
|
|
76
|
+
"@pisell/date-picker": "3.0.10"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
79
|
"react": "^18.0.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|