@pisell/private-materials 6.11.56 → 6.11.57

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.
Files changed (37) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/meta.js +1 -1
  5. package/build/lowcode/render/default/view.css +1 -1
  6. package/build/lowcode/render/default/view.js +1 -1
  7. package/build/lowcode/view.css +1 -1
  8. package/build/lowcode/view.js +1 -1
  9. package/es/components/booking/components/footer/amount.js +5 -0
  10. package/es/components/booking/hooks/usePromotion.js +4 -2
  11. package/es/components/checkout/PaymentModal.js +6 -11
  12. package/es/components/list/List.d.ts +5 -0
  13. package/es/components/list/hooks/useListState.js +14 -29
  14. package/es/components/shoppingCart/components/Cart/Product.js +8 -3
  15. package/es/components/shoppingCart/components/Cart/index.js +35 -16
  16. package/es/components/shoppingCart/components/Cart/index.less +3 -2
  17. package/es/components/shoppingCart/hooks/usePromotionModal.js +1 -1
  18. package/es/components/shoppingCart/type.d.ts +1 -0
  19. package/es/components/shoppingCart/utils.js +4 -1
  20. package/es/components/ticketBooking/components/ticketBooking/index.less +1 -0
  21. package/es/components/ticketBooking/hooks/pisellos/useProducts.js +1 -18
  22. package/es/components/ticketBooking/index.d.ts +23 -0
  23. package/lib/components/booking/components/footer/amount.js +5 -0
  24. package/lib/components/booking/hooks/usePromotion.js +3 -3
  25. package/lib/components/checkout/PaymentModal.js +1 -4
  26. package/lib/components/list/List.d.ts +5 -0
  27. package/lib/components/list/hooks/useListState.js +10 -19
  28. package/lib/components/shoppingCart/components/Cart/Product.js +4 -3
  29. package/lib/components/shoppingCart/components/Cart/index.js +42 -40
  30. package/lib/components/shoppingCart/components/Cart/index.less +3 -2
  31. package/lib/components/shoppingCart/hooks/usePromotionModal.js +1 -1
  32. package/lib/components/shoppingCart/type.d.ts +1 -0
  33. package/lib/components/shoppingCart/utils.js +3 -1
  34. package/lib/components/ticketBooking/components/ticketBooking/index.less +1 -0
  35. package/lib/components/ticketBooking/hooks/pisellos/useProducts.js +1 -17
  36. package/lib/components/ticketBooking/index.d.ts +23 -0
  37. package/package.json +3 -3
@@ -50,13 +50,7 @@ import_utils.locales.init(import_locales.default, localStorage.getItem("umi_loca
50
50
  var prefixCls = "pisell-lowcode__shopping-cart";
51
51
  var Cart = () => {
52
52
  const { state, updateState, onActiveKey, onChange, externalState } = (0, import_useContext.useContext)();
53
- const {
54
- platform,
55
- carts,
56
- isProductList,
57
- collapseParams,
58
- cartInfo
59
- } = state;
53
+ const { platform, carts, isProductList, collapseParams, cartInfo } = state;
60
54
  const translationOriginal = (0, import_useTranslationOriginal.default)();
61
55
  const { openModal, MarketingModal } = (0, import_usePromotionModal.usePromotionModal)({
62
56
  onConfirm: async (selectedProduct) => {
@@ -71,6 +65,15 @@ var Cart = () => {
71
65
  onChange(params, key);
72
66
  }
73
67
  });
68
+ const _isShowPromotionAlert = (0, import_react.useMemo)(() => {
69
+ const { promotions, isShowPromotionAlert = true } = cartInfo || {};
70
+ if (!isShowPromotionAlert || !(promotions == null ? void 0 : promotions.length)) return false;
71
+ const _promotions = (promotions || []).filter(
72
+ (item) => (item == null ? void 0 : item.actionType) === "X_ITEMS_FOR_Y_PRICE"
73
+ );
74
+ if (!(_promotions == null ? void 0 : _promotions.length)) return false;
75
+ return true;
76
+ }, [JSON.stringify(cartInfo)]);
74
77
  const cartsMap = (0, import_react.useMemo)(() => {
75
78
  return carts == null ? void 0 : carts.map((item) => {
76
79
  var _a, _b, _c;
@@ -86,13 +89,14 @@ var Cart = () => {
86
89
  id: item == null ? void 0 : item.key,
87
90
  lists: item == null ? void 0 : item.products,
88
91
  isAdd: state.maxLength > _length,
89
- openPromotionModal: openModal
92
+ openPromotionModal: openModal,
93
+ isShowPromotionAlert: _isShowPromotionAlert
90
94
  }
91
95
  ) : /* @__PURE__ */ import_react.default.createElement(import_Empty.default, { id: item == null ? void 0 : item.key }),
92
96
  showArrow: platform === "shop"
93
97
  };
94
98
  });
95
- }, [carts, platform, openModal, state.maxLength]);
99
+ }, [carts, platform, openModal, state.maxLength, _isShowPromotionAlert]);
96
100
  const handleOpenPromotionModal = (0, import_ahooks.useMemoizedFn)(
97
101
  (item, type = "gift") => {
98
102
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
@@ -118,7 +122,9 @@ var Cart = () => {
118
122
  const services = ((_f = externalState == null ? void 0 : externalState.service) == null ? void 0 : _f.value) || [];
119
123
  selectedProducts = services == null ? void 0 : services.filter((option) => {
120
124
  var _a2, _b2;
121
- const _id = (0, import_utils2.getPureSourceProductId)((_a2 = option == null ? void 0 : option._giftInfo) == null ? void 0 : _a2.sourceProductId);
125
+ const _id = (0, import_utils2.getPureSourceProductId)(
126
+ (_a2 = option == null ? void 0 : option._giftInfo) == null ? void 0 : _a2.sourceProductId
127
+ );
122
128
  return _id && ((_b2 = currentItem == null ? void 0 : currentItem.sourceProductId) == null ? void 0 : _b2.includes(_id));
123
129
  });
124
130
  if (isMultiple) {
@@ -150,34 +156,28 @@ var Cart = () => {
150
156
  }
151
157
  );
152
158
  const promotionAlert = (0, import_react.useMemo)(() => {
153
- var _a;
154
- const { promotions, isShowPromotionAlert = true } = cartInfo || {};
155
- if (!isShowPromotionAlert) return null;
156
- return /* @__PURE__ */ import_react.default.createElement("div", { className: `${prefixCls}-promotion-alert` }, /* @__PURE__ */ import_react.default.createElement("div", null, (_a = promotions || []) == null ? void 0 : _a.map(
157
- (item) => (item == null ? void 0 : item.actionType) === "X_ITEMS_FOR_Y_PRICE" ? /* @__PURE__ */ import_react.default.createElement(
158
- import_materials.PisellAlert,
159
- {
160
- description: import_utils.locales.getText(
161
- "pisell2.text.shopping-cart.marketing.alert"
162
- )(
163
- item == null ? void 0 : item.needQuantity,
164
- translationOriginal == null ? void 0 : translationOriginal(item == null ? void 0 : item.strategyName)
165
- ),
166
- type: "error",
167
- action: /* @__PURE__ */ import_react.default.createElement(
168
- import_materials.Button,
169
- {
170
- onClick: () => handleOpenPromotionModal(item, "promotion")
171
- },
172
- /* @__PURE__ */ import_react.default.createElement("span", null, import_utils.locales.getText(
173
- "pisell2.text.shopping-cart.marketing.browse.items"
174
- )),
175
- /* @__PURE__ */ import_react.default.createElement(import_iconfont.default, { type: "pisell2-arrow-right" })
176
- )
177
- }
178
- ) : null
179
- )));
180
- }, [JSON.stringify(cartInfo)]);
159
+ const { promotions } = cartInfo || {};
160
+ if (!_isShowPromotionAlert) return null;
161
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: `${prefixCls}-promotion-alert` }, /* @__PURE__ */ import_react.default.createElement("div", null, promotions == null ? void 0 : promotions.map((item) => /* @__PURE__ */ import_react.default.createElement(
162
+ import_materials.PisellAlert,
163
+ {
164
+ description: import_utils.locales.getText(
165
+ "pisell2.text.shopping-cart.marketing.alert"
166
+ )(item == null ? void 0 : item.needQuantity, translationOriginal == null ? void 0 : translationOriginal(item == null ? void 0 : item.strategyName)),
167
+ type: "error",
168
+ action: /* @__PURE__ */ import_react.default.createElement(
169
+ import_materials.Button,
170
+ {
171
+ onClick: () => handleOpenPromotionModal(item, "promotion")
172
+ },
173
+ /* @__PURE__ */ import_react.default.createElement("span", null, import_utils.locales.getText(
174
+ "pisell2.text.shopping-cart.marketing.browse.items"
175
+ )),
176
+ /* @__PURE__ */ import_react.default.createElement(import_iconfont.default, { type: "pisell2-arrow-right" })
177
+ )
178
+ }
179
+ ))));
180
+ }, [JSON.stringify(cartInfo), _isShowPromotionAlert]);
181
181
  return (0, import_react.useMemo)(() => {
182
182
  console.log("render cart 22222", state.prodcuts);
183
183
  return /* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)("pisell-lowcode__shopping-cart") }, isProductList ? /* @__PURE__ */ import_react.default.createElement(
@@ -185,7 +185,8 @@ var Cart = () => {
185
185
  {
186
186
  id: void 0,
187
187
  lists: state == null ? void 0 : state.products,
188
- openPromotionModal: handleOpenPromotionModal
188
+ openPromotionModal: handleOpenPromotionModal,
189
+ isShowPromotionAlert: _isShowPromotionAlert
189
190
  }
190
191
  ) : /* @__PURE__ */ import_react.default.createElement(
191
192
  import_materials.Collapse,
@@ -210,7 +211,8 @@ var Cart = () => {
210
211
  state == null ? void 0 : state.products,
211
212
  promotionAlert,
212
213
  MarketingModal,
213
- handleOpenPromotionModal
214
+ handleOpenPromotionModal,
215
+ _isShowPromotionAlert
214
216
  ]);
215
217
  };
216
218
  var Cart_default = Cart;
@@ -110,9 +110,10 @@
110
110
  //}
111
111
 
112
112
  &-promotion-alert {
113
- margin-top: 16px;
113
+ flex-shrink: 0;
114
+ margin-top: 0 !important;
114
115
  z-index: 10;
115
- position: sticky;
116
+ position: absolute !important;
116
117
  bottom: 0;
117
118
  background: transparent;
118
119
 
@@ -374,7 +374,7 @@ var usePromotionModal = (options) => {
374
374
  try {
375
375
  const selectedIds = Array.isArray(selected) ? selected.map((item) => (item == null ? void 0 : item.value) || item) : [selected];
376
376
  const _selectedProduct = (0, import_utils4.findSelectedProductsFromList)(
377
- products,
377
+ productsRef.current,
378
378
  selectedIds
379
379
  );
380
380
  if (!(_selectedProduct == null ? void 0 : _selectedProduct.length)) return;
@@ -54,5 +54,6 @@ export interface ProductProps {
54
54
  isAdd?: boolean;
55
55
  openPromotionModal?: (products: any[]) => void;
56
56
  promotionProducts?: any[];
57
+ isShowPromotionAlert?: boolean;
57
58
  }
58
59
  export {};
@@ -338,7 +338,9 @@ var updateProductInList = (props) => {
338
338
  let _products = (products || []).map((item) => {
339
339
  if (item.id === productId) {
340
340
  return {
341
- ...cacheItem
341
+ ...cacheItem,
342
+ // 增加初始价格,用于赠品处理
343
+ _initPrice: item == null ? void 0 : item._initPrice
342
344
  };
343
345
  }
344
346
  return item;
@@ -20,6 +20,7 @@
20
20
  padding-top: 10px;
21
21
  display: flex;
22
22
  flex-direction: column;
23
+ position: relative;
23
24
 
24
25
  .pisell-lowcode__booking-service-wrap {
25
26
  flex: 1;
@@ -39,7 +39,6 @@ var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContex
39
39
  var import_dayjs = __toESM(require("dayjs"));
40
40
  var import_useLogger = __toESM(require("../../../../hooks/useLogger"));
41
41
  var import_usePromotion = __toESM(require("../../../booking/hooks/usePromotion"));
42
- var import_utils = require("@pisell/utils");
43
42
  var useProducts = (notAvailableRef) => {
44
43
  var _a;
45
44
  const bookingTicket = (0, import_bookingTicket.useBookingTicket)();
@@ -52,7 +51,6 @@ var useProducts = (notAvailableRef) => {
52
51
  const { getApp } = ((_a = context.appHelper) == null ? void 0 : _a.utils) || {};
53
52
  const logger = (0, import_useLogger.default)();
54
53
  const { formatProductList } = (0, import_usePromotion.default)();
55
- const useCurrentId = (0, import_react.useRef)((0, import_utils.getUniqueId)());
56
54
  const app = getApp();
57
55
  const [scheduleTimePoints, setScheduleTimePoints] = (0, import_react.useState)([]);
58
56
  const scheduledTaskQueueIdRef = (0, import_react.useRef)("booking-schedule-products");
@@ -68,16 +66,7 @@ var useProducts = (notAvailableRef) => {
68
66
  params
69
67
  }
70
68
  });
71
- const products2 = await bookingTicket.loadProducts(params, {
72
- callback: (res) => {
73
- var _a3, _b;
74
- console.log(res, "1234321");
75
- if ((_a3 = res == null ? void 0 : res.data) == null ? void 0 : _a3.list) {
76
- setProducts(formatProductList((_b = res == null ? void 0 : res.data) == null ? void 0 : _b.list));
77
- }
78
- },
79
- subscriberId: useCurrentId
80
- });
69
+ const products2 = await bookingTicket.loadProducts(params);
81
70
  logger.addLog({
82
71
  title: "useProducts: getProducts 返回",
83
72
  metadata: {
@@ -101,11 +90,6 @@ var useProducts = (notAvailableRef) => {
101
90
  isFirstLoadRef.current = false;
102
91
  }
103
92
  });
104
- (0, import_react.useEffect)(() => {
105
- return () => {
106
- bookingTicket.unsubscribeProductQuery(useCurrentId);
107
- };
108
- }, []);
109
93
  (0, import_react.useEffect)(() => {
110
94
  var _a2, _b, _c;
111
95
  if (platform === "shop") {
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ import { ProductDisplayConfig, ProductDisplayPresetKey } from './components/ProductDisplayAdapter/types';
3
+ import './index.less';
4
+ export declare const ticketBookingInitialState: any;
5
+ interface TicketBookingProps {
6
+ productExtensionType: string[];
7
+ bookingConfigParams: Record<string, any>;
8
+ isShowMenuBar?: boolean;
9
+ onPrerenderComplete?: () => void;
10
+ isShowTimeBar?: boolean;
11
+ isShowFloatButtons?: boolean;
12
+ productDisplayConfig?: ProductDisplayPresetKey | ProductDisplayConfig;
13
+ isActive?: boolean;
14
+ rulesHooks?: any;
15
+ businessCode?: string;
16
+ storeRef?: React.MutableRefObject<any>;
17
+ /** 是否是弹窗编辑模式(由 TicketBookingDialog 传入) */
18
+ isEditTicketMode?: boolean;
19
+ /** 编辑模式下的初始 store 状态,会在 store 创建时合并进去 */
20
+ editModeInitialState?: Record<string, any>;
21
+ }
22
+ declare const _default: (props: TicketBookingProps) => React.JSX.Element;
23
+ export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "6.11.56",
3
+ "version": "6.11.57",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -67,10 +67,10 @@
67
67
  "react-infinite-scroll-component": "^6.1.0",
68
68
  "react-resizable": "^3.0.5",
69
69
  "styled-components": "^6.0.0-rc.3",
70
- "@pisell/utils": "3.0.2",
71
70
  "@pisell/materials": "6.11.17",
72
71
  "@pisell/icon": "0.0.11",
73
- "@pisell/date-picker": "3.0.8"
72
+ "@pisell/date-picker": "3.0.8",
73
+ "@pisell/utils": "3.0.2"
74
74
  },
75
75
  "peerDependencies": {
76
76
  "react": "^18.0.0",