@pisell/private-materials 3.0.65 → 3.0.67

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.
@@ -408,6 +408,16 @@ var Footer = function Footer(props) {
408
408
  * @Date: 2024-01-30 16:57
409
409
  */
410
410
  var handleRefund = function handleRefund() {
411
+ if (isTerminal !== null && isTerminal !== void 0 && isTerminal()) {
412
+ var _interaction$utils2, _interaction$utils2$p;
413
+ return interaction === null || interaction === void 0 ? void 0 : (_interaction$utils2 = interaction.utils) === null || _interaction$utils2 === void 0 ? void 0 : (_interaction$utils2$p = _interaction$utils2.postMessageToApp) === null || _interaction$utils2$p === void 0 ? void 0 : _interaction$utils2$p.call(_interaction$utils2, {
414
+ module: "booking",
415
+ key: "booking_refund",
416
+ data: {
417
+ order_id: state.bookingId
418
+ }
419
+ });
420
+ }
411
421
  state.action({
412
422
  type: "pisell1.handleRefund",
413
423
  data: {
@@ -466,9 +476,9 @@ var Footer = function Footer(props) {
466
476
  id: res === null || res === void 0 ? void 0 : res.customer_id
467
477
  } : state.bookingDetail.customer;
468
478
  case 8:
469
- if (e.key === 'sendMail') {
479
+ if (e.key === "sendMail") {
470
480
  state.action({
471
- type: 'pisell1.sendPayLinkEmail',
481
+ type: "pisell1.sendPayLinkEmail",
472
482
  data: {
473
483
  id: id,
474
484
  is_deposit: state.bookingDetail.is_deposit || Number((_state$bookingDetail = state.bookingDetail) === null || _state$bookingDetail === void 0 ? void 0 : _state$bookingDetail.deposit_amount),
@@ -479,9 +489,9 @@ var Footer = function Footer(props) {
479
489
  callback: function callback() {}
480
490
  });
481
491
  }
482
- if (e.key === 'copy') {
492
+ if (e.key === "copy") {
483
493
  state.action({
484
- type: 'pisell1.genClientPayLink',
494
+ type: "pisell1.genClientPayLink",
485
495
  data: {
486
496
  id: id
487
497
  },
@@ -500,11 +510,11 @@ var Footer = function Footer(props) {
500
510
  }();
501
511
  var paymentLinkButton = useMemo(function () {
502
512
  var items = [{
503
- label: locales.getText('pisell2.text.send-mail'),
504
- key: 'sendMail'
513
+ label: locales.getText("pisell2.text.send-mail"),
514
+ key: "sendMail"
505
515
  }, {
506
- label: locales.getText('pisell2.text.copy-to-clipboard'),
507
- key: 'copy'
516
+ label: locales.getText("pisell2.text.copy-to-clipboard"),
517
+ key: "copy"
508
518
  }];
509
519
  return /*#__PURE__*/React.createElement(Dropdown, {
510
520
  menu: {
@@ -513,7 +523,7 @@ var Footer = function Footer(props) {
513
523
  }
514
524
  }, /*#__PURE__*/React.createElement(Button, {
515
525
  className: "pisell-lowcode__booking-footer-buttons-item"
516
- }, /*#__PURE__*/React.createElement(Space, null, locales.getText('pisell2.text.payment-link'), /*#__PURE__*/React.createElement(DownOutlined, null))));
526
+ }, /*#__PURE__*/React.createElement(Space, null, locales.getText("pisell2.text.payment-link"), /*#__PURE__*/React.createElement(DownOutlined, null))));
517
527
  }, [handleMenuClick]);
518
528
 
519
529
  /**
@@ -667,7 +677,7 @@ var Footer = function Footer(props) {
667
677
  var isOnlyDeposit = useMemo(function () {
668
678
  var _state$bookingDetail6, _state$bookingDetail7, _state$bookingDetail8, _state$bookingDetail9;
669
679
  if (state !== null && state !== void 0 && (_state$bookingDetail6 = state.bookingDetail) !== null && _state$bookingDetail6 !== void 0 && _state$bookingDetail6.deposit_payment_time && state !== null && state !== void 0 && (_state$bookingDetail7 = state.bookingDetail) !== null && _state$bookingDetail7 !== void 0 && (_state$bookingDetail8 = _state$bookingDetail7.payment_types) !== null && _state$bookingDetail8 !== void 0 && (_state$bookingDetail9 = _state$bookingDetail8.every) !== null && _state$bookingDetail9 !== void 0 && _state$bookingDetail9.call(_state$bookingDetail8, function (item) {
670
- return item === 'deposit';
680
+ return item === "deposit";
671
681
  })) {
672
682
  return true;
673
683
  }
@@ -181,8 +181,8 @@ export var checkCacheItemResource = function checkCacheItemResource(_ref5) {
181
181
  }
182
182
  } else {
183
183
  if (cacheItem.new) {
184
- if (resources.length === 2) {
185
- resourceId = resources[1].form_record_id;
184
+ if (resources.length <= 2) {
185
+ resourceId = resources[resources.length - 1].form_record_id;
186
186
  }
187
187
  if (resources.length > 2) {
188
188
  var usableList = resources.filter(function (d) {
@@ -161,7 +161,10 @@ var Footer = (props) => {
161
161
  console.log("state.bookingId && state.addons.edit", err);
162
162
  }
163
163
  };
164
- const handleSave = async ({ type, messageShow = true }) => {
164
+ const handleSave = async ({
165
+ type,
166
+ messageShow = true
167
+ }) => {
165
168
  var _a2;
166
169
  let _setLoading = type === "checkout" ? setCheckoutLoading : setLoading;
167
170
  _setLoading(true);
@@ -212,6 +215,16 @@ var Footer = (props) => {
212
215
  state == null ? void 0 : state.callback({ order_id: state.bookingId });
213
216
  };
214
217
  const handleRefund = () => {
218
+ var _a2, _b2;
219
+ if (isTerminal == null ? void 0 : isTerminal()) {
220
+ return (_b2 = (_a2 = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _a2.postMessageToApp) == null ? void 0 : _b2.call(_a2, {
221
+ module: "booking",
222
+ key: "booking_refund",
223
+ data: {
224
+ order_id: state.bookingId
225
+ }
226
+ });
227
+ }
215
228
  state.action({
216
229
  type: "pisell1.handleRefund",
217
230
  data: {
@@ -276,19 +289,7 @@ var Footer = (props) => {
276
289
  { label: import_utils.locales.getText("pisell2.text.send-mail"), key: "sendMail" },
277
290
  { label: import_utils.locales.getText("pisell2.text.copy-to-clipboard"), key: "copy" }
278
291
  ];
279
- return /* @__PURE__ */ import_react.default.createElement(
280
- import_antd.Dropdown,
281
- {
282
- menu: { items, onClick: handleMenuClick }
283
- },
284
- /* @__PURE__ */ import_react.default.createElement(
285
- import_antd2.Button,
286
- {
287
- className: "pisell-lowcode__booking-footer-buttons-item"
288
- },
289
- /* @__PURE__ */ import_react.default.createElement(import_antd.Space, null, import_utils.locales.getText("pisell2.text.payment-link"), /* @__PURE__ */ import_react.default.createElement(import_icons.DownOutlined, null))
290
- )
291
- );
292
+ return /* @__PURE__ */ import_react.default.createElement(import_antd.Dropdown, { menu: { items, onClick: handleMenuClick } }, /* @__PURE__ */ import_react.default.createElement(import_antd2.Button, { className: "pisell-lowcode__booking-footer-buttons-item" }, /* @__PURE__ */ import_react.default.createElement(import_antd.Space, null, import_utils.locales.getText("pisell2.text.payment-link"), /* @__PURE__ */ import_react.default.createElement(import_icons.DownOutlined, null))));
292
293
  }, [handleMenuClick]);
293
294
  const saveButton = (0, import_react.useMemo)(() => {
294
295
  return /* @__PURE__ */ import_react.default.createElement(
@@ -410,7 +411,10 @@ var Footer = (props) => {
410
411
  ]);
411
412
  const isOnlyDeposit = (0, import_react.useMemo)(() => {
412
413
  var _a2, _b2, _c2, _d2;
413
- if (((_a2 = state == null ? void 0 : state.bookingDetail) == null ? void 0 : _a2.deposit_payment_time) && ((_d2 = (_c2 = (_b2 = state == null ? void 0 : state.bookingDetail) == null ? void 0 : _b2.payment_types) == null ? void 0 : _c2.every) == null ? void 0 : _d2.call(_c2, (item) => item === "deposit"))) {
414
+ if (((_a2 = state == null ? void 0 : state.bookingDetail) == null ? void 0 : _a2.deposit_payment_time) && ((_d2 = (_c2 = (_b2 = state == null ? void 0 : state.bookingDetail) == null ? void 0 : _b2.payment_types) == null ? void 0 : _c2.every) == null ? void 0 : _d2.call(
415
+ _c2,
416
+ (item) => item === "deposit"
417
+ ))) {
414
418
  return true;
415
419
  }
416
420
  return false;
@@ -419,9 +423,7 @@ var Footer = (props) => {
419
423
  var _a2;
420
424
  let str = "";
421
425
  if (isOnlyDeposit) {
422
- return `${import_utils.locales.getText(
423
- "pisell2.text.deposit-paid"
424
- )} ${(0, import_utils.formatAmount)(
426
+ return `${import_utils.locales.getText("pisell2.text.deposit-paid")} ${(0, import_utils.formatAmount)(
425
427
  (_a2 = state == null ? void 0 : state.bookingDetail) == null ? void 0 : _a2.deposit_amount,
426
428
  2,
427
429
  (state == null ? void 0 : state.amountSymbol) || "$"
@@ -163,8 +163,8 @@ var checkCacheItemResource = ({ cacheItem, resources }) => {
163
163
  }
164
164
  } else {
165
165
  if (cacheItem.new) {
166
- if (resources.length === 2) {
167
- resourceId = resources[1].form_record_id;
166
+ if (resources.length <= 2) {
167
+ resourceId = resources[resources.length - 1].form_record_id;
168
168
  }
169
169
  if (resources.length > 2) {
170
170
  const usableList = resources.filter(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "3.0.65",
3
+ "version": "3.0.67",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -58,8 +58,8 @@
58
58
  "ahooks": "^3.7.6",
59
59
  "react-infinite-scroll-component": "^6.1.0",
60
60
  "rc-virtual-list": "^3.11.3",
61
- "@pisell/icon": "0.0.8",
62
61
  "@pisell/utils": "1.0.24",
62
+ "@pisell/icon": "0.0.8",
63
63
  "@pisell/date-picker": "1.0.69"
64
64
  },
65
65
  "peerDependencies": {