@pisell/private-materials 6.12.371 → 6.12.373
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 +1 -1
- package/build/lowcode/view.js +1 -1
- package/es/plus/salesSdk/utils/resolveLocalizedText.js +1 -1
- package/es/pro/compensatedPisellContainer/floatingLayer/index.js +74 -59
- package/es/pro/compensatedPisellContainer/floatingLayer/observeTransitions.js +65 -0
- package/es/pro/skuDetailModal/index.js +53 -65
- package/lib/plus/salesSdk/utils/resolveLocalizedText.js +1 -1
- package/lib/pro/compensatedPisellContainer/floatingLayer/index.js +73 -58
- package/lib/pro/compensatedPisellContainer/floatingLayer/observeTransitions.js +65 -0
- package/lib/pro/skuDetailModal/index.js +53 -65
- package/package.json +3 -3
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
//#region src/pro/compensatedPisellContainer/floatingLayer/observeTransitions.ts
|
|
2
|
+
/** Observe only the shell's own transitions, never animations inside its content. */
|
|
3
|
+
const observeTransitions = (elements, onSettled) => {
|
|
4
|
+
let disposed = false;
|
|
5
|
+
let frame;
|
|
6
|
+
const pendingEvents = /* @__PURE__ */ new Map();
|
|
7
|
+
const supportsAnimations = elements.every((element) => typeof element.getAnimations === "function");
|
|
8
|
+
const isMotionProperty = (property) => property === "opacity" || property === "transform";
|
|
9
|
+
const check = () => {
|
|
10
|
+
if (disposed) return;
|
|
11
|
+
if (supportsAnimations) {
|
|
12
|
+
const transitions = [];
|
|
13
|
+
elements.forEach((element) => {
|
|
14
|
+
transitions.push(...element.getAnimations().filter((animation) => isMotionProperty(animation.transitionProperty) && animation.playState !== "finished" && animation.playState !== "idle"));
|
|
15
|
+
});
|
|
16
|
+
if (transitions.length) {
|
|
17
|
+
Promise.all(transitions.map((animation) => animation.finished.catch(() => void 0))).then(check);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
} else if ([...pendingEvents.values()].some((properties) => properties.size)) return;
|
|
21
|
+
disposed = true;
|
|
22
|
+
removeListeners();
|
|
23
|
+
onSettled();
|
|
24
|
+
};
|
|
25
|
+
const scheduleCheck = () => {
|
|
26
|
+
if (frame !== void 0) cancelAnimationFrame(frame);
|
|
27
|
+
frame = requestAnimationFrame(check);
|
|
28
|
+
};
|
|
29
|
+
const handleTransition = (event) => {
|
|
30
|
+
const transition = event;
|
|
31
|
+
if (event.target !== event.currentTarget || !isMotionProperty(transition.propertyName)) return;
|
|
32
|
+
const element = event.currentTarget;
|
|
33
|
+
const properties = pendingEvents.get(element);
|
|
34
|
+
if (event.type === "transitionrun") properties.add(transition.propertyName);
|
|
35
|
+
else {
|
|
36
|
+
properties.delete(transition.propertyName);
|
|
37
|
+
scheduleCheck();
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const removeListeners = () => {
|
|
41
|
+
elements.forEach((element) => {
|
|
42
|
+
element.removeEventListener("transitionrun", handleTransition);
|
|
43
|
+
element.removeEventListener("transitionend", handleTransition);
|
|
44
|
+
element.removeEventListener("transitioncancel", handleTransition);
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
elements.forEach((element) => {
|
|
48
|
+
pendingEvents.set(element, /* @__PURE__ */ new Set());
|
|
49
|
+
if (!supportsAnimations) {
|
|
50
|
+
element.addEventListener("transitionrun", handleTransition);
|
|
51
|
+
element.addEventListener("transitionend", handleTransition);
|
|
52
|
+
element.addEventListener("transitioncancel", handleTransition);
|
|
53
|
+
}
|
|
54
|
+
element.getBoundingClientRect();
|
|
55
|
+
});
|
|
56
|
+
if (supportsAnimations) Promise.resolve().then(check);
|
|
57
|
+
else frame = requestAnimationFrame(scheduleCheck);
|
|
58
|
+
return () => {
|
|
59
|
+
disposed = true;
|
|
60
|
+
if (frame !== void 0) cancelAnimationFrame(frame);
|
|
61
|
+
removeListeners();
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
//#endregion
|
|
65
|
+
exports.observeTransitions = observeTransitions;
|
|
@@ -81,16 +81,6 @@ const getBodyScaleY = () => {
|
|
|
81
81
|
const matrix = new DOMMatrixReadOnly(transform);
|
|
82
82
|
return Math.sqrt(matrix.c * matrix.c + matrix.d * matrix.d) || 1;
|
|
83
83
|
};
|
|
84
|
-
const waitForModalEntranceFrame = () => {
|
|
85
|
-
if (typeof window === "undefined") return Promise.resolve();
|
|
86
|
-
return new Promise((resolve) => {
|
|
87
|
-
requestAnimationFrame(() => {
|
|
88
|
-
requestAnimationFrame(() => {
|
|
89
|
-
window.setTimeout(() => resolve(), 10);
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
};
|
|
94
84
|
const toValidDayjs = (value) => {
|
|
95
85
|
if (!value) return null;
|
|
96
86
|
const parsed = (0, dayjs.default)(value);
|
|
@@ -204,6 +194,8 @@ const SkuDetailModal = ({ onConfirm, onRemove, onClose, resolveProductData, reso
|
|
|
204
194
|
const inventory = (0, react.useContext)(require_context.SalesInventoryContext);
|
|
205
195
|
const [baseProductData, setProductData] = (0, react.useState)(null);
|
|
206
196
|
const [detailLoading, setDetailLoading] = (0, react.useState)(false);
|
|
197
|
+
const [modalEntered, setModalEntered] = (0, react.useState)(false);
|
|
198
|
+
const detailContentLoading = detailLoading || !modalEntered;
|
|
207
199
|
const [appearanceConfirmPending, setAppearanceConfirmPending] = (0, react.useState)(false);
|
|
208
200
|
const appearanceConfirmTaskRef = (0, react.useRef)(null);
|
|
209
201
|
const [note, setNote] = (0, react.useState)("");
|
|
@@ -520,7 +512,7 @@ const SkuDetailModal = ({ onConfirm, onRemove, onClose, resolveProductData, reso
|
|
|
520
512
|
updateSelectionFlowCanScrollDown(canScrollDown);
|
|
521
513
|
}, [resolveSelectionFlowScrollContainer, updateSelectionFlowCanScrollDown]);
|
|
522
514
|
(0, react.useLayoutEffect)(() => {
|
|
523
|
-
if (!open || !isMobile ||
|
|
515
|
+
if (!open || !isMobile || detailContentLoading || !productData) {
|
|
524
516
|
updateSelectionFlowCanScrollDown(false);
|
|
525
517
|
return;
|
|
526
518
|
}
|
|
@@ -570,7 +562,7 @@ const SkuDetailModal = ({ onConfirm, onRemove, onClose, resolveProductData, reso
|
|
|
570
562
|
};
|
|
571
563
|
}, [
|
|
572
564
|
currentStep,
|
|
573
|
-
|
|
565
|
+
detailContentLoading,
|
|
574
566
|
isCustomSelectionFlow,
|
|
575
567
|
isKioskPlatform,
|
|
576
568
|
isMobile,
|
|
@@ -986,8 +978,8 @@ const SkuDetailModal = ({ onConfirm, onRemove, onClose, resolveProductData, reso
|
|
|
986
978
|
});
|
|
987
979
|
},
|
|
988
980
|
open: function() {
|
|
989
|
-
var
|
|
990
|
-
var _product_id, _selectionFlowService2, _noteDiagnosticsRef$c2, _product_id2, _enrichmentAbortRef$c2, _skuDetailConfig$enab, _skuDetailConfig$isSh, _skuDetailConfig$isSh2, _skuDetailConfig$isSh3, _skuDetailConfig$isSh4, _skuDetailConfig$isSh5, _skuDetailConfig$hide, _skuDetailConfig$isSh6, _skuDetailConfig$isSh7, _skuDetailConfig$isSh8, _skuDetailConfig$exte, _skuDetailConfig$useC, _skuDetailConfig$cust, _skuDetailConfig$isCa, _skuDetailConfig, _skuDetailConfig2, _data$bundle_group, _data$_extend, _data$_extend2, _data$discount_list,
|
|
981
|
+
var _ref18 = require_asyncToGenerator._asyncToGenerator(function* (data) {
|
|
982
|
+
var _product_id, _selectionFlowService2, _noteDiagnosticsRef$c2, _product_id2, _enrichmentAbortRef$c2, _skuDetailConfig$enab, _skuDetailConfig$isSh, _skuDetailConfig$isSh2, _skuDetailConfig$isSh3, _skuDetailConfig$isSh4, _skuDetailConfig$isSh5, _skuDetailConfig$hide, _skuDetailConfig$isSh6, _skuDetailConfig$isSh7, _skuDetailConfig$isSh8, _skuDetailConfig$exte, _skuDetailConfig$useC, _skuDetailConfig$cust, _skuDetailConfig$isCa, _skuDetailConfig, _skuDetailConfig2, _data$bundle_group, _data$_extend, _data$_extend2, _data$discount_list, _ref16, _data$_extend3, _data$_extend4, _data$_extend5, _data$discount_list$f, _data$discount_list2, _ref17, _data$_extend$priceOv, _data$_extend7;
|
|
991
983
|
const shownLog = {
|
|
992
984
|
product_id: String((_product_id = data.product_id) !== null && _product_id !== void 0 ? _product_id : data.id),
|
|
993
985
|
mode: ((_selectionFlowService2 = data.selectionFlowServices) === null || _selectionFlowService2 === void 0 ? void 0 : _selectionFlowService2.selectionFlowMode) || ("date" in data && !("_extend" in data) ? "create" : "edit"),
|
|
@@ -1011,18 +1003,12 @@ const SkuDetailModal = ({ onConfirm, onRemove, onClose, resolveProductData, reso
|
|
|
1011
1003
|
setInventorySelectorSnapshot(null);
|
|
1012
1004
|
flowDateHydrationVersionRef.current += 1;
|
|
1013
1005
|
const isCurrentOpenTask = () => openTaskIdRef.current === currentTaskId;
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
return isCurrentOpenTask();
|
|
1021
|
-
});
|
|
1022
|
-
return function showModalShellBeforeHydration() {
|
|
1023
|
-
return _ref8.apply(this, arguments);
|
|
1024
|
-
};
|
|
1025
|
-
}();
|
|
1006
|
+
if (!open) setModalEntered(false);
|
|
1007
|
+
const showModalShellBeforeHydration = () => {
|
|
1008
|
+
setProductData(null);
|
|
1009
|
+
setDetailLoading(true);
|
|
1010
|
+
setOpen(true);
|
|
1011
|
+
};
|
|
1026
1012
|
setCurrentStep(0);
|
|
1027
1013
|
lateQuantityReviewStepIndexRef.current = null;
|
|
1028
1014
|
lateQuantityRevalidationTaskRef.current = null;
|
|
@@ -1083,7 +1069,7 @@ const SkuDetailModal = ({ onConfirm, onRemove, onClose, resolveProductData, reso
|
|
|
1083
1069
|
};
|
|
1084
1070
|
setSkuDetailConfig(config);
|
|
1085
1071
|
if ("date" in data && !("_extend" in data)) {
|
|
1086
|
-
var _data$is_eject2,
|
|
1072
|
+
var _data$is_eject2, _ref8, _ref9, _initialExtend$price, _data$productData2, _apiData$duration, _apiData$schedules, _apiData$scheduleIds, _apiData$extension_ty, _ref10, _variantData$variant_, _ref11, _variantData$variant, _apiData$option_group, _apiData$bundle_group, _apiData$product_reso, _apiData$holder_confi, _ref12, _data$initialQuantity, _initialExtend$price2, _initialExtend$total, _initialExtend$origin, _ref13, _initialExtend$note, _ref14, _is_eject, _ref15, _hydratedExtend$quant, _hydratedExtend$price;
|
|
1087
1073
|
logger === null || logger === void 0 || logger.addLog({
|
|
1088
1074
|
type: "info",
|
|
1089
1075
|
title: "sku_detail_modal_open_create",
|
|
@@ -1091,9 +1077,8 @@ const SkuDetailModal = ({ onConfirm, onRemove, onClose, resolveProductData, reso
|
|
|
1091
1077
|
});
|
|
1092
1078
|
openParamsRef.current = data;
|
|
1093
1079
|
const shouldOpenBeforeHydration = hasConfiguredSelectionFlow || Number((_data$is_eject2 = data.is_eject) !== null && _data$is_eject2 !== void 0 ? _data$is_eject2 : 0) === 1 || require_utils$4.isWeighingProduct(data.productData);
|
|
1094
|
-
if (shouldOpenBeforeHydration)
|
|
1095
|
-
|
|
1096
|
-
} else {
|
|
1080
|
+
if (shouldOpenBeforeHydration) showModalShellBeforeHydration();
|
|
1081
|
+
else {
|
|
1097
1082
|
setOpen(false);
|
|
1098
1083
|
setProductData(null);
|
|
1099
1084
|
setDetailLoading(false);
|
|
@@ -1114,7 +1099,7 @@ const SkuDetailModal = ({ onConfirm, onRemove, onClose, resolveProductData, reso
|
|
|
1114
1099
|
if ((config === null || config === void 0 ? void 0 : config.useCustomData) && (config === null || config === void 0 ? void 0 : config.customData)) apiData = require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, apiData), (config === null || config === void 0 ? void 0 : config.customData) || {});
|
|
1115
1100
|
const initialCacheItem = data.initialCacheItem;
|
|
1116
1101
|
const initialExtend = (initialCacheItem === null || initialCacheItem === void 0 ? void 0 : initialCacheItem._extend) || {};
|
|
1117
|
-
const basePrice = Number((
|
|
1102
|
+
const basePrice = Number((_ref8 = (_ref9 = (_initialExtend$price = initialExtend.price) !== null && _initialExtend$price !== void 0 ? _initialExtend$price : apiData === null || apiData === void 0 ? void 0 : apiData.price) !== null && _ref9 !== void 0 ? _ref9 : initialCacheItem === null || initialCacheItem === void 0 ? void 0 : initialCacheItem.price) !== null && _ref8 !== void 0 ? _ref8 : 0);
|
|
1118
1103
|
let variantData = formatVariant(config, data === null || data === void 0 || (_data$productData2 = data.productData) === null || _data$productData2 === void 0 ? void 0 : _data$productData2.variant, apiData);
|
|
1119
1104
|
const initialSkuValue = require_resolveSkuValue.resolveSkuValueCandidates([
|
|
1120
1105
|
initialExtend.skuValue,
|
|
@@ -1134,8 +1119,8 @@ const SkuDetailModal = ({ onConfirm, onRemove, onClose, resolveProductData, reso
|
|
|
1134
1119
|
schedules: (_apiData$schedules = apiData === null || apiData === void 0 ? void 0 : apiData.schedules) !== null && _apiData$schedules !== void 0 ? _apiData$schedules : initialCacheItem === null || initialCacheItem === void 0 ? void 0 : initialCacheItem.schedules,
|
|
1135
1120
|
"schedule.ids": (_apiData$scheduleIds = apiData === null || apiData === void 0 ? void 0 : apiData["schedule.ids"]) !== null && _apiData$scheduleIds !== void 0 ? _apiData$scheduleIds : initialCacheItem === null || initialCacheItem === void 0 ? void 0 : initialCacheItem["schedule.ids"],
|
|
1136
1121
|
extension_type: (_apiData$extension_ty = apiData === null || apiData === void 0 ? void 0 : apiData.extension_type) !== null && _apiData$extension_ty !== void 0 ? _apiData$extension_ty : initialCacheItem === null || initialCacheItem === void 0 ? void 0 : initialCacheItem.extension_type,
|
|
1137
|
-
variant_group: (
|
|
1138
|
-
variant: (
|
|
1122
|
+
variant_group: (_ref10 = (_variantData$variant_ = variantData === null || variantData === void 0 ? void 0 : variantData.variant_group) !== null && _variantData$variant_ !== void 0 ? _variantData$variant_ : apiData === null || apiData === void 0 ? void 0 : apiData.variant_group) !== null && _ref10 !== void 0 ? _ref10 : initialCacheItem === null || initialCacheItem === void 0 ? void 0 : initialCacheItem.variant_group,
|
|
1123
|
+
variant: (_ref11 = (_variantData$variant = variantData === null || variantData === void 0 ? void 0 : variantData.variant) !== null && _variantData$variant !== void 0 ? _variantData$variant : apiData === null || apiData === void 0 ? void 0 : apiData.variant) !== null && _ref11 !== void 0 ? _ref11 : initialCacheItem === null || initialCacheItem === void 0 ? void 0 : initialCacheItem.variant,
|
|
1139
1124
|
option_group: (_apiData$option_group = apiData === null || apiData === void 0 ? void 0 : apiData.option_group) !== null && _apiData$option_group !== void 0 ? _apiData$option_group : initialCacheItem === null || initialCacheItem === void 0 ? void 0 : initialCacheItem.option_group,
|
|
1140
1125
|
bundle_group: (_apiData$bundle_group = apiData === null || apiData === void 0 ? void 0 : apiData.bundle_group) !== null && _apiData$bundle_group !== void 0 ? _apiData$bundle_group : initialCacheItem === null || initialCacheItem === void 0 ? void 0 : initialCacheItem.bundle_group,
|
|
1141
1126
|
product_resource: (_apiData$product_reso = apiData === null || apiData === void 0 ? void 0 : apiData.product_resource) !== null && _apiData$product_reso !== void 0 ? _apiData$product_reso : initialCacheItem === null || initialCacheItem === void 0 ? void 0 : initialCacheItem.product_resource
|
|
@@ -1143,11 +1128,11 @@ const SkuDetailModal = ({ onConfirm, onRemove, onClose, resolveProductData, reso
|
|
|
1143
1128
|
_data: require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, (apiData === null || apiData === void 0 ? void 0 : apiData._data) || {}), (initialCacheItem === null || initialCacheItem === void 0 ? void 0 : initialCacheItem._data) || {}),
|
|
1144
1129
|
_extend: require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, (apiData === null || apiData === void 0 ? void 0 : apiData._extend) || {}), initialExtend), {}, {
|
|
1145
1130
|
product_name: resolveDisplayText(initialExtend.product_name || (apiData === null || apiData === void 0 ? void 0 : apiData.title) || (apiData === null || apiData === void 0 ? void 0 : apiData.product_name)),
|
|
1146
|
-
quantity: (
|
|
1131
|
+
quantity: (_ref12 = (_data$initialQuantity = data.initialQuantity) !== null && _data$initialQuantity !== void 0 ? _data$initialQuantity : initialExtend.quantity) !== null && _ref12 !== void 0 ? _ref12 : 1,
|
|
1147
1132
|
price: (_initialExtend$price2 = initialExtend.price) !== null && _initialExtend$price2 !== void 0 ? _initialExtend$price2 : basePrice,
|
|
1148
1133
|
total: (_initialExtend$total = initialExtend.total) !== null && _initialExtend$total !== void 0 ? _initialExtend$total : basePrice,
|
|
1149
1134
|
origin_total: (_initialExtend$origin = initialExtend.origin_total) !== null && _initialExtend$origin !== void 0 ? _initialExtend$origin : basePrice,
|
|
1150
|
-
note: (
|
|
1135
|
+
note: (_ref13 = (_initialExtend$note = initialExtend.note) !== null && _initialExtend$note !== void 0 ? _initialExtend$note : initialCacheItem === null || initialCacheItem === void 0 ? void 0 : initialCacheItem.note) !== null && _ref13 !== void 0 ? _ref13 : "",
|
|
1151
1136
|
skuValue: initialSkuValue
|
|
1152
1137
|
})
|
|
1153
1138
|
});
|
|
@@ -1197,7 +1182,7 @@ const SkuDetailModal = ({ onConfirm, onRemove, onClose, resolveProductData, reso
|
|
|
1197
1182
|
return;
|
|
1198
1183
|
}
|
|
1199
1184
|
}
|
|
1200
|
-
if (!(Number((
|
|
1185
|
+
if (!(Number((_ref14 = (_is_eject = apiData === null || apiData === void 0 ? void 0 : apiData.is_eject) !== null && _is_eject !== void 0 ? _is_eject : data.is_eject) !== null && _ref14 !== void 0 ? _ref14 : 0) === 1 || Number(data.is_eject) === 1 && Boolean(require_index$6.resolveDetailAppearance(config, hydratedData)) || require_utils$4.isWeighingProduct(apiData)) && !hasEffectiveSelectionFlow && !confirmDisabledRef.current) {
|
|
1201
1186
|
var _extend, _bookingState$booking2;
|
|
1202
1187
|
const stockResult = require_utils$1.getStockValidationResult({
|
|
1203
1188
|
value: hydratedData === null || hydratedData === void 0 || (_extend = hydratedData._extend) === null || _extend === void 0 ? void 0 : _extend.skuValue,
|
|
@@ -1233,7 +1218,7 @@ const SkuDetailModal = ({ onConfirm, onRemove, onClose, resolveProductData, reso
|
|
|
1233
1218
|
setProductData(hydratedData);
|
|
1234
1219
|
const hydratedExtend = hydratedData._extend || {};
|
|
1235
1220
|
setNote(hydratedExtend.note || "");
|
|
1236
|
-
setQuantity(require_utils$4.isWeighingProduct(apiData) ? 1 : (
|
|
1221
|
+
setQuantity(require_utils$4.isWeighingProduct(apiData) ? 1 : (_ref15 = (_hydratedExtend$quant = hydratedExtend.quantity) !== null && _hydratedExtend$quant !== void 0 ? _hydratedExtend$quant : apiData === null || apiData === void 0 ? void 0 : apiData.min_num_unit) !== null && _ref15 !== void 0 ? _ref15 : 1);
|
|
1237
1222
|
setDiscounts(initialCacheItem ? (hydratedData.discount_list || []).filter((item) => item.type !== "product") : []);
|
|
1238
1223
|
setWeighingData(require_utils$4.getWeighingValueFromProductSku(initialCacheItem) || initialExtend.weighing || null);
|
|
1239
1224
|
setSkuValue(initialSkuValue);
|
|
@@ -1260,7 +1245,7 @@ const SkuDetailModal = ({ onConfirm, onRemove, onClose, resolveProductData, reso
|
|
|
1260
1245
|
});
|
|
1261
1246
|
openParamsRef.current = null;
|
|
1262
1247
|
if ((Array.isArray(data === null || data === void 0 || (_skuDetailConfig = data.skuDetailConfig) === null || _skuDetailConfig === void 0 ? void 0 : _skuDetailConfig.steps) || typeof (data === null || data === void 0 || (_skuDetailConfig2 = data.skuDetailConfig) === null || _skuDetailConfig2 === void 0 ? void 0 : _skuDetailConfig2.resolveSteps) === "function") && process.env.NODE_ENV !== "production") console.warn("[SkuDetailModal] 自定义 steps 一期仅在 create 模式生效,edit 继续使用旧流程。");
|
|
1263
|
-
|
|
1248
|
+
showModalShellBeforeHydration();
|
|
1264
1249
|
shownLog.dataSource = "local";
|
|
1265
1250
|
const _data = (0, lodash.cloneDeep)(data);
|
|
1266
1251
|
if ((_data === null || _data === void 0 ? void 0 : _data.is_bundle) && !(_data === null || _data === void 0 || (_data$bundle_group = _data.bundle_group) === null || _data$bundle_group === void 0 || (_data$bundle_group = _data$bundle_group[0]) === null || _data$bundle_group === void 0 || (_data$bundle_group = _data$bundle_group.bundle_item) === null || _data$bundle_group === void 0 ? void 0 : _data$bundle_group[0].title)) {
|
|
@@ -1308,7 +1293,7 @@ const SkuDetailModal = ({ onConfirm, onRemove, onClose, resolveProductData, reso
|
|
|
1308
1293
|
setNote((_data === null || _data === void 0 || (_data$_extend = _data._extend) === null || _data$_extend === void 0 ? void 0 : _data$_extend.note) || "");
|
|
1309
1294
|
setQuantity(require_utils$4.isWeighingProduct(_data) ? 1 : (_data === null || _data === void 0 || (_data$_extend2 = _data._extend) === null || _data$_extend2 === void 0 ? void 0 : _data$_extend2.quantity) || 1);
|
|
1310
1295
|
setDiscounts((_data === null || _data === void 0 || (_data$discount_list = _data.discount_list) === null || _data$discount_list === void 0 ? void 0 : _data$discount_list.filter((item) => item.type !== "product")) || []);
|
|
1311
|
-
setWeighingData(require_utils$4.getWeighingValueFromProductSku(_data) || (_data === null || _data === void 0 || (
|
|
1296
|
+
setWeighingData(require_utils$4.getWeighingValueFromProductSku(_data) || (_data === null || _data === void 0 || (_ref16 = _data._extend) === null || _ref16 === void 0 ? void 0 : _ref16.weighing) || null);
|
|
1312
1297
|
const recordSkuValue = require_resolveSkuValue.resolveSkuValueCandidates([
|
|
1313
1298
|
_data === null || _data === void 0 || (_data$_extend3 = _data._extend) === null || _data$_extend3 === void 0 ? void 0 : _data$_extend3._skuValue,
|
|
1314
1299
|
_data === null || _data === void 0 || (_data$_extend4 = _data._extend) === null || _data$_extend4 === void 0 ? void 0 : _data$_extend4.other,
|
|
@@ -1327,7 +1312,7 @@ const SkuDetailModal = ({ onConfirm, onRemove, onClose, resolveProductData, reso
|
|
|
1327
1312
|
var _data$_extend6;
|
|
1328
1313
|
discountListPriceOverride = new decimal_js.default(_data === null || _data === void 0 || (_data$_extend6 = _data._extend) === null || _data$_extend6 === void 0 ? void 0 : _data$_extend6.origin_total).minus(new decimal_js.default(discountListPriceOverride)).toNumber();
|
|
1329
1314
|
}
|
|
1330
|
-
setPriceOverride((
|
|
1315
|
+
setPriceOverride((_ref17 = (_data$_extend$priceOv = _data === null || _data === void 0 || (_data$_extend7 = _data._extend) === null || _data$_extend7 === void 0 ? void 0 : _data$_extend7.priceOverride) !== null && _data$_extend$priceOv !== void 0 ? _data$_extend$priceOv : discountListPriceOverride) !== null && _ref17 !== void 0 ? _ref17 : null);
|
|
1331
1316
|
setShowPriceAdjustModal(false);
|
|
1332
1317
|
setDetailLoading(false);
|
|
1333
1318
|
const dataAny = _data;
|
|
@@ -1340,7 +1325,7 @@ const SkuDetailModal = ({ onConfirm, onRemove, onClose, resolveProductData, reso
|
|
|
1340
1325
|
});
|
|
1341
1326
|
});
|
|
1342
1327
|
return function open(_x7) {
|
|
1343
|
-
return
|
|
1328
|
+
return _ref18.apply(this, arguments);
|
|
1344
1329
|
};
|
|
1345
1330
|
}(),
|
|
1346
1331
|
close: () => {
|
|
@@ -1591,6 +1576,7 @@ const SkuDetailModal = ({ onConfirm, onRemove, onClose, resolveProductData, reso
|
|
|
1591
1576
|
const resetModalStateAfterClose = (0, react.useCallback)(() => {
|
|
1592
1577
|
var _noteDiagnosticsRef$c4;
|
|
1593
1578
|
(_noteDiagnosticsRef$c4 = noteDiagnosticsRef.current) === null || _noteDiagnosticsRef$c4 === void 0 || _noteDiagnosticsRef$c4.stop();
|
|
1579
|
+
setModalEntered(false);
|
|
1594
1580
|
setProductData(null);
|
|
1595
1581
|
setDetailLoading(false);
|
|
1596
1582
|
setNote("");
|
|
@@ -1630,6 +1616,7 @@ const SkuDetailModal = ({ onConfirm, onRemove, onClose, resolveProductData, reso
|
|
|
1630
1616
|
setShowPriceAdjustModal(false);
|
|
1631
1617
|
};
|
|
1632
1618
|
const handleModalOpenChange = (0, react.useCallback)((nextOpen) => {
|
|
1619
|
+
if (nextOpen) setModalEntered(true);
|
|
1633
1620
|
if (nextOpen && shownLogRef.current) {
|
|
1634
1621
|
const _shownLogRef$current = shownLogRef.current, { startedAt } = _shownLogRef$current, metadata = require_objectWithoutProperties._objectWithoutProperties(_shownLogRef$current, _excluded);
|
|
1635
1622
|
shownLogRef.current = null;
|
|
@@ -1654,7 +1641,7 @@ const SkuDetailModal = ({ onConfirm, onRemove, onClose, resolveProductData, reso
|
|
|
1654
1641
|
onClose === null || onClose === void 0 || onClose();
|
|
1655
1642
|
};
|
|
1656
1643
|
const handleConfirm = function() {
|
|
1657
|
-
var
|
|
1644
|
+
var _ref19 = require_asyncToGenerator._asyncToGenerator(function* (flowDraft) {
|
|
1658
1645
|
var _noteDiagnosticsRef$c6, _bookingState$booking3, _selectionFlowRef$cur8, _selectionFlowService4;
|
|
1659
1646
|
(_noteDiagnosticsRef$c6 = noteDiagnosticsRef.current) === null || _noteDiagnosticsRef$c6 === void 0 || _noteDiagnosticsRef$c6.skuConfirm(note.length);
|
|
1660
1647
|
if (confirmDisabledRef.current) return false;
|
|
@@ -1898,7 +1885,7 @@ const SkuDetailModal = ({ onConfirm, onRemove, onClose, resolveProductData, reso
|
|
|
1898
1885
|
return false;
|
|
1899
1886
|
});
|
|
1900
1887
|
return function handleConfirm(_x8) {
|
|
1901
|
-
return
|
|
1888
|
+
return _ref19.apply(this, arguments);
|
|
1902
1889
|
};
|
|
1903
1890
|
}();
|
|
1904
1891
|
const handleStockAlertCancel = () => {
|
|
@@ -1907,7 +1894,7 @@ const SkuDetailModal = ({ onConfirm, onRemove, onClose, resolveProductData, reso
|
|
|
1907
1894
|
setStockAlertDontShowAgainChecked(false);
|
|
1908
1895
|
};
|
|
1909
1896
|
const handleStockAlertContinue = function() {
|
|
1910
|
-
var
|
|
1897
|
+
var _ref20 = require_asyncToGenerator._asyncToGenerator(function* () {
|
|
1911
1898
|
if (confirmDisabledRef.current) return;
|
|
1912
1899
|
const pendingData = pendingConfirmDataRef.current;
|
|
1913
1900
|
if (!pendingData) {
|
|
@@ -1927,7 +1914,7 @@ const SkuDetailModal = ({ onConfirm, onRemove, onClose, resolveProductData, reso
|
|
|
1927
1914
|
modalCloseAction();
|
|
1928
1915
|
});
|
|
1929
1916
|
return function handleStockAlertContinue() {
|
|
1930
|
-
return
|
|
1917
|
+
return _ref20.apply(this, arguments);
|
|
1931
1918
|
};
|
|
1932
1919
|
}();
|
|
1933
1920
|
const handleRemove = () => {
|
|
@@ -1981,7 +1968,7 @@ const SkuDetailModal = ({ onConfirm, onRemove, onClose, resolveProductData, reso
|
|
|
1981
1968
|
* - 使用双 RAF 等待 Weighing 子组件渲染完成后再滚动
|
|
1982
1969
|
*/
|
|
1983
1970
|
(0, react.useEffect)(() => {
|
|
1984
|
-
if (!open) return;
|
|
1971
|
+
if (!open || detailContentLoading) return;
|
|
1985
1972
|
if (isMobile) return;
|
|
1986
1973
|
if (!isWeighingProduct$1) return;
|
|
1987
1974
|
if (!productData) return;
|
|
@@ -2000,6 +1987,7 @@ const SkuDetailModal = ({ onConfirm, onRemove, onClose, resolveProductData, reso
|
|
|
2000
1987
|
};
|
|
2001
1988
|
}, [
|
|
2002
1989
|
open,
|
|
1990
|
+
detailContentLoading,
|
|
2003
1991
|
isMobile,
|
|
2004
1992
|
isWeighingProduct$1,
|
|
2005
1993
|
productData === null || productData === void 0 ? void 0 : productData._id,
|
|
@@ -2134,7 +2122,7 @@ const SkuDetailModal = ({ onConfirm, onRemove, onClose, resolveProductData, reso
|
|
|
2134
2122
|
})) : null);
|
|
2135
2123
|
};
|
|
2136
2124
|
const handleEnrichmentRetry = function() {
|
|
2137
|
-
var
|
|
2125
|
+
var _ref21 = require_asyncToGenerator._asyncToGenerator(function* () {
|
|
2138
2126
|
if (!productData || enrichmentRetryingRef.current) return;
|
|
2139
2127
|
const taskId = openTaskIdRef.current;
|
|
2140
2128
|
enrichmentRetryingRef.current = true;
|
|
@@ -2152,7 +2140,7 @@ const SkuDetailModal = ({ onConfirm, onRemove, onClose, resolveProductData, reso
|
|
|
2152
2140
|
}
|
|
2153
2141
|
});
|
|
2154
2142
|
return function handleEnrichmentRetry() {
|
|
2155
|
-
return
|
|
2143
|
+
return _ref21.apply(this, arguments);
|
|
2156
2144
|
};
|
|
2157
2145
|
}();
|
|
2158
2146
|
const enrichmentRetryAction = /* @__PURE__ */ react.default.createElement(_pisell_materials.Button, {
|
|
@@ -2166,13 +2154,13 @@ const SkuDetailModal = ({ onConfirm, onRemove, onClose, resolveProductData, reso
|
|
|
2166
2154
|
value: quantity,
|
|
2167
2155
|
min: 1,
|
|
2168
2156
|
max: inventorySelection ? Math.max(1, inventorySelection.maxQuantity) : 99999,
|
|
2169
|
-
disabled: appearanceConfirmPending ||
|
|
2157
|
+
disabled: appearanceConfirmPending || detailContentLoading || (inventorySelection === null || inventorySelection === void 0 ? void 0 : inventorySelection.maxQuantity) === 0,
|
|
2170
2158
|
enableInput: (inventorySelection === null || inventorySelection === void 0 ? void 0 : inventorySelection.maxQuantity) !== 0,
|
|
2171
2159
|
onChange: handleQuantityChange
|
|
2172
2160
|
}) : null;
|
|
2173
2161
|
const leftContent = (options = {}) => {
|
|
2174
2162
|
const { showTop = true, showBottom = true } = options;
|
|
2175
|
-
if (
|
|
2163
|
+
if (detailContentLoading || !productData) {
|
|
2176
2164
|
if (!showTop) return null;
|
|
2177
2165
|
return /* @__PURE__ */ react.default.createElement("div", { className: "sku-detail-left" }, renderLoadingPanel());
|
|
2178
2166
|
}
|
|
@@ -2233,7 +2221,7 @@ const SkuDetailModal = ({ onConfirm, onRemove, onClose, resolveProductData, reso
|
|
|
2233
2221
|
})) : null);
|
|
2234
2222
|
};
|
|
2235
2223
|
const rightContent = () => {
|
|
2236
|
-
if (
|
|
2224
|
+
if (detailContentLoading || !productData) return /* @__PURE__ */ react.default.createElement("div", { className: "sku-detail-right-content" }, renderLoadingPanel());
|
|
2237
2225
|
if (isCustomSelectionFlow && selectionFlowInitialDraft) {
|
|
2238
2226
|
var _compiledSelectionFlo;
|
|
2239
2227
|
const showProductDetailsCollapsible = !detailAppearance && !!(skuDetailConfig === null || skuDetailConfig === void 0 ? void 0 : skuDetailConfig.isShowCollapsibleSections);
|
|
@@ -2470,7 +2458,7 @@ const SkuDetailModal = ({ onConfirm, onRemove, onClose, resolveProductData, reso
|
|
|
2470
2458
|
subtitle: productSubtitle,
|
|
2471
2459
|
cover: productData === null || productData === void 0 ? void 0 : productData.cover,
|
|
2472
2460
|
coverText,
|
|
2473
|
-
loading:
|
|
2461
|
+
loading: detailContentLoading || !productData,
|
|
2474
2462
|
pending: appearanceConfirmPending,
|
|
2475
2463
|
confirmDisabled: confirmDisabled || salesSettingsPending || inventoryQuantityBlocked || posAutoResolutionConfirmPending || Boolean(hasReachedBookingPriceStep && (selectionFlowBookingPricePending || selectionFlowBookingPriceError)),
|
|
2476
2464
|
unitPrice: isVirtualOnlySettlement ? renderVirtualSettlementUnitPrices() : productDetailPriceText,
|
|
@@ -2496,7 +2484,7 @@ const SkuDetailModal = ({ onConfirm, onRemove, onClose, resolveProductData, reso
|
|
|
2496
2484
|
removeControl: !isCreateMode && skuDetailConfig.isShowRemove !== false && onRemove && /* @__PURE__ */ react.default.createElement("button", {
|
|
2497
2485
|
type: "button",
|
|
2498
2486
|
className: "sku-detail-appearance__remove",
|
|
2499
|
-
disabled: appearanceConfirmPending ||
|
|
2487
|
+
disabled: appearanceConfirmPending || detailContentLoading || isRemoveDisabled,
|
|
2500
2488
|
onClick: handleRemove
|
|
2501
2489
|
}, _pisell_utils.locales.getText("pisell2.text.sku.detail.modal.btn.remove")),
|
|
2502
2490
|
confirmLabel: isCreateMode && currentStep >= maxStepIndex ? _pisell_utils.locales.getText("pisell2.text.sku.detail.modal.btn.add.to.cart") : pcConfirmButtonText,
|
|
@@ -2619,16 +2607,16 @@ var skuDetailModal_default = require_withResponsive.default(ForwardedSkuDetailMo
|
|
|
2619
2607
|
* v2 主商品 source 单价(不含套餐子商品、不含单规格加价),供 _extend.price / transform 使用。
|
|
2620
2608
|
*/
|
|
2621
2609
|
function getSourceUnitPrice(params) {
|
|
2622
|
-
var
|
|
2610
|
+
var _ref22, _ref23, _productData$base_pri, _productData$_extend3;
|
|
2623
2611
|
const { productData, skuValue } = params;
|
|
2624
2612
|
if (!productData) return 0;
|
|
2625
|
-
let price = new decimal_js.default((
|
|
2613
|
+
let price = new decimal_js.default((_ref22 = (_ref23 = (_productData$base_pri = productData === null || productData === void 0 ? void 0 : productData.base_price) !== null && _productData$base_pri !== void 0 ? _productData$base_pri : productData === null || productData === void 0 ? void 0 : productData.price) !== null && _ref23 !== void 0 ? _ref23 : productData === null || productData === void 0 || (_productData$_extend3 = productData._extend) === null || _productData$_extend3 === void 0 ? void 0 : _productData$_extend3.price) !== null && _ref22 !== void 0 ? _ref22 : 0);
|
|
2626
2614
|
if (skuValue === null || skuValue === void 0 ? void 0 : skuValue.product_variant_id) {
|
|
2627
2615
|
var _variant2;
|
|
2628
2616
|
const variantItem = productData === null || productData === void 0 || (_variant2 = productData.variant) === null || _variant2 === void 0 ? void 0 : _variant2.find((item) => Number(item === null || item === void 0 ? void 0 : item.id) === Number(skuValue.product_variant_id));
|
|
2629
2617
|
if (variantItem) {
|
|
2630
|
-
var
|
|
2631
|
-
price = new decimal_js.default((
|
|
2618
|
+
var _ref24, _ref25, _variantItem$price;
|
|
2619
|
+
price = new decimal_js.default((_ref24 = (_ref25 = (_variantItem$price = variantItem === null || variantItem === void 0 ? void 0 : variantItem.price) !== null && _variantItem$price !== void 0 ? _variantItem$price : variantItem === null || variantItem === void 0 ? void 0 : variantItem.base_price) !== null && _ref25 !== void 0 ? _ref25 : variantItem === null || variantItem === void 0 ? void 0 : variantItem.original_price) !== null && _ref24 !== void 0 ? _ref24 : 0);
|
|
2632
2620
|
}
|
|
2633
2621
|
}
|
|
2634
2622
|
return price.toNumber();
|
|
@@ -2639,16 +2627,16 @@ function getSourceUnitPrice(params) {
|
|
|
2639
2627
|
* 计算规则与 booking/utils.ts 的 getProductTotalPrice 保持一致。
|
|
2640
2628
|
*/
|
|
2641
2629
|
function getSelectedUnitPrice(params) {
|
|
2642
|
-
var
|
|
2630
|
+
var _ref26, _productData$base_pri2, _productData$_extend4;
|
|
2643
2631
|
const { productData, skuValue } = params;
|
|
2644
2632
|
if (!productData) return 0;
|
|
2645
|
-
let price = new decimal_js.default((
|
|
2633
|
+
let price = new decimal_js.default((_ref26 = (_productData$base_pri2 = productData === null || productData === void 0 ? void 0 : productData.base_price) !== null && _productData$base_pri2 !== void 0 ? _productData$base_pri2 : productData === null || productData === void 0 || (_productData$_extend4 = productData._extend) === null || _productData$_extend4 === void 0 ? void 0 : _productData$_extend4.price) !== null && _ref26 !== void 0 ? _ref26 : 0);
|
|
2646
2634
|
if (skuValue === null || skuValue === void 0 ? void 0 : skuValue.product_variant_id) {
|
|
2647
2635
|
var _variant3;
|
|
2648
2636
|
const variantItem = productData === null || productData === void 0 || (_variant3 = productData.variant) === null || _variant3 === void 0 ? void 0 : _variant3.find((item) => Number(item === null || item === void 0 ? void 0 : item.id) === Number(skuValue.product_variant_id));
|
|
2649
2637
|
if (variantItem) {
|
|
2650
|
-
var
|
|
2651
|
-
price = new decimal_js.default((
|
|
2638
|
+
var _ref27, _variantItem$base_pri;
|
|
2639
|
+
price = new decimal_js.default((_ref27 = (_variantItem$base_pri = variantItem === null || variantItem === void 0 ? void 0 : variantItem.base_price) !== null && _variantItem$base_pri !== void 0 ? _variantItem$base_pri : variantItem === null || variantItem === void 0 ? void 0 : variantItem.original_price) !== null && _ref27 !== void 0 ? _ref27 : 0);
|
|
2652
2640
|
}
|
|
2653
2641
|
}
|
|
2654
2642
|
if (Array.isArray(skuValue === null || skuValue === void 0 ? void 0 : skuValue.bundle) && skuValue.bundle.length > 0) price = skuValue.bundle.reduce((accumulator, currentValue) => {
|
|
@@ -2657,8 +2645,8 @@ function getSelectedUnitPrice(params) {
|
|
|
2657
2645
|
return accumulator.add(currentPrice.mul(currentNum));
|
|
2658
2646
|
}, price);
|
|
2659
2647
|
if (Array.isArray(skuValue === null || skuValue === void 0 ? void 0 : skuValue.option) && skuValue.option.length > 0) price = skuValue.option.reduce((accumulator, currentValue) => {
|
|
2660
|
-
var
|
|
2661
|
-
const currentPrice = new decimal_js.default((
|
|
2648
|
+
var _ref28, _currentValue$origina;
|
|
2649
|
+
const currentPrice = new decimal_js.default((_ref28 = (_currentValue$origina = currentValue === null || currentValue === void 0 ? void 0 : currentValue.original_price) !== null && _currentValue$origina !== void 0 ? _currentValue$origina : currentValue === null || currentValue === void 0 ? void 0 : currentValue.price) !== null && _ref28 !== void 0 ? _ref28 : 0);
|
|
2662
2650
|
const currentNum = new decimal_js.default((currentValue === null || currentValue === void 0 ? void 0 : currentValue.num) || 0);
|
|
2663
2651
|
return accumulator.add(currentPrice.mul(currentNum));
|
|
2664
2652
|
}, price);
|
|
@@ -2679,8 +2667,8 @@ function getOtherFromSkuValue(params) {
|
|
|
2679
2667
|
var _variant4;
|
|
2680
2668
|
const variantItem = productData === null || productData === void 0 || (_variant4 = productData.variant) === null || _variant4 === void 0 ? void 0 : _variant4.find((item) => Number(item === null || item === void 0 ? void 0 : item.id) === Number(other.product_variant_id));
|
|
2681
2669
|
if (variantItem) {
|
|
2682
|
-
var
|
|
2683
|
-
other.price = Number((
|
|
2670
|
+
var _ref29, _variantItem$price2;
|
|
2671
|
+
other.price = Number((_ref29 = (_variantItem$price2 = variantItem === null || variantItem === void 0 ? void 0 : variantItem.price) !== null && _variantItem$price2 !== void 0 ? _variantItem$price2 : variantItem === null || variantItem === void 0 ? void 0 : variantItem.base_price) !== null && _ref29 !== void 0 ? _ref29 : 0);
|
|
2684
2672
|
}
|
|
2685
2673
|
}
|
|
2686
2674
|
return other;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pisell/private-materials",
|
|
3
|
-
"version": "6.12.
|
|
3
|
+
"version": "6.12.373",
|
|
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/materials": "6.12.88",
|
|
79
|
-
"@pisell/
|
|
80
|
-
"@pisell/
|
|
79
|
+
"@pisell/date-picker": "3.0.12",
|
|
80
|
+
"@pisell/icon": "0.0.11"
|
|
81
81
|
},
|
|
82
82
|
"peerDependencies": {
|
|
83
83
|
"react": "^18.0.0",
|