@pisell/private-materials 6.12.120 → 6.12.121

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.
@@ -1033,6 +1033,10 @@ const SalesSdkCartProvider = ({ children }) => {
1033
1033
  return _ref13.apply(this, arguments);
1034
1034
  };
1035
1035
  }());
1036
+ const syncCommittedBookingSelection = useMemoizedFn(_asyncToGenerator(function* () {
1037
+ refreshAfterMutation();
1038
+ yield syncSummary();
1039
+ }));
1036
1040
  /** 无防抖的加车编排(规格 / 资源弹窗链)。 */
1037
1041
  const runAddProductFlowBase = useMemoizedFn(function() {
1038
1042
  var _ref14 = _asyncToGenerator(function* (product, options) {
@@ -1041,7 +1045,10 @@ const SalesSdkCartProvider = ({ children }) => {
1041
1045
  addProduct,
1042
1046
  confirmDetail,
1043
1047
  confirmBookingEdit
1044
- }, uiHosts, product, _objectSpread2(_objectSpread2(_objectSpread2({}, options), getAddFlowContext()), {}, { holderOptions: holderOptionsForProduct }));
1048
+ }, uiHosts, product, _objectSpread2(_objectSpread2(_objectSpread2({}, options), getAddFlowContext()), {}, {
1049
+ holderOptions: holderOptionsForProduct,
1050
+ onBookingSelectionCommitted: syncCommittedBookingSelection
1051
+ }));
1045
1052
  });
1046
1053
  return function(_x14, _x15) {
1047
1054
  return _ref14.apply(this, arguments);
@@ -1078,6 +1085,7 @@ const SalesSdkCartProvider = ({ children }) => {
1078
1085
  var _uiHostsRef$current;
1079
1086
  return (_uiHostsRef$current = uiHostsRef.current) === null || _uiHostsRef$current === void 0 ? void 0 : _uiHostsRef$current.openBookingSelectionFlow;
1080
1087
  },
1088
+ onBookingSelectionCommitted: syncCommittedBookingSelection,
1081
1089
  confirmBookingSelection: function() {
1082
1090
  var _ref15 = _asyncToGenerator(function* (cacheItem, opts) {
1083
1091
  const result = yield confirmBookingEditRef.current({
@@ -252,10 +252,14 @@ function createAddProductWithFlowDebounced(deps) {
252
252
  customerId: (_deps$getCustomerId2 = (_deps$getCustomerId3 = deps.getCustomerId) === null || _deps$getCustomerId3 === void 0 ? void 0 : _deps$getCustomerId3.call(deps)) !== null && _deps$getCustomerId2 !== void 0 ? _deps$getCustomerId2 : void 0,
253
253
  date: (_deps$getBookingDate = (_deps$getBookingDate2 = deps.getBookingDate) === null || _deps$getBookingDate2 === void 0 ? void 0 : _deps$getBookingDate2.call(deps)) !== null && _deps$getBookingDate !== void 0 ? _deps$getBookingDate : null
254
254
  });
255
- if (selectionResult.status === "committed") return {
256
- status: "added",
257
- products: selectionResult.products
258
- };
255
+ if (selectionResult.status === "committed") {
256
+ var _deps$onBookingSelect;
257
+ yield (_deps$onBookingSelect = deps.onBookingSelectionCommitted) === null || _deps$onBookingSelect === void 0 ? void 0 : _deps$onBookingSelect.call(deps);
258
+ return {
259
+ status: "added",
260
+ products: selectionResult.products
261
+ };
262
+ }
259
263
  if (selectionResult.status === "confirmed") {
260
264
  if (!deps.confirmBookingSelection) throw new Error("[SalesSdk] Selection Flow 已确认但缺少预约提交入口。");
261
265
  return deps.confirmBookingSelection(selectionResult.cacheItem, callOptions);
@@ -40,10 +40,14 @@ function _openBookingEditAfterEnrich() {
40
40
  initialHolderIds: flowOptions.initialHolderIds
41
41
  }));
42
42
  if (selectionResult.status === "cancelled") return { status: "cancelled" };
43
- if (selectionResult.status === "committed") return {
44
- status: "added",
45
- products: selectionResult.products
46
- };
43
+ if (selectionResult.status === "committed") {
44
+ var _flowOptions$onBookin;
45
+ yield (_flowOptions$onBookin = flowOptions.onBookingSelectionCommitted) === null || _flowOptions$onBookin === void 0 ? void 0 : _flowOptions$onBookin.call(flowOptions);
46
+ return {
47
+ status: "added",
48
+ products: selectionResult.products
49
+ };
50
+ }
47
51
  if (selectionResult.status === "confirmed") {
48
52
  const { products } = yield cart.confirmBookingEdit({
49
53
  cacheItem: selectionResult.cacheItem,
@@ -1036,6 +1036,10 @@ const SalesSdkCartProvider = ({ children }) => {
1036
1036
  return _ref13.apply(this, arguments);
1037
1037
  };
1038
1038
  }());
1039
+ const syncCommittedBookingSelection = (0, ahooks.useMemoizedFn)(require_asyncToGenerator._asyncToGenerator(function* () {
1040
+ refreshAfterMutation();
1041
+ yield syncSummary();
1042
+ }));
1039
1043
  /** 无防抖的加车编排(规格 / 资源弹窗链)。 */
1040
1044
  const runAddProductFlowBase = (0, ahooks.useMemoizedFn)(function() {
1041
1045
  var _ref14 = require_asyncToGenerator._asyncToGenerator(function* (product, options) {
@@ -1044,7 +1048,10 @@ const SalesSdkCartProvider = ({ children }) => {
1044
1048
  addProduct,
1045
1049
  confirmDetail,
1046
1050
  confirmBookingEdit
1047
- }, uiHosts, product, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, options), getAddFlowContext()), {}, { holderOptions: holderOptionsForProduct }));
1051
+ }, uiHosts, product, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, options), getAddFlowContext()), {}, {
1052
+ holderOptions: holderOptionsForProduct,
1053
+ onBookingSelectionCommitted: syncCommittedBookingSelection
1054
+ }));
1048
1055
  });
1049
1056
  return function(_x14, _x15) {
1050
1057
  return _ref14.apply(this, arguments);
@@ -1081,6 +1088,7 @@ const SalesSdkCartProvider = ({ children }) => {
1081
1088
  var _uiHostsRef$current;
1082
1089
  return (_uiHostsRef$current = uiHostsRef.current) === null || _uiHostsRef$current === void 0 ? void 0 : _uiHostsRef$current.openBookingSelectionFlow;
1083
1090
  },
1091
+ onBookingSelectionCommitted: syncCommittedBookingSelection,
1084
1092
  confirmBookingSelection: function() {
1085
1093
  var _ref15 = require_asyncToGenerator._asyncToGenerator(function* (cacheItem, opts) {
1086
1094
  const result = yield confirmBookingEditRef.current({
@@ -252,10 +252,14 @@ function createAddProductWithFlowDebounced(deps) {
252
252
  customerId: (_deps$getCustomerId2 = (_deps$getCustomerId3 = deps.getCustomerId) === null || _deps$getCustomerId3 === void 0 ? void 0 : _deps$getCustomerId3.call(deps)) !== null && _deps$getCustomerId2 !== void 0 ? _deps$getCustomerId2 : void 0,
253
253
  date: (_deps$getBookingDate = (_deps$getBookingDate2 = deps.getBookingDate) === null || _deps$getBookingDate2 === void 0 ? void 0 : _deps$getBookingDate2.call(deps)) !== null && _deps$getBookingDate !== void 0 ? _deps$getBookingDate : null
254
254
  });
255
- if (selectionResult.status === "committed") return {
256
- status: "added",
257
- products: selectionResult.products
258
- };
255
+ if (selectionResult.status === "committed") {
256
+ var _deps$onBookingSelect;
257
+ yield (_deps$onBookingSelect = deps.onBookingSelectionCommitted) === null || _deps$onBookingSelect === void 0 ? void 0 : _deps$onBookingSelect.call(deps);
258
+ return {
259
+ status: "added",
260
+ products: selectionResult.products
261
+ };
262
+ }
259
263
  if (selectionResult.status === "confirmed") {
260
264
  if (!deps.confirmBookingSelection) throw new Error("[SalesSdk] Selection Flow 已确认但缺少预约提交入口。");
261
265
  return deps.confirmBookingSelection(selectionResult.cacheItem, callOptions);
@@ -40,10 +40,14 @@ function _openBookingEditAfterEnrich() {
40
40
  initialHolderIds: flowOptions.initialHolderIds
41
41
  }));
42
42
  if (selectionResult.status === "cancelled") return { status: "cancelled" };
43
- if (selectionResult.status === "committed") return {
44
- status: "added",
45
- products: selectionResult.products
46
- };
43
+ if (selectionResult.status === "committed") {
44
+ var _flowOptions$onBookin;
45
+ yield (_flowOptions$onBookin = flowOptions.onBookingSelectionCommitted) === null || _flowOptions$onBookin === void 0 ? void 0 : _flowOptions$onBookin.call(flowOptions);
46
+ return {
47
+ status: "added",
48
+ products: selectionResult.products
49
+ };
50
+ }
47
51
  if (selectionResult.status === "confirmed") {
48
52
  const { products } = yield cart.confirmBookingEdit({
49
53
  cacheItem: selectionResult.cacheItem,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "6.12.120",
3
+ "version": "6.12.121",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -70,9 +70,9 @@
70
70
  "styled-components": "^6.0.0-rc.3",
71
71
  "use-sync-external-store": "^1.6.0",
72
72
  "@pisell/utils": "3.0.4",
73
- "@pisell/date-picker": "3.0.10",
74
- "@pisell/materials": "6.12.29",
75
- "@pisell/icon": "0.0.11"
73
+ "@pisell/icon": "0.0.11",
74
+ "@pisell/materials": "6.12.30",
75
+ "@pisell/date-picker": "3.0.10"
76
76
  },
77
77
  "peerDependencies": {
78
78
  "react": "^18.0.0",