@pisell/private-materials 6.12.362 → 6.12.363

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 (42) 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.js +1 -1
  6. package/build/lowcode/view.js +1 -1
  7. package/es/components/bigSale/components/BookingFloatingPanel/useBookingPanelController.js +1 -0
  8. package/es/components/bigSale/components/ProductList/index.js +1 -0
  9. package/es/components/bigSale/components/TimeBar/index.js +1 -0
  10. package/es/components/bigSale/dialog.js +1 -0
  11. package/es/components/bigSale/hooks/useBigSaleContext.js +1 -0
  12. package/es/components/bigSale/hooks/useSelectFloorMapResourceForBigSale.js +1 -0
  13. package/es/components/bigSale/index.js +1 -0
  14. package/es/components/bigSale/templates/Kiosk/index.js +1 -0
  15. package/es/components/sharedSecondaryBigSale/SharedSecondaryBigSaleReceiver.js +1 -0
  16. package/es/index.js +2 -0
  17. package/es/plus/multiCurrencySettlement/index.js +1 -1
  18. package/es/plus/pisellReservation/data/bookingToReservationTables.js +1 -1
  19. package/es/plus/pisellReservation/floorMap/floorPlanApi.js +1 -1
  20. package/es/plus/pisellReservation/floorMap/reservationMock.js +1 -1
  21. package/es/plus/pisellReservation/index.js +17 -0
  22. package/es/plus/saasDevice/devicePasscodes/model.js +4 -4
  23. package/es/plus/saleDetail/Base.js +1 -0
  24. package/es/plus/saleDetail/components/Client/hooks/useClientSelectorProps.js +1 -0
  25. package/es/plus/saleDetail/components/DetailActions/PrintAction.js +1 -0
  26. package/es/plus/saleDetail/components/DetailActions/index.js +1 -0
  27. package/es/plus/saleDetail/components/SummaryFinancialSections/index.js +1 -0
  28. package/es/plus/saleDetail/index.js +1 -0
  29. package/es/plus/saleDetail/tmpl/B/components/Dish/index.js +1 -0
  30. package/es/plus/saleDetail/tmpl/B/index.js +1 -0
  31. package/es/plus/salesSdk/bookingEditService/BookingEditHolderField.js +66 -27
  32. package/es/plus/salesSdk/index.js +54 -0
  33. package/es/plus/salesSdk/utils/addProductWithFlowDebounced.js +1 -1
  34. package/es/plus/salesSdk/utils/bookingDate.js +1 -1
  35. package/es/plus/salesSdk/utils/enrichCartLineHolderDisplay.js +1 -1
  36. package/es/plus/walletPassGallery/components/timelineSection/index.js +4 -4
  37. package/es/pro/Login2.0/AuthModal.d.ts +1 -1
  38. package/es/pro/Login2.0/index.d.ts +2 -2
  39. package/es/pro/Login2.0/shared/types.d.ts +1 -1
  40. package/lib/plus/salesSdk/bookingEditService/BookingEditHolderField.js +65 -26
  41. package/package.json +3 -3
  42. package/es/private-materials/lowcode/authmodal/meta.d.ts +0 -1
@@ -33,7 +33,7 @@ function hasHolderFormFields(formDataConfig) {
33
33
  return Array.isArray(formDataConfig === null || formDataConfig === void 0 ? void 0 : formDataConfig.field) || Array.isArray(formDataConfig === null || formDataConfig === void 0 ? void 0 : formDataConfig.form_field);
34
34
  }
35
35
  const BookingEditHolderField = ({ state, cacheItem, required, value, onChange, getCurrentCacheItem, presentation = "modal" }) => {
36
- var _context$appHelper, _currentCacheItem$_ex, _cacheItem$_extend, _inlinePet$formData, _state$pet, _state$pet6, _state$pet7, _state$pet8, _inlineState$pet2, _state$client2, _inlineState$client5;
36
+ var _context$appHelper, _currentCacheItem$_ex, _cacheItem$_extend, _inlinePet$formData, _state$pet, _state$pet6, _state$pet7, _state$pet8, _inlineState$client, _inlineState$pet2, _state$client2, _inlineState$client6;
37
37
  const bridges = require_SalesSdkHostBridgesContext.useSalesSdkHostBridges();
38
38
  const platform = require_useEngineContext.usePlatform();
39
39
  const context = require_useEngineContext.default();
@@ -124,6 +124,33 @@ const BookingEditHolderField = ({ state, cacheItem, required, value, onChange, g
124
124
  const handleApply = (0, react.useCallback)((nextValues) => {
125
125
  onChange === null || onChange === void 0 || onChange(nextValues);
126
126
  }, [onChange]);
127
+ const defaultSelectionKey = JSON.stringify([inlineState === null || inlineState === void 0 || (_inlineState$client = inlineState.client) === null || _inlineState$client === void 0 || (_inlineState$client = _inlineState$client.value) === null || _inlineState$client === void 0 ? void 0 : _inlineState$client.id, currentHolderFormId]);
128
+ const defaultSelectionRef = (0, react.useRef)(null);
129
+ (0, react.useEffect)(() => {
130
+ var _ref4, _holder$id;
131
+ if (!isInline || !isRequired || maxSelectedCount !== 1) return;
132
+ if (defaultSelectionRef.current === defaultSelectionKey) return;
133
+ if (selectedValues.length) {
134
+ defaultSelectionRef.current = defaultSelectionKey;
135
+ return;
136
+ }
137
+ if (!Array.isArray(inlinePet.holders)) return;
138
+ if (inlinePet.holders.length !== 1) return;
139
+ const holder = inlinePet.holders[0];
140
+ const id = (_ref4 = (_holder$id = holder === null || holder === void 0 ? void 0 : holder.id) !== null && _holder$id !== void 0 ? _holder$id : holder === null || holder === void 0 ? void 0 : holder.form_record_id) !== null && _ref4 !== void 0 ? _ref4 : holder === null || holder === void 0 ? void 0 : holder.value;
141
+ if (id == null) return;
142
+ defaultSelectionRef.current = defaultSelectionKey;
143
+ setSelectedValues([id]);
144
+ handleApply([id]);
145
+ }, [
146
+ defaultSelectionKey,
147
+ handleApply,
148
+ inlinePet.holders,
149
+ isInline,
150
+ isRequired,
151
+ maxSelectedCount,
152
+ selectedValues
153
+ ]);
127
154
  const { formDataConfig, isMinorAndWaiver } = (0, react.useMemo)(() => {
128
155
  var _inlineState$pet;
129
156
  const productHolderFormData = inlineState === null || inlineState === void 0 || (_inlineState$pet = inlineState.pet) === null || _inlineState$pet === void 0 || (_inlineState$pet = _inlineState$pet.formData) === null || _inlineState$pet === void 0 ? void 0 : _inlineState$pet[0];
@@ -141,9 +168,9 @@ const BookingEditHolderField = ({ state, cacheItem, required, value, onChange, g
141
168
  };
142
169
  }, [inlineState === null || inlineState === void 0 || (_inlineState$pet2 = inlineState.pet) === null || _inlineState$pet2 === void 0 ? void 0 : _inlineState$pet2.formData]);
143
170
  const refreshHoldersFromServer = (0, ahooks.useMemoizedFn)(require_asyncToGenerator._asyncToGenerator(function* () {
144
- var _inlineState$client;
171
+ var _inlineState$client2;
145
172
  const params = require_enrichCartLineHolderDisplay.buildHolderListRequestParams({
146
- customerId: inlineState === null || inlineState === void 0 || (_inlineState$client = inlineState.client) === null || _inlineState$client === void 0 || (_inlineState$client = _inlineState$client.value) === null || _inlineState$client === void 0 ? void 0 : _inlineState$client.id,
173
+ customerId: inlineState === null || inlineState === void 0 || (_inlineState$client2 = inlineState.client) === null || _inlineState$client2 === void 0 || (_inlineState$client2 = _inlineState$client2.value) === null || _inlineState$client2 === void 0 ? void 0 : _inlineState$client2.id,
147
174
  source: currentCacheItem
148
175
  });
149
176
  if (!params) return;
@@ -157,20 +184,23 @@ const BookingEditHolderField = ({ state, cacheItem, required, value, onChange, g
157
184
  reloadHolderOptions();
158
185
  return list;
159
186
  }));
160
- const selectCreatedHolder = (0, ahooks.useMemoizedFn)((holder) => {
161
- var _ref4, _holder$id;
162
- if (!isNormalProduct) return;
163
- const id = (_ref4 = (_holder$id = holder === null || holder === void 0 ? void 0 : holder.id) !== null && _holder$id !== void 0 ? _holder$id : holder === null || holder === void 0 ? void 0 : holder.form_record_id) !== null && _ref4 !== void 0 ? _ref4 : holder === null || holder === void 0 ? void 0 : holder.value;
187
+ const applyCreatedHolderSelection = (0, ahooks.useMemoizedFn)((holder) => {
188
+ var _ref5, _holder$id2;
189
+ const id = (_ref5 = (_holder$id2 = holder === null || holder === void 0 ? void 0 : holder.id) !== null && _holder$id2 !== void 0 ? _holder$id2 : holder === null || holder === void 0 ? void 0 : holder.form_record_id) !== null && _ref5 !== void 0 ? _ref5 : holder === null || holder === void 0 ? void 0 : holder.value;
164
190
  if (id == null || selectedValues.some((value) => String(value) === String(id))) return;
165
191
  const nextValues = maxSelectedCount === 1 ? [id] : [...selectedValues.slice(0, Math.max(0, maxSelectedCount - 1)), id];
166
192
  setSelectedValues(nextValues);
167
193
  handleApply(nextValues);
168
194
  });
195
+ const selectCreatedHolder = (0, ahooks.useMemoizedFn)((holder) => {
196
+ if (!isNormalProduct) return;
197
+ applyCreatedHolderSelection(holder);
198
+ });
169
199
  const handleAddHolder = (0, ahooks.useMemoizedFn)(() => {
170
200
  if (!action || !inlineState) return;
171
201
  (function() {
172
- var _ref8 = require_asyncToGenerator._asyncToGenerator(function* () {
173
- var _inlineState$pet3, _waiverForm$form_id, _inlineState$client2, _inlineState$client3;
202
+ var _ref11 = require_asyncToGenerator._asyncToGenerator(function* () {
203
+ var _inlineState$pet3, _waiverForm$form_id, _inlineState$client3, _inlineState$pet4, _inlineState$client4;
174
204
  let waiverForm = (_inlineState$pet3 = inlineState.pet) === null || _inlineState$pet3 === void 0 ? void 0 : _inlineState$pet3.waiverForm;
175
205
  if (isMinorAndWaiver && !hasHolderFormFields(waiverForm)) {
176
206
  waiverForm = yield require_waiverFormDetailCache.getCachedWaiverFormDetail(Number(isMinorAndWaiver), platform);
@@ -181,37 +211,45 @@ const BookingEditHolderField = ({ state, cacheItem, required, value, onChange, g
181
211
  }
182
212
  const resolvedActionFormDataConfig = require_productHolderConfig.ensureProductHolderFormId(isMinorAndWaiver ? require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, waiverForm), {}, {
183
213
  form_id: (_waiverForm$form_id = waiverForm === null || waiverForm === void 0 ? void 0 : waiverForm.form_id) !== null && _waiverForm$form_id !== void 0 ? _waiverForm$form_id : Number(isMinorAndWaiver),
184
- customer_id: (_inlineState$client2 = inlineState.client) === null || _inlineState$client2 === void 0 || (_inlineState$client2 = _inlineState$client2.value) === null || _inlineState$client2 === void 0 ? void 0 : _inlineState$client2.id,
214
+ customer_id: (_inlineState$client3 = inlineState.client) === null || _inlineState$client3 === void 0 || (_inlineState$client3 = _inlineState$client3.value) === null || _inlineState$client3 === void 0 ? void 0 : _inlineState$client3.id,
185
215
  is_franchisor: formDataConfig === null || formDataConfig === void 0 ? void 0 : formDataConfig.is_franchisor
186
216
  }) : require_objectSpread2._objectSpread2({}, formDataConfig || {}), currentCacheItem);
187
217
  if (resolvedActionFormDataConfig.form_id === void 0 || resolvedActionFormDataConfig.form_id === null || resolvedActionFormDataConfig.form_id === "") {
188
218
  antd.message.error(_pisell_utils.locales.getText("pisell-select-holder-form-unavailable"));
189
219
  return;
190
220
  }
221
+ const previousHolderIds = new Set((((_inlineState$pet4 = inlineState.pet) === null || _inlineState$pet4 === void 0 ? void 0 : _inlineState$pet4.holders) || []).map((holder) => {
222
+ var _ref6, _holder$id3;
223
+ return String((_ref6 = (_holder$id3 = holder.id) !== null && _holder$id3 !== void 0 ? _holder$id3 : holder.form_record_id) !== null && _ref6 !== void 0 ? _ref6 : holder.value);
224
+ }));
191
225
  action({
192
226
  type: "pisell1.goCustomFormAddData",
193
227
  data: {
194
228
  zIndex: 1101,
195
- customerId: (_inlineState$client3 = inlineState.client) === null || _inlineState$client3 === void 0 || (_inlineState$client3 = _inlineState$client3.value) === null || _inlineState$client3 === void 0 ? void 0 : _inlineState$client3.id,
229
+ customerId: (_inlineState$client4 = inlineState.client) === null || _inlineState$client4 === void 0 || (_inlineState$client4 = _inlineState$client4.value) === null || _inlineState$client4 === void 0 ? void 0 : _inlineState$client4.id,
196
230
  formDataConfig: resolvedActionFormDataConfig
197
231
  },
198
232
  callback: function() {
199
- var _ref7 = require_asyncToGenerator._asyncToGenerator(function* (res) {
200
- var _inlineState$client4, _inlineState$pet5;
233
+ var _ref10 = require_asyncToGenerator._asyncToGenerator(function* (res) {
234
+ var _inlineState$client5, _inlineState$pet6;
201
235
  const obj = {};
202
236
  for (const item of Array.isArray(res) ? res : []) obj[item.key] = item.value;
203
237
  if (isMinorAndWaiver) {
204
238
  try {
205
239
  const list = yield refreshHoldersFromServer();
240
+ if (isInline && !isNormalProduct) applyCreatedHolderSelection(list === null || list === void 0 ? void 0 : list.find((holder) => {
241
+ var _ref7, _holder$id4;
242
+ return !previousHolderIds.has(String((_ref7 = (_holder$id4 = holder.id) !== null && _holder$id4 !== void 0 ? _holder$id4 : holder.form_record_id) !== null && _ref7 !== void 0 ? _ref7 : holder.value));
243
+ }));
206
244
  if (isNormalProduct) {
207
- var _inlineState$pet4;
208
- const previousIds = new Set((((_inlineState$pet4 = inlineState.pet) === null || _inlineState$pet4 === void 0 ? void 0 : _inlineState$pet4.holders) || []).map((holder) => {
209
- var _ref5, _holder$id2;
210
- return String((_ref5 = (_holder$id2 = holder.id) !== null && _holder$id2 !== void 0 ? _holder$id2 : holder.form_record_id) !== null && _ref5 !== void 0 ? _ref5 : holder.value);
245
+ var _inlineState$pet5;
246
+ const previousIds = new Set((((_inlineState$pet5 = inlineState.pet) === null || _inlineState$pet5 === void 0 ? void 0 : _inlineState$pet5.holders) || []).map((holder) => {
247
+ var _ref8, _holder$id5;
248
+ return String((_ref8 = (_holder$id5 = holder.id) !== null && _holder$id5 !== void 0 ? _holder$id5 : holder.form_record_id) !== null && _ref8 !== void 0 ? _ref8 : holder.value);
211
249
  }));
212
250
  selectCreatedHolder(list === null || list === void 0 ? void 0 : list.find((holder) => {
213
- var _ref6, _holder$id3;
214
- return !previousIds.has(String((_ref6 = (_holder$id3 = holder.id) !== null && _holder$id3 !== void 0 ? _holder$id3 : holder.form_record_id) !== null && _ref6 !== void 0 ? _ref6 : holder.value));
251
+ var _ref9, _holder$id6;
252
+ return !previousIds.has(String((_ref9 = (_holder$id6 = holder.id) !== null && _holder$id6 !== void 0 ? _holder$id6 : holder.form_record_id) !== null && _ref9 !== void 0 ? _ref9 : holder.value));
215
253
  }));
216
254
  }
217
255
  } catch (err) {
@@ -219,22 +257,23 @@ const BookingEditHolderField = ({ state, cacheItem, required, value, onChange, g
219
257
  }
220
258
  return;
221
259
  }
222
- if (require_utils$1.isWalkIn((_inlineState$client4 = inlineState.client) === null || _inlineState$client4 === void 0 || (_inlineState$client4 = _inlineState$client4.value) === null || _inlineState$client4 === void 0 ? void 0 : _inlineState$client4.id)) return;
260
+ if (require_utils$1.isWalkIn((_inlineState$client5 = inlineState.client) === null || _inlineState$client5 === void 0 || (_inlineState$client5 = _inlineState$client5.value) === null || _inlineState$client5 === void 0 ? void 0 : _inlineState$client5.id)) return;
223
261
  inlineDispatch({
224
262
  type: "setPet",
225
- payload: { holders: [obj, ...((_inlineState$pet5 = inlineState.pet) === null || _inlineState$pet5 === void 0 ? void 0 : _inlineState$pet5.holders) || []] }
263
+ payload: { holders: [obj, ...((_inlineState$pet6 = inlineState.pet) === null || _inlineState$pet6 === void 0 ? void 0 : _inlineState$pet6.holders) || []] }
226
264
  });
227
265
  upsertHolderOptions([obj], currentCacheItem);
266
+ if (isInline && !isNormalProduct) applyCreatedHolderSelection(obj);
228
267
  selectCreatedHolder(obj);
229
268
  });
230
269
  return function callback(_x) {
231
- return _ref7.apply(this, arguments);
270
+ return _ref10.apply(this, arguments);
232
271
  };
233
272
  }()
234
273
  });
235
274
  });
236
275
  return function run() {
237
- return _ref8.apply(this, arguments);
276
+ return _ref11.apply(this, arguments);
238
277
  };
239
278
  })()().catch((error) => {
240
279
  console.warn("[SalesSdk] open add holder form failed", error);
@@ -246,7 +285,7 @@ const BookingEditHolderField = ({ state, cacheItem, required, value, onChange, g
246
285
  handleApply(nextValues);
247
286
  }, [handleApply]);
248
287
  const handleEdit = (0, react.useCallback)(function() {
249
- var _ref9 = require_asyncToGenerator._asyncToGenerator(function* (event) {
288
+ var _ref12 = require_asyncToGenerator._asyncToGenerator(function* (event) {
250
289
  var _latestCacheItem$_ext, _latestCacheItem$_ext2, _state$client;
251
290
  event === null || event === void 0 || event.preventDefault();
252
291
  const latestCacheItem = (getCurrentCacheItem === null || getCurrentCacheItem === void 0 ? void 0 : getCurrentCacheItem()) || cacheItem;
@@ -265,7 +304,7 @@ const BookingEditHolderField = ({ state, cacheItem, required, value, onChange, g
265
304
  }
266
305
  });
267
306
  return function(_x2) {
268
- return _ref9.apply(this, arguments);
307
+ return _ref12.apply(this, arguments);
269
308
  };
270
309
  }(), [
271
310
  bridges.holder,
@@ -300,7 +339,7 @@ const BookingEditHolderField = ({ state, cacheItem, required, value, onChange, g
300
339
  holders: inlineHolders,
301
340
  productSource: currentCacheItem,
302
341
  holderTitle: title,
303
- customerId: inlineState === null || inlineState === void 0 || (_inlineState$client5 = inlineState.client) === null || _inlineState$client5 === void 0 || (_inlineState$client5 = _inlineState$client5.value) === null || _inlineState$client5 === void 0 ? void 0 : _inlineState$client5.id,
342
+ customerId: inlineState === null || inlineState === void 0 || (_inlineState$client6 = inlineState.client) === null || _inlineState$client6 === void 0 || (_inlineState$client6 = _inlineState$client6.value) === null || _inlineState$client6 === void 0 ? void 0 : _inlineState$client6.id,
304
343
  initialValue: selectedValues,
305
344
  maxSelectedCount,
306
345
  onAddHolder: action ? handleAddHolder : void 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "6.12.362",
3
+ "version": "6.12.363",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -75,9 +75,9 @@
75
75
  "use-sync-external-store": "^1.6.0",
76
76
  "@pisell/pi-payment-sdk": "0.0.4",
77
77
  "@pisell/utils": "3.0.7",
78
- "@pisell/materials": "6.12.86",
79
78
  "@pisell/icon": "0.0.11",
80
- "@pisell/date-picker": "3.0.12"
79
+ "@pisell/date-picker": "3.0.12",
80
+ "@pisell/materials": "6.12.86"
81
81
  },
82
82
  "peerDependencies": {
83
83
  "react": "^18.0.0",
@@ -1 +0,0 @@
1
- export { };