@pisell/private-materials 6.11.645 → 6.11.646
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/preview.js +1 -1
- package/build/lowcode/render/default/view.js +18 -18
- package/build/lowcode/view.js +18 -18
- package/es/components/bigSale/index.js +1 -0
- package/es/components/bigSale/templates/Kiosk/index.js +104 -47
- package/es/components/kioskSale/index.js +1 -1
- package/es/plus/salesSdk/bookingEditService/BookingEditHolderField.js +6 -6
- package/es/plus/salesSdk/components/SalesSdkConfirmHolderModal.js +2 -4
- package/es/plus/salesSdk/context/SalesSdkCartContext.js +28 -21
- package/es/plus/salesSdk/context/SalesSdkHolderContext.js +104 -22
- package/es/plus/salesSdk/context/SalesSdkProvider.js +3 -12
- package/es/plus/salesSdk/hosts/ConfirmHolderHostRenderer.js +14 -5
- package/es/plus/salesSdk/normalProductDetail/NormalProductDetailHostRenderer.js +5 -2
- package/es/plus/salesSdk/types.d.ts +16 -1
- package/es/plus/salesSdk/utils/customerAuthGate.js +1 -4
- package/es/plus/salesSdk/utils/enrichCacheItemBeforeAdd.js +1 -1
- package/es/plus/salesSdk/utils/ensureCustomerAuthBeforeAdd.js +6 -6
- package/es/plus/salesSdk/utils/holderSubmitValidation.js +3 -4
- package/es/plus/salesSdk/utils/productHolderConfig.js +3 -17
- package/es/plus/salesSdk/utils/runAddProductFlow.js +14 -5
- package/es/pro/skuDetailModal/flow/modules/holder/index.js +4 -1
- package/lib/components/bigSale/index.js +1 -0
- package/lib/components/bigSale/templates/Kiosk/index.js +104 -47
- package/lib/components/kioskSale/index.js +1 -1
- package/lib/plus/salesSdk/bookingEditService/BookingEditHolderField.js +5 -5
- package/lib/plus/salesSdk/components/SalesSdkConfirmHolderModal.js +2 -4
- package/lib/plus/salesSdk/context/SalesSdkCartContext.js +28 -21
- package/lib/plus/salesSdk/context/SalesSdkHolderContext.js +104 -22
- package/lib/plus/salesSdk/context/SalesSdkProvider.js +3 -12
- package/lib/plus/salesSdk/hosts/ConfirmHolderHostRenderer.js +14 -5
- package/lib/plus/salesSdk/normalProductDetail/NormalProductDetailHostRenderer.js +5 -2
- package/lib/plus/salesSdk/types.d.ts +16 -1
- package/lib/plus/salesSdk/utils/customerAuthGate.js +1 -4
- package/lib/plus/salesSdk/utils/enrichCacheItemBeforeAdd.js +1 -1
- package/lib/plus/salesSdk/utils/ensureCustomerAuthBeforeAdd.js +6 -6
- package/lib/plus/salesSdk/utils/holderSubmitValidation.js +3 -4
- package/lib/plus/salesSdk/utils/productHolderConfig.js +3 -17
- package/lib/plus/salesSdk/utils/runAddProductFlow.js +14 -5
- package/lib/pro/skuDetailModal/flow/modules/holder/index.js +4 -1
- package/package.json +4 -4
|
@@ -131,6 +131,7 @@ const BigSale = ({ osKey = DEFAULT_OS_KEY, osModuleName, selectionFlowScene, lif
|
|
|
131
131
|
bookingConfigParams,
|
|
132
132
|
autoInitBookingContext,
|
|
133
133
|
otherParams,
|
|
134
|
+
deferHolderAuthOnClose: resolvedTemplate === "kiosk",
|
|
134
135
|
shouldMergeProductLines,
|
|
135
136
|
rulesHooks,
|
|
136
137
|
legacyOpenProductDetail,
|
|
@@ -5,6 +5,7 @@ import { useSalesSdkHostBridges } from "../../../../plus/salesSdk/context/SalesS
|
|
|
5
5
|
import useSalesUserLogin, { isRequireLoginChannel } from "../../../../hooks/useSalesUserLogin.js";
|
|
6
6
|
import { resolvePaymentResultToastV2ViewModel } from "../../../checkout/components/PaymentResultToastV2/resolve.js";
|
|
7
7
|
import PaymentResultToastV2_default from "../../../checkout/components/PaymentResultToastV2/index.js";
|
|
8
|
+
import { freePayApi } from "../../../Sales/Checkout/serve.js";
|
|
8
9
|
import { useSalesSdk } from "../../../../plus/salesSdk/hooks/useSalesSdk.js";
|
|
9
10
|
import { usePickSaleDetailContext } from "../../hooks/usePickSaleDetailContext.js";
|
|
10
11
|
import { resolveBigSaleAutoProductListPreferences } from "../../utils/productListPreferences.js";
|
|
@@ -36,11 +37,52 @@ function publishKioskCollaborationPreviewStatus(app, status) {
|
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
39
|
const KIOSK_VIEW_SESSION_KEY = "bigSale.kiosk.view";
|
|
40
|
+
function toFiniteAmount(value) {
|
|
41
|
+
if (value === void 0 || value === null || value === "") return null;
|
|
42
|
+
const amount = Number(value);
|
|
43
|
+
return Number.isFinite(amount) ? amount : null;
|
|
44
|
+
}
|
|
45
|
+
function resolveKioskAmountDue(summary) {
|
|
46
|
+
var _toFiniteAmount;
|
|
47
|
+
if (!summary) return null;
|
|
48
|
+
const orderPaidAmount = toFiniteAmount(summary.order_paid_amount);
|
|
49
|
+
if (orderPaidAmount !== null && orderPaidAmount > 0) return toFiniteAmount(summary.amount_gap);
|
|
50
|
+
return (_toFiniteAmount = toFiniteAmount(summary.expect_amount)) !== null && _toFiniteAmount !== void 0 ? _toFiniteAmount : toFiniteAmount(summary.total_amount);
|
|
51
|
+
}
|
|
52
|
+
function isH5ZeroAmountCheckout(platform, summary) {
|
|
53
|
+
return isH5ZeroAmountValue(platform, resolveKioskAmountDue(summary));
|
|
54
|
+
}
|
|
55
|
+
function isH5ZeroAmountValue(platform, amount) {
|
|
56
|
+
return String(platform || "").trim().toLowerCase() === "h5" && toFiniteAmount(amount) === 0;
|
|
57
|
+
}
|
|
58
|
+
function shouldSubmitKioskOrderBeforeCheckout(options) {
|
|
59
|
+
return options.shouldUseConsumerPayment || isH5ZeroAmountCheckout(options.platform, options.summary);
|
|
60
|
+
}
|
|
61
|
+
function resolveKioskSubmittedPayableAmount(result, tempOrderSummary, contextSummary) {
|
|
62
|
+
var _result$data, _result$data2, _result$data3;
|
|
63
|
+
return [
|
|
64
|
+
result === null || result === void 0 || (_result$data = result.data) === null || _result$data === void 0 ? void 0 : _result$data.order_wait_pay_amount,
|
|
65
|
+
result === null || result === void 0 || (_result$data2 = result.data) === null || _result$data2 === void 0 ? void 0 : _result$data2.expect_amount,
|
|
66
|
+
result === null || result === void 0 || (_result$data3 = result.data) === null || _result$data3 === void 0 ? void 0 : _result$data3.total_amount,
|
|
67
|
+
tempOrderSummary === null || tempOrderSummary === void 0 ? void 0 : tempOrderSummary.expect_amount,
|
|
68
|
+
tempOrderSummary === null || tempOrderSummary === void 0 ? void 0 : tempOrderSummary.total_amount,
|
|
69
|
+
contextSummary === null || contextSummary === void 0 ? void 0 : contextSummary.expect_amount,
|
|
70
|
+
contextSummary === null || contextSummary === void 0 ? void 0 : contextSummary.total_amount
|
|
71
|
+
].find((value) => toFiniteAmount(value) !== null);
|
|
72
|
+
}
|
|
39
73
|
function launchKioskConsumerPaymentAfterReset(_x) {
|
|
40
74
|
return _launchKioskConsumerPaymentAfterReset.apply(this, arguments);
|
|
41
75
|
}
|
|
42
76
|
function _launchKioskConsumerPaymentAfterReset() {
|
|
43
|
-
_launchKioskConsumerPaymentAfterReset = _asyncToGenerator(function* ({ action, clearCartAndReset, clearSessionStorageOrderSnapshot, onResetError, orderId, persistCatalogView, recalcSummary, replace, totalAmount }) {
|
|
77
|
+
_launchKioskConsumerPaymentAfterReset = _asyncToGenerator(function* ({ action, clearCartAndReset, clearSessionStorageOrderSnapshot, freePay, onFreePayFailure, onResetError, orderId, persistCatalogView, recalcSummary, redirectZeroAmount, replace, totalAmount }) {
|
|
78
|
+
const shouldRedirectZeroAmount = redirectZeroAmount && Number(totalAmount) === 0;
|
|
79
|
+
if (shouldRedirectZeroAmount) {
|
|
80
|
+
const freePayResult = yield freePay(String(orderId));
|
|
81
|
+
if (!(freePayResult === null || freePayResult === void 0 ? void 0 : freePayResult.status)) {
|
|
82
|
+
onFreePayFailure(freePayResult);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
44
86
|
try {
|
|
45
87
|
yield clearCartAndReset();
|
|
46
88
|
yield recalcSummary();
|
|
@@ -49,7 +91,7 @@ function _launchKioskConsumerPaymentAfterReset() {
|
|
|
49
91
|
onResetError(error);
|
|
50
92
|
}
|
|
51
93
|
persistCatalogView();
|
|
52
|
-
if (
|
|
94
|
+
if (shouldRedirectZeroAmount) {
|
|
53
95
|
replace(`/payment-finish/success?amount=${totalAmount}&order_id=${orderId}`);
|
|
54
96
|
return;
|
|
55
97
|
}
|
|
@@ -153,7 +195,8 @@ function KioskBigSaleTemplate({ isActive = true, osKey, context, mode, variant,
|
|
|
153
195
|
var _engineContext$appHel, _utils$getApp, _engineContext$appHel2;
|
|
154
196
|
locales.init(locales_default, locale || "en");
|
|
155
197
|
const engineContext = useEngineContext();
|
|
156
|
-
const
|
|
198
|
+
const platform = String(usePlatform() || "").trim().toLowerCase();
|
|
199
|
+
const isH5Platform = platform === "h5";
|
|
157
200
|
const utils = (engineContext === null || engineContext === void 0 || (_engineContext$appHel = engineContext.appHelper) === null || _engineContext$appHel === void 0 ? void 0 : _engineContext$appHel.utils) || {};
|
|
158
201
|
const app = (_utils$getApp = utils.getApp) === null || _utils$getApp === void 0 ? void 0 : _utils$getApp.call(utils);
|
|
159
202
|
const hostChannel = String((engineContext === null || engineContext === void 0 || (_engineContext$appHel2 = engineContext.appHelper) === null || _engineContext$appHel2 === void 0 || (_engineContext$appHel2 = _engineContext$appHel2.constants) === null || _engineContext$appHel2 === void 0 || (_engineContext$appHel2 = _engineContext$appHel2.config) === null || _engineContext$appHel2 === void 0 ? void 0 : _engineContext$appHel2.channel) || "").trim().toLowerCase();
|
|
@@ -460,14 +503,20 @@ function KioskBigSaleTemplate({ isActive = true, osKey, context, mode, variant,
|
|
|
460
503
|
checkoutOpeningRef.current = true;
|
|
461
504
|
setIsCheckoutLoading(true);
|
|
462
505
|
try {
|
|
463
|
-
var _result$payload$payme, _result$payload, _result$data5;
|
|
464
|
-
if (shouldUseConsumerPayment)
|
|
465
|
-
|
|
466
|
-
|
|
506
|
+
var _ref7, _context$sales$bookin5, _context$sales$bookin6, _context$sales$bookin7, _ref8, _ref9, _result$payload$payme, _result$payload, _result$data5;
|
|
507
|
+
if (shouldUseConsumerPayment && typeof utils.action !== "function") throw new Error("[KioskBigSale] appHelper.utils.action is not available.");
|
|
508
|
+
yield context.cart.waitForCartConsistency();
|
|
509
|
+
const currentTempOrder = (_ref7 = (_context$sales$bookin5 = (_context$sales$bookin6 = context.sales.bookingTicket) === null || _context$sales$bookin6 === void 0 || (_context$sales$bookin7 = _context$sales$bookin6.getTempOrder) === null || _context$sales$bookin7 === void 0 ? void 0 : _context$sales$bookin7.call(_context$sales$bookin6)) !== null && _context$sales$bookin5 !== void 0 ? _context$sales$bookin5 : context.sales.tempOrder) !== null && _ref7 !== void 0 ? _ref7 : null;
|
|
510
|
+
if (shouldSubmitKioskOrderBeforeCheckout({
|
|
511
|
+
platform,
|
|
512
|
+
summary: (_ref8 = (_ref9 = context.summary.summary) !== null && _ref9 !== void 0 ? _ref9 : currentTempOrder === null || currentTempOrder === void 0 ? void 0 : currentTempOrder.summary) !== null && _ref8 !== void 0 ? _ref8 : null,
|
|
513
|
+
shouldUseConsumerPayment
|
|
514
|
+
})) {
|
|
515
|
+
var _ref12, _context$sales$bookin8, _context$sales$bookin9, _context$sales$bookin10;
|
|
467
516
|
const result = yield context.cart.submit();
|
|
468
517
|
if (!isSalesOrderSubmitSuccess(result)) {
|
|
469
|
-
var
|
|
470
|
-
showCheckoutFailure(String((
|
|
518
|
+
var _ref10, _ref11, _result$message, _result$data4;
|
|
519
|
+
showCheckoutFailure(String((_ref10 = (_ref11 = (_result$message = result === null || result === void 0 ? void 0 : result.message) !== null && _result$message !== void 0 ? _result$message : result === null || result === void 0 ? void 0 : result.msg) !== null && _ref11 !== void 0 ? _ref11 : result === null || result === void 0 || (_result$data4 = result.data) === null || _result$data4 === void 0 ? void 0 : _result$data4.message) !== null && _ref10 !== void 0 ? _ref10 : locales.getText("pisell2.big-sale.kiosk.payment-failure-description")));
|
|
471
520
|
return;
|
|
472
521
|
}
|
|
473
522
|
const orderId = resolveSaleDetailOrderIdFromSalesResult(context.sales, result);
|
|
@@ -475,45 +524,53 @@ function KioskBigSaleTemplate({ isActive = true, osKey, context, mode, variant,
|
|
|
475
524
|
showCheckoutFailure(String(locales.getText("pisell2.big-sale.kiosk.payment-failure-description")));
|
|
476
525
|
return;
|
|
477
526
|
}
|
|
478
|
-
const tempOrder = (
|
|
479
|
-
const totalAmount = (
|
|
480
|
-
if (totalAmount ===
|
|
527
|
+
const tempOrder = (_ref12 = (_context$sales$bookin8 = (_context$sales$bookin9 = context.sales.bookingTicket) === null || _context$sales$bookin9 === void 0 || (_context$sales$bookin10 = _context$sales$bookin9.getTempOrder) === null || _context$sales$bookin10 === void 0 ? void 0 : _context$sales$bookin10.call(_context$sales$bookin9)) !== null && _context$sales$bookin8 !== void 0 ? _context$sales$bookin8 : context.sales.tempOrder) !== null && _ref12 !== void 0 ? _ref12 : null;
|
|
528
|
+
const totalAmount = resolveKioskSubmittedPayableAmount(result, tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.summary, context.summary.summary);
|
|
529
|
+
if (toFiniteAmount(totalAmount) === null) {
|
|
481
530
|
showCheckoutFailure(String(locales.getText("pisell2.big-sale.kiosk.payment-failure-description")));
|
|
482
531
|
return;
|
|
483
532
|
}
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
533
|
+
const shouldRedirectH5ZeroAmount = isH5ZeroAmountValue(platform, totalAmount);
|
|
534
|
+
if (shouldUseConsumerPayment || shouldRedirectH5ZeroAmount) {
|
|
535
|
+
publishKioskCollaborationPreviewStatus(app, "checkout");
|
|
536
|
+
yield launchKioskConsumerPaymentAfterReset({
|
|
537
|
+
action: utils.action,
|
|
538
|
+
clearCartAndReset: context.sales.clearCartAndReset,
|
|
539
|
+
clearSessionStorageOrderSnapshot: () => {
|
|
540
|
+
var _context$sales$bookin11, _context$sales$bookin12;
|
|
541
|
+
(_context$sales$bookin11 = context.sales.bookingTicket) === null || _context$sales$bookin11 === void 0 || (_context$sales$bookin12 = _context$sales$bookin11.clearSessionStorageOrderSnapshot) === null || _context$sales$bookin12 === void 0 || _context$sales$bookin12.call(_context$sales$bookin11);
|
|
542
|
+
},
|
|
543
|
+
freePay: (freePayOrderId) => freePayApi(freePayOrderId),
|
|
544
|
+
onFreePayFailure: (freePayResult) => {
|
|
545
|
+
var _freePayResult$messag;
|
|
546
|
+
showCheckoutFailure(String((_freePayResult$messag = freePayResult === null || freePayResult === void 0 ? void 0 : freePayResult.message) !== null && _freePayResult$messag !== void 0 ? _freePayResult$messag : locales.getText("pisell2.big-sale.kiosk.payment-failure-description")));
|
|
547
|
+
},
|
|
548
|
+
onResetError: (error) => {
|
|
549
|
+
console.error("[KioskBigSale] 结账跳转前重置本地订单失败,继续当前流程", error);
|
|
550
|
+
},
|
|
551
|
+
orderId,
|
|
552
|
+
persistCatalogView: () => {
|
|
553
|
+
persistKioskSessionView(context.sales.bookingTicket, "catalog");
|
|
554
|
+
},
|
|
555
|
+
recalcSummary: context.cart.recalcSummary,
|
|
556
|
+
redirectZeroAmount: shouldRedirectH5ZeroAmount,
|
|
557
|
+
replace: (path) => {
|
|
558
|
+
var _utils$history, _app$history2;
|
|
559
|
+
if (typeof (utils === null || utils === void 0 || (_utils$history = utils.history) === null || _utils$history === void 0 ? void 0 : _utils$history.replace) === "function") {
|
|
560
|
+
utils.history.replace(path);
|
|
561
|
+
return;
|
|
562
|
+
}
|
|
563
|
+
if (typeof (app === null || app === void 0 || (_app$history2 = app.history) === null || _app$history2 === void 0 ? void 0 : _app$history2.replace) === "function") {
|
|
564
|
+
app.history.replace(path);
|
|
565
|
+
return;
|
|
566
|
+
}
|
|
567
|
+
window.location.replace(path);
|
|
568
|
+
},
|
|
569
|
+
totalAmount
|
|
570
|
+
});
|
|
571
|
+
return;
|
|
572
|
+
}
|
|
515
573
|
}
|
|
516
|
-
yield context.cart.waitForCartConsistency();
|
|
517
574
|
publishKioskCollaborationPreviewStatus(app, "checkout");
|
|
518
575
|
const result = yield context.sales.openCheckout({
|
|
519
576
|
paymentResultDisplayMode: "page",
|
|
@@ -561,10 +618,10 @@ function KioskBigSaleTemplate({ isActive = true, osKey, context, mode, variant,
|
|
|
561
618
|
return (runtimeDiscountList.length > 0 ? runtimeDiscountList : context.cart.discountList || []).some((discount) => isCustomerVoucher(discount) && Boolean(discount === null || discount === void 0 ? void 0 : discount.isSelected));
|
|
562
619
|
};
|
|
563
620
|
const hasAppliedWalletAsset = () => {
|
|
564
|
-
var _context$sales$
|
|
565
|
-
const walletAssetsState = (_context$sales$
|
|
621
|
+
var _context$sales$bookin13, _context$sales$bookin14, _walletAssetsState$se, _walletAssetsState$se2, _walletAssetsState$se3, _walletAssetsState$se4, _walletAssetsState$co, _walletAssetsState$co2, _ref15, _context$sales$bookin15, _context$sales$bookin16, _context$sales$bookin17;
|
|
622
|
+
const walletAssetsState = (_context$sales$bookin13 = context.sales.bookingTicket) === null || _context$sales$bookin13 === void 0 || (_context$sales$bookin14 = _context$sales$bookin13.getWalletAssetsState) === null || _context$sales$bookin14 === void 0 ? void 0 : _context$sales$bookin14.call(_context$sales$bookin13);
|
|
566
623
|
if (((_walletAssetsState$se = walletAssetsState === null || walletAssetsState === void 0 || (_walletAssetsState$se2 = walletAssetsState.selectedIds) === null || _walletAssetsState$se2 === void 0 ? void 0 : _walletAssetsState$se2.length) !== null && _walletAssetsState$se !== void 0 ? _walletAssetsState$se : 0) > 0 || ((_walletAssetsState$se3 = walletAssetsState === null || walletAssetsState === void 0 || (_walletAssetsState$se4 = walletAssetsState.selectedItems) === null || _walletAssetsState$se4 === void 0 ? void 0 : _walletAssetsState$se4.length) !== null && _walletAssetsState$se3 !== void 0 ? _walletAssetsState$se3 : 0) > 0 || ((_walletAssetsState$co = walletAssetsState === null || walletAssetsState === void 0 || (_walletAssetsState$co2 = walletAssetsState.committedIds) === null || _walletAssetsState$co2 === void 0 ? void 0 : _walletAssetsState$co2.length) !== null && _walletAssetsState$co !== void 0 ? _walletAssetsState$co : 0) > 0) return true;
|
|
567
|
-
const tempOrder = (_ref15 = (_context$sales$
|
|
624
|
+
const tempOrder = (_ref15 = (_context$sales$bookin15 = (_context$sales$bookin16 = context.sales.bookingTicket) === null || _context$sales$bookin16 === void 0 || (_context$sales$bookin17 = _context$sales$bookin16.getTempOrder) === null || _context$sales$bookin17 === void 0 ? void 0 : _context$sales$bookin17.call(_context$sales$bookin16)) !== null && _context$sales$bookin15 !== void 0 ? _context$sales$bookin15 : context.sales.tempOrder) !== null && _ref15 !== void 0 ? _ref15 : null;
|
|
568
625
|
return ((tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.payments) || []).some((payment) => {
|
|
569
626
|
const voucherId = payment === null || payment === void 0 ? void 0 : payment.voucher_id;
|
|
570
627
|
return voucherId !== void 0 && voucherId !== null && String(voucherId).trim() !== "" && Number(voucherId) !== 0;
|
|
@@ -106,7 +106,7 @@ function KioskSale(props) {
|
|
|
106
106
|
selectionFlowScene: "product-selection",
|
|
107
107
|
enableGlobalScanListener: true,
|
|
108
108
|
normalProductDetailConfig: resolvedNormalProductDetailConfig,
|
|
109
|
-
mergeBookingLinesForDisplay:
|
|
109
|
+
mergeBookingLinesForDisplay: isH5,
|
|
110
110
|
productLoadParams: resolvedProductLoadParams,
|
|
111
111
|
autoCreate: false,
|
|
112
112
|
bootstrapSlot,
|
|
@@ -7,7 +7,7 @@ import HolderList from "../../selectHolder/components/HolderList/index.js";
|
|
|
7
7
|
import { getCachedWaiverFormDetail } from "../../../components/booking/utils/waiverFormDetailCache.js";
|
|
8
8
|
import { getPetsData } from "../../../components/ticketBooking/serve.js";
|
|
9
9
|
import { useSalesSdkHostBridges } from "../context/SalesSdkHostBridgesContext.js";
|
|
10
|
-
import { ensureProductHolderFormId, getProductHolderFormId } from "../utils/productHolderConfig.js";
|
|
10
|
+
import { ensureProductHolderFormId, getProductHolderFormId, isProductHolderRequired } from "../utils/productHolderConfig.js";
|
|
11
11
|
import { buildHolderListRequestParams } from "../utils/enrichCartLineHolderDisplay.js";
|
|
12
12
|
import { useSalesSdkHolderOptional } from "../context/SalesSdkHolderContext.js";
|
|
13
13
|
import { SalesSdkSelectHolderModal } from "../components/SalesSdkSelectHolderModal.js";
|
|
@@ -30,7 +30,7 @@ function hasHolderFormFields(formDataConfig) {
|
|
|
30
30
|
return Array.isArray(formDataConfig === null || formDataConfig === void 0 ? void 0 : formDataConfig.field) || Array.isArray(formDataConfig === null || formDataConfig === void 0 ? void 0 : formDataConfig.form_field);
|
|
31
31
|
}
|
|
32
32
|
const BookingEditHolderField = ({ state, cacheItem, required, value, onChange, getCurrentCacheItem, presentation = "modal" }) => {
|
|
33
|
-
var _context$appHelper, _state$bookingConfig, _holderConfig$form,
|
|
33
|
+
var _context$appHelper, _state$bookingConfig, _holderConfig$form, _currentCacheItem$_ex, _cacheItem$_extend, _state$pet5, _state$pet6, _state$pet7, _state$bookingConfig3, _inlineState$bookingC2, _inlineState$pet2, _state$client2, _inlineState$client5;
|
|
34
34
|
const bridges = useSalesSdkHostBridges();
|
|
35
35
|
const platform = usePlatform();
|
|
36
36
|
const context = useEngineContext();
|
|
@@ -39,8 +39,8 @@ const BookingEditHolderField = ({ state, cacheItem, required, value, onChange, g
|
|
|
39
39
|
const isInline = presentation === "inline";
|
|
40
40
|
const holderConfig = (state === null || state === void 0 || (_state$bookingConfig = state.bookingConfig) === null || _state$bookingConfig === void 0 ? void 0 : _state$bookingConfig.holder) || {};
|
|
41
41
|
const title = (holderConfig === null || holderConfig === void 0 || (_holderConfig$form = holderConfig.form) === null || _holderConfig$form === void 0 ? void 0 : _holderConfig$form.title) || (holderConfig === null || holderConfig === void 0 ? void 0 : holderConfig.title) || locales.getText("pisell2.text.holder");
|
|
42
|
-
const isRequired = required !== null && required !== void 0 ? required : (state === null || state === void 0 || (_state$bookingConfig2 = state.bookingConfig) === null || _state$bookingConfig2 === void 0 || (_state$bookingConfig2 = _state$bookingConfig2.config) === null || _state$bookingConfig2 === void 0 || (_state$bookingConfig2 = _state$bookingConfig2.basic) === null || _state$bookingConfig2 === void 0 ? void 0 : _state$bookingConfig2.subject_require) === "require";
|
|
43
42
|
const currentCacheItem = (getCurrentCacheItem === null || getCurrentCacheItem === void 0 ? void 0 : getCurrentCacheItem()) || cacheItem;
|
|
43
|
+
const isRequired = required !== null && required !== void 0 ? required : isProductHolderRequired(currentCacheItem);
|
|
44
44
|
const maxSelectedCount = (holderConfig === null || holderConfig === void 0 ? void 0 : holderConfig.maxSelectedCount) || (currentCacheItem === null || currentCacheItem === void 0 || (_currentCacheItem$_ex = currentCacheItem._extend) === null || _currentCacheItem$_ex === void 0 ? void 0 : _currentCacheItem$_ex.quantity) || (cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend = cacheItem._extend) === null || _cacheItem$_extend === void 0 ? void 0 : _cacheItem$_extend.quantity) || 1;
|
|
45
45
|
const selectType = maxSelectedCount > 1 ? "multiple" : "single";
|
|
46
46
|
const liveHolderOptions = getHolderOptionsForSource(currentCacheItem);
|
|
@@ -51,16 +51,16 @@ const BookingEditHolderField = ({ state, cacheItem, required, value, onChange, g
|
|
|
51
51
|
setSelectedValues(normalizeHolderFieldValue(value));
|
|
52
52
|
}, [value]);
|
|
53
53
|
const stateHolderRawList = useMemo(() => {
|
|
54
|
-
var _state$pet, _ref, _ref2, _state$pet$formData$, _state$pet2, _state$pet3, _state$
|
|
54
|
+
var _state$pet, _ref, _ref2, _state$pet$formData$, _state$pet2, _state$pet3, _state$bookingConfig2, _state$pet4;
|
|
55
55
|
const holdersFromState = Array.isArray(state === null || state === void 0 || (_state$pet = state.pet) === null || _state$pet === void 0 ? void 0 : _state$pet.holders) ? state.pet.holders : [];
|
|
56
|
-
const formId = (_ref = (_ref2 = (_state$pet$formData$ = state === null || state === void 0 || (_state$pet2 = state.pet) === null || _state$pet2 === void 0 || (_state$pet2 = _state$pet2.formData) === null || _state$pet2 === void 0 || (_state$pet2 = _state$pet2[0]) === null || _state$pet2 === void 0 ? void 0 : _state$pet2.form_id) !== null && _state$pet$formData$ !== void 0 ? _state$pet$formData$ : state === null || state === void 0 || (_state$pet3 = state.pet) === null || _state$pet3 === void 0 || (_state$pet3 = _state$pet3.formData) === null || _state$pet3 === void 0 || (_state$pet3 = _state$pet3[0]) === null || _state$pet3 === void 0 ? void 0 : _state$pet3.id) !== null && _ref2 !== void 0 ? _ref2 : state === null || state === void 0 || (_state$
|
|
56
|
+
const formId = (_ref = (_ref2 = (_state$pet$formData$ = state === null || state === void 0 || (_state$pet2 = state.pet) === null || _state$pet2 === void 0 || (_state$pet2 = _state$pet2.formData) === null || _state$pet2 === void 0 || (_state$pet2 = _state$pet2[0]) === null || _state$pet2 === void 0 ? void 0 : _state$pet2.form_id) !== null && _state$pet$formData$ !== void 0 ? _state$pet$formData$ : state === null || state === void 0 || (_state$pet3 = state.pet) === null || _state$pet3 === void 0 || (_state$pet3 = _state$pet3.formData) === null || _state$pet3 === void 0 || (_state$pet3 = _state$pet3[0]) === null || _state$pet3 === void 0 ? void 0 : _state$pet3.id) !== null && _ref2 !== void 0 ? _ref2 : state === null || state === void 0 || (_state$bookingConfig2 = state.bookingConfig) === null || _state$bookingConfig2 === void 0 || (_state$bookingConfig2 = _state$bookingConfig2.config) === null || _state$bookingConfig2 === void 0 || (_state$bookingConfig2 = _state$bookingConfig2.basic) === null || _state$bookingConfig2 === void 0 || (_state$bookingConfig2 = _state$bookingConfig2.appointment_subject) === null || _state$bookingConfig2 === void 0 ? void 0 : _state$bookingConfig2.form_id) !== null && _ref !== void 0 ? _ref : 0;
|
|
57
57
|
const holdersFromValue = Array.isArray(state === null || state === void 0 || (_state$pet4 = state.pet) === null || _state$pet4 === void 0 || (_state$pet4 = _state$pet4.value) === null || _state$pet4 === void 0 ? void 0 : _state$pet4[formId]) ? state.pet.value[formId] : [];
|
|
58
58
|
return holdersFromState.length > 0 ? holdersFromState : holdersFromValue;
|
|
59
59
|
}, [
|
|
60
60
|
state === null || state === void 0 || (_state$pet5 = state.pet) === null || _state$pet5 === void 0 ? void 0 : _state$pet5.formData,
|
|
61
61
|
state === null || state === void 0 || (_state$pet6 = state.pet) === null || _state$pet6 === void 0 ? void 0 : _state$pet6.holders,
|
|
62
62
|
state === null || state === void 0 || (_state$pet7 = state.pet) === null || _state$pet7 === void 0 ? void 0 : _state$pet7.value,
|
|
63
|
-
state === null || state === void 0 || (_state$
|
|
63
|
+
state === null || state === void 0 || (_state$bookingConfig3 = state.bookingConfig) === null || _state$bookingConfig3 === void 0 ? void 0 : _state$bookingConfig3.config
|
|
64
64
|
]);
|
|
65
65
|
const inlineHolders = useMemo(() => {
|
|
66
66
|
if (Array.isArray(inlinePet.holders)) return inlinePet.holders;
|
|
@@ -50,11 +50,9 @@ const STATUS_OPTIONS = [
|
|
|
50
50
|
/**
|
|
51
51
|
* SalesSdk 版「预约主体未分配」弹窗,UI 与交互对齐 booking ConfirmHolderModal。
|
|
52
52
|
*/
|
|
53
|
-
function SalesSdkConfirmHolderModalContent({ open, lines, liveUnassignedCount,
|
|
54
|
-
var _bookingConfig$config;
|
|
53
|
+
function SalesSdkConfirmHolderModalContent({ open, lines, liveUnassignedCount, canSkip, onAssign, onConfirm, onSkip, onDismissConfirmed, variant }) {
|
|
55
54
|
const isPhoneVariant = variant === "phone";
|
|
56
55
|
const [modal, contextHolder] = Modal.useModal();
|
|
57
|
-
const isSubjectOptional = (bookingConfig === null || bookingConfig === void 0 || (_bookingConfig$config = bookingConfig.config) === null || _bookingConfig$config === void 0 || (_bookingConfig$config = _bookingConfig$config.basic) === null || _bookingConfig$config === void 0 ? void 0 : _bookingConfig$config.subject_require) !== "require";
|
|
58
56
|
const statusOptions = useMemo(() => STATUS_OPTIONS.map((option) => ({
|
|
59
57
|
key: option.key,
|
|
60
58
|
label: locales.getText(option.labelKey),
|
|
@@ -129,7 +127,7 @@ function SalesSdkConfirmHolderModalContent({ open, lines, liveUnassignedCount, b
|
|
|
129
127
|
onPromotion: () => {},
|
|
130
128
|
onGift: () => {}
|
|
131
129
|
});
|
|
132
|
-
})), /* @__PURE__ */ React.createElement("div", { className: "confirm-holder-modal-footer" },
|
|
130
|
+
})), /* @__PURE__ */ React.createElement("div", { className: "confirm-holder-modal-footer" }, canSkip && onSkip ? /* @__PURE__ */ React.createElement(Button, {
|
|
133
131
|
onClick: onSkip,
|
|
134
132
|
className: "skip-button",
|
|
135
133
|
size: "large"
|
|
@@ -304,7 +304,7 @@ function readSnapshot(bookingTicket, getHolderOptionsForSource = () => [], shoul
|
|
|
304
304
|
return EMPTY_SNAPSHOT;
|
|
305
305
|
}
|
|
306
306
|
}
|
|
307
|
-
const SalesSdkCartProvider = ({ children, shouldMergeProductLines, mergeBookingLinesForDisplay = true }) => {
|
|
307
|
+
const SalesSdkCartProvider = ({ children, deferHolderAuthOnClose = false, shouldMergeProductLines, mergeBookingLinesForDisplay = true }) => {
|
|
308
308
|
var _sales$bookingTicket;
|
|
309
309
|
const sales = useContext(SalesSdkContext);
|
|
310
310
|
const productsCtx = useContext(SalesSdkProductContext);
|
|
@@ -315,7 +315,7 @@ const SalesSdkCartProvider = ({ children, shouldMergeProductLines, mergeBookingL
|
|
|
315
315
|
const refreshSummary = useContext(SalesSdkSummaryRefreshContext);
|
|
316
316
|
const prepareSummary = useContext(SalesSdkSummaryPrepareContext);
|
|
317
317
|
const refreshRoot = useContext(SalesSdkRootRefreshContext);
|
|
318
|
-
const { holderOptions, getHolderOptionsForSource, ensureHolderOptionsForSource, reload: reloadHolderOptions } = useSalesSdkHolderOptional();
|
|
318
|
+
const { holderOptions, getHolderOptionsForSource, ensureHolderOptionsForSource, prepareHolderOptionsForSource, reload: reloadHolderOptions } = useSalesSdkHolderOptional();
|
|
319
319
|
const Toast = useToast();
|
|
320
320
|
const toastRef = useRef(Toast);
|
|
321
321
|
toastRef.current = Toast;
|
|
@@ -935,7 +935,7 @@ const SalesSdkCartProvider = ({ children, shouldMergeProductLines, mergeBookingL
|
|
|
935
935
|
const runDirectAddFromCacheItem = function() {
|
|
936
936
|
var _ref11 = _asyncToGenerator(function* (rawCacheItem) {
|
|
937
937
|
const cacheItemForEnrich = mergeCatalogDurationIntoCacheItem(applyExplicitAddQuantityToCacheItem(rawCacheItem, addQty), product);
|
|
938
|
-
const shouldPrepareHolderOptions = shouldPromptHolderOnAddCart({
|
|
938
|
+
const shouldPrepareHolderOptions = !(options === null || options === void 0 ? void 0 : options.deferHolderUntilSubmit) && shouldPromptHolderOnAddCart({
|
|
939
939
|
cacheItem: cacheItemForEnrich,
|
|
940
940
|
bookingConfig: flowCtx.bookingConfig,
|
|
941
941
|
productSource: product,
|
|
@@ -949,6 +949,7 @@ const SalesSdkCartProvider = ({ children, shouldMergeProductLines, mergeBookingL
|
|
|
949
949
|
}, flowCtx), {}, {
|
|
950
950
|
initialHolderIds: options === null || options === void 0 ? void 0 : options.initialHolderIds,
|
|
951
951
|
holderOptions: holderOptionsForProduct,
|
|
952
|
+
deferHolderUntilSubmit: options === null || options === void 0 ? void 0 : options.deferHolderUntilSubmit,
|
|
952
953
|
mode: "direct"
|
|
953
954
|
})) : {
|
|
954
955
|
status: "ok",
|
|
@@ -1027,7 +1028,7 @@ const SalesSdkCartProvider = ({ children, shouldMergeProductLines, mergeBookingL
|
|
|
1027
1028
|
*/
|
|
1028
1029
|
const confirmDetail = useMemoizedFn(function() {
|
|
1029
1030
|
var _ref15 = _asyncToGenerator(function* (input) {
|
|
1030
|
-
var _flowCtx$date7, _flowCtx$bookingConfi4, _input$options, _input$
|
|
1031
|
+
var _flowCtx$date7, _flowCtx$bookingConfi4, _input$options, _input$options5, _input$options6, _input$options7;
|
|
1031
1032
|
if (!bookingTicket) throw new Error("[SalesSdk] Cart: bookingTicket 未初始化");
|
|
1032
1033
|
if (typeof bookingTicket.transformDetailToProductAndBooking !== "function") throw new Error("[SalesSdk] Cart: bookingTicket.transformDetailToProductAndBooking 不可用");
|
|
1033
1034
|
const confirmQuantity = resolveConfirmDetailQuantity(input);
|
|
@@ -1048,7 +1049,7 @@ const SalesSdkCartProvider = ({ children, shouldMergeProductLines, mergeBookingL
|
|
|
1048
1049
|
if ((_input$options = input.options) === null || _input$options === void 0 ? void 0 : _input$options.multiDayRange) cacheItem = patchCacheItemDateRange(cacheItem, input.options.multiDayRange);
|
|
1049
1050
|
else cacheItem = applyDefaultMultiDayRangeIfNeeded(cacheItem, catalogItem, flowCtx.date);
|
|
1050
1051
|
if (typeof bookingTicket.decideAfterDetail === "function") {
|
|
1051
|
-
var _flowCtx$date8, _flowCtx$bookingConfi5, _input$options2;
|
|
1052
|
+
var _flowCtx$date8, _flowCtx$bookingConfi5, _input$options2, _input$options3, _input$options4;
|
|
1052
1053
|
const decision = bookingTicket.decideAfterDetail(cacheItem, {
|
|
1053
1054
|
quantity: confirmQuantity,
|
|
1054
1055
|
customerId: flowCtx.customerId,
|
|
@@ -1070,14 +1071,15 @@ const SalesSdkCartProvider = ({ children, shouldMergeProductLines, mergeBookingL
|
|
|
1070
1071
|
})
|
|
1071
1072
|
};
|
|
1072
1073
|
}
|
|
1073
|
-
const holderOptionsForProduct = yield ensureHolderOptionsForSource(input.item);
|
|
1074
|
+
const holderOptionsForProduct = ((_input$options2 = input.options) === null || _input$options2 === void 0 ? void 0 : _input$options2.deferHolderUntilSubmit) ? getHolderOptionsForSource(input.item) : yield ensureHolderOptionsForSource(input.item);
|
|
1074
1075
|
const enriched = yield enrichCacheItemBeforeAdd(_objectSpread2(_objectSpread2({
|
|
1075
1076
|
cacheItem: decision.cacheItem,
|
|
1076
1077
|
catalogItem: input.item,
|
|
1077
1078
|
uiHosts
|
|
1078
1079
|
}, flowCtx), {}, {
|
|
1079
|
-
initialHolderIds: (_input$
|
|
1080
|
+
initialHolderIds: (_input$options3 = input.options) === null || _input$options3 === void 0 ? void 0 : _input$options3.initialHolderIds,
|
|
1080
1081
|
holderOptions: holderOptionsForProduct,
|
|
1082
|
+
deferHolderUntilSubmit: (_input$options4 = input.options) === null || _input$options4 === void 0 ? void 0 : _input$options4.deferHolderUntilSubmit,
|
|
1081
1083
|
mode: "direct"
|
|
1082
1084
|
}));
|
|
1083
1085
|
if (enriched.status !== "ok") throw new Error("[SalesSdk] confirmDetail: 加车前校验未通过(Holder / 跨日 Host 未配置或用户取消)");
|
|
@@ -1086,14 +1088,15 @@ const SalesSdkCartProvider = ({ children, shouldMergeProductLines, mergeBookingL
|
|
|
1086
1088
|
products: yield addProductToOrderFromCache(input.item, enriched.cacheItem, { quantity: resolveAddQuantityFromCacheItem(enriched.cacheItem, confirmQuantity) })
|
|
1087
1089
|
};
|
|
1088
1090
|
}
|
|
1089
|
-
const holderOptionsForProduct = yield ensureHolderOptionsForSource(input.item);
|
|
1091
|
+
const holderOptionsForProduct = ((_input$options5 = input.options) === null || _input$options5 === void 0 ? void 0 : _input$options5.deferHolderUntilSubmit) ? getHolderOptionsForSource(input.item) : yield ensureHolderOptionsForSource(input.item);
|
|
1090
1092
|
const enriched = yield enrichCacheItemBeforeAdd(_objectSpread2(_objectSpread2({
|
|
1091
1093
|
cacheItem,
|
|
1092
1094
|
catalogItem: input.item,
|
|
1093
1095
|
uiHosts
|
|
1094
1096
|
}, flowCtx), {}, {
|
|
1095
|
-
initialHolderIds: (_input$
|
|
1097
|
+
initialHolderIds: (_input$options6 = input.options) === null || _input$options6 === void 0 ? void 0 : _input$options6.initialHolderIds,
|
|
1096
1098
|
holderOptions: holderOptionsForProduct,
|
|
1099
|
+
deferHolderUntilSubmit: (_input$options7 = input.options) === null || _input$options7 === void 0 ? void 0 : _input$options7.deferHolderUntilSubmit,
|
|
1097
1100
|
mode: "direct"
|
|
1098
1101
|
}));
|
|
1099
1102
|
if (enriched.status !== "ok") throw new Error("[SalesSdk] confirmDetail: 加车前校验未通过(Holder / 跨日 Host 未配置或用户取消)");
|
|
@@ -1109,9 +1112,9 @@ const SalesSdkCartProvider = ({ children, shouldMergeProductLines, mergeBookingL
|
|
|
1109
1112
|
/** 资源 / 时间抽屉确认后加车。 */
|
|
1110
1113
|
const confirmBookingEdit = useMemoizedFn(function() {
|
|
1111
1114
|
var _ref16 = _asyncToGenerator(function* (input) {
|
|
1112
|
-
var _input$
|
|
1115
|
+
var _input$options8;
|
|
1113
1116
|
if (!bookingTicket) throw new Error("[SalesSdk] Cart: bookingTicket 未初始化");
|
|
1114
|
-
const products = yield addProductToOrderFromCache(input.cacheItem, input.cacheItem, { quantity: resolveAddQuantityFromCacheItem(input.cacheItem, (_input$
|
|
1117
|
+
const products = yield addProductToOrderFromCache(input.cacheItem, input.cacheItem, { quantity: resolveAddQuantityFromCacheItem(input.cacheItem, (_input$options8 = input.options) === null || _input$options8 === void 0 ? void 0 : _input$options8.quantity) });
|
|
1115
1118
|
reloadHolderOptions();
|
|
1116
1119
|
return { products };
|
|
1117
1120
|
});
|
|
@@ -1125,13 +1128,20 @@ const SalesSdkCartProvider = ({ children, shouldMergeProductLines, mergeBookingL
|
|
|
1125
1128
|
/** 无防抖的加车编排(规格 / 资源弹窗链)。 */
|
|
1126
1129
|
const runAddProductFlowBase = useMemoizedFn(function() {
|
|
1127
1130
|
var _ref17 = _asyncToGenerator(function* (product, options) {
|
|
1128
|
-
|
|
1131
|
+
let deferHolderUntilSubmit = (options === null || options === void 0 ? void 0 : options.deferHolderUntilSubmit) === true;
|
|
1132
|
+
let holderOptionsForProduct = deferHolderUntilSubmit ? getHolderOptionsForSource(product) : [];
|
|
1133
|
+
if (!deferHolderUntilSubmit) {
|
|
1134
|
+
const preparedHolderOptions = yield prepareHolderOptionsForSource(product, { allowBoundCustomerAccess: deferHolderAuthOnClose });
|
|
1135
|
+
holderOptionsForProduct = preparedHolderOptions.options;
|
|
1136
|
+
if (deferHolderAuthOnClose && preparedHolderOptions.loginClosed) deferHolderUntilSubmit = true;
|
|
1137
|
+
}
|
|
1129
1138
|
return runAddProductFlow({
|
|
1130
1139
|
addProduct,
|
|
1131
1140
|
confirmDetail,
|
|
1132
1141
|
confirmBookingEdit
|
|
1133
1142
|
}, uiHosts, product, _objectSpread2(_objectSpread2(_objectSpread2({}, options), getAddFlowContext()), {}, {
|
|
1134
1143
|
holderOptions: holderOptionsForProduct,
|
|
1144
|
+
deferHolderUntilSubmit,
|
|
1135
1145
|
onBookingSelectionCommitted: syncCommittedBookingSelection
|
|
1136
1146
|
}));
|
|
1137
1147
|
});
|
|
@@ -1242,24 +1252,21 @@ const SalesSdkCartProvider = ({ children, shouldMergeProductLines, mergeBookingL
|
|
|
1242
1252
|
*/
|
|
1243
1253
|
const addProductWithFlow = useMemoizedFn(function() {
|
|
1244
1254
|
var _ref20 = _asyncToGenerator(function* (product, options) {
|
|
1245
|
-
var _ticket$
|
|
1255
|
+
var _ticket$getTempOrder, _ticket$getTempOrder2, _ticket$getOrderCusto, _ticket$getOrderCusto2, _liveTempOrder$custom, _liveTempOrder$_exten, _liveTempOrder$_exten2, _flowCtx$tempOrder, _flowCtx$tempOrder2, _flowCtx$tempOrder3, _flowCtx$tempOrder4, _uiHostsRef$current2, _ticket$setOrderCusto;
|
|
1246
1256
|
if (!bookingTicketRef.current) throw new Error("[SalesSdk] Cart: bookingTicket 未初始化");
|
|
1247
1257
|
const ticket = bookingTicketRef.current;
|
|
1248
1258
|
const flowCtx = getAddFlowContextRef.current();
|
|
1249
|
-
const otherParams = yield Promise.resolve(((_ticket$getOtherParam = ticket.getOtherParams) === null || _ticket$getOtherParam === void 0 ? void 0 : _ticket$getOtherParam.call(ticket)) || {});
|
|
1250
1259
|
const liveTempOrder = (_ticket$getTempOrder = (_ticket$getTempOrder2 = ticket.getTempOrder) === null || _ticket$getTempOrder2 === void 0 ? void 0 : _ticket$getTempOrder2.call(ticket)) !== null && _ticket$getTempOrder !== void 0 ? _ticket$getTempOrder : null;
|
|
1251
1260
|
const orderCustomerSnapshot = (_ticket$getOrderCusto = (_ticket$getOrderCusto2 = ticket.getOrderCustomerSnapshot) === null || _ticket$getOrderCusto2 === void 0 ? void 0 : _ticket$getOrderCusto2.call(ticket)) !== null && _ticket$getOrderCusto !== void 0 ? _ticket$getOrderCusto : null;
|
|
1252
|
-
const
|
|
1253
|
-
if (!(yield ensureCustomerAuthBeforeAdd({
|
|
1261
|
+
const flowOptions = (yield ensureCustomerAuthBeforeAdd({
|
|
1254
1262
|
product,
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
currentCustomerId,
|
|
1263
|
+
enabled: deferHolderAuthOnClose,
|
|
1264
|
+
currentCustomerId: resolveCustomerAuthCurrentCustomerId(liveTempOrder === null || liveTempOrder === void 0 ? void 0 : liveTempOrder.customer_id, liveTempOrder === null || liveTempOrder === void 0 || (_liveTempOrder$custom = liveTempOrder.customer) === null || _liveTempOrder$custom === void 0 ? void 0 : _liveTempOrder$custom.id, liveTempOrder === null || liveTempOrder === void 0 || (_liveTempOrder$_exten = liveTempOrder._extend) === null || _liveTempOrder$_exten === void 0 || (_liveTempOrder$_exten = _liveTempOrder$_exten.customerSnapshot) === null || _liveTempOrder$_exten === void 0 ? void 0 : _liveTempOrder$_exten.customer_id, liveTempOrder === null || liveTempOrder === void 0 || (_liveTempOrder$_exten2 = liveTempOrder._extend) === null || _liveTempOrder$_exten2 === void 0 || (_liveTempOrder$_exten2 = _liveTempOrder$_exten2.customerSnapshot) === null || _liveTempOrder$_exten2 === void 0 ? void 0 : _liveTempOrder$_exten2.id, orderCustomerSnapshot === null || orderCustomerSnapshot === void 0 ? void 0 : orderCustomerSnapshot.customer_id, orderCustomerSnapshot === null || orderCustomerSnapshot === void 0 ? void 0 : orderCustomerSnapshot.id, flowCtx.customerId, (_flowCtx$tempOrder = flowCtx.tempOrder) === null || _flowCtx$tempOrder === void 0 ? void 0 : _flowCtx$tempOrder.customer_id, (_flowCtx$tempOrder2 = flowCtx.tempOrder) === null || _flowCtx$tempOrder2 === void 0 || (_flowCtx$tempOrder2 = _flowCtx$tempOrder2.customer) === null || _flowCtx$tempOrder2 === void 0 ? void 0 : _flowCtx$tempOrder2.id, (_flowCtx$tempOrder3 = flowCtx.tempOrder) === null || _flowCtx$tempOrder3 === void 0 || (_flowCtx$tempOrder3 = _flowCtx$tempOrder3._extend) === null || _flowCtx$tempOrder3 === void 0 || (_flowCtx$tempOrder3 = _flowCtx$tempOrder3.customerSnapshot) === null || _flowCtx$tempOrder3 === void 0 ? void 0 : _flowCtx$tempOrder3.customer_id, (_flowCtx$tempOrder4 = flowCtx.tempOrder) === null || _flowCtx$tempOrder4 === void 0 || (_flowCtx$tempOrder4 = _flowCtx$tempOrder4._extend) === null || _flowCtx$tempOrder4 === void 0 || (_flowCtx$tempOrder4 = _flowCtx$tempOrder4.customerSnapshot) === null || _flowCtx$tempOrder4 === void 0 ? void 0 : _flowCtx$tempOrder4.id),
|
|
1258
1265
|
openCustomerAuth: (_uiHostsRef$current2 = uiHostsRef.current) === null || _uiHostsRef$current2 === void 0 ? void 0 : _uiHostsRef$current2.openCustomerAuth,
|
|
1259
1266
|
setOrderCustomer: (_ticket$setOrderCusto = ticket.setOrderCustomer) === null || _ticket$setOrderCusto === void 0 ? void 0 : _ticket$setOrderCusto.bind(ticket)
|
|
1260
|
-
})))
|
|
1267
|
+
})).status === "deferred" ? _objectSpread2(_objectSpread2({}, options), {}, { deferHolderUntilSubmit: true }) : options;
|
|
1261
1268
|
const productLineMergeEnabled = resolveProductLineMergeEnabled(shouldMergeProductLines);
|
|
1262
|
-
return debouncedAddRef.current.addProductWithFlow(product, productLineMergeEnabled ?
|
|
1269
|
+
return debouncedAddRef.current.addProductWithFlow(product, productLineMergeEnabled ? flowOptions : _objectSpread2(_objectSpread2({}, flowOptions), {}, { debounceMs: 0 }));
|
|
1263
1270
|
});
|
|
1264
1271
|
return function(_x20, _x21) {
|
|
1265
1272
|
return _ref20.apply(this, arguments);
|