@pisell/private-materials 6.12.487 → 6.12.488
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/render/default/view.js +2 -2
- package/build/lowcode/view.js +2 -2
- package/es/components/bigSale/hooks/useBigSaleProductListConfig.js +1 -0
- package/es/components/scanOrder/components/Check/index.js +33 -34
- package/es/components/scanOrder/utils/freePayment.test.cjs +21 -8
- package/es/components/ticketBooking/components/ProductDisplayAdapter/index.js +3 -0
- package/es/components/ticketBooking/components/addServiceVariant/addService.js +1 -0
- package/es/components/venueBookingSales/catalogPresentation.js +1 -0
- package/es/plus/salesSdk/utils/discountCard.js +2 -0
- package/es/pro/skuDetailModal/flow/registry.d.ts +1 -1
- package/lib/components/scanOrder/components/Check/index.js +33 -34
- package/lib/components/scanOrder/utils/freePayment.test.cjs +21 -8
- package/lib/plus/salesSdk/utils/discountCard.js +2 -0
- package/lib/pro/skuDetailModal/flow/registry.d.ts +1 -1
- package/package.json +3 -3
|
@@ -2,6 +2,7 @@ import { _objectSpread2 } from "../../../_virtual/_@oxc-project_runtime@0.122.0/
|
|
|
2
2
|
import { _objectWithoutProperties } from "../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js";
|
|
3
3
|
import { generateProductTabs, sortProductsByTabOrder } from "../../ticketBooking/components/ProductDisplayAdapter/utils.js";
|
|
4
4
|
import { ProductDisplayPresets } from "../../ticketBooking/components/ProductDisplayAdapter/types.js";
|
|
5
|
+
import "../../ticketBooking/components/ProductDisplayAdapter/index.js";
|
|
5
6
|
import { mergeBigSaleProductListPreferences } from "../utils/productListPreferences.js";
|
|
6
7
|
import { useMemo, useRef } from "react";
|
|
7
8
|
import isEqual from "lodash/isEqual";
|
|
@@ -176,43 +176,42 @@ function Check() {
|
|
|
176
176
|
paymentAmount,
|
|
177
177
|
paymentAmountType: typeof paymentAmount,
|
|
178
178
|
amountSource: (res === null || res === void 0 || (_res$data11 = res.data) === null || _res$data11 === void 0 ? void 0 : _res$data11.order_wait_pay_amount) != null ? "response.order_wait_pay_amount" : "viewModel.summary.total_amount",
|
|
179
|
-
branch:
|
|
179
|
+
branch: !isAdditionalOrder && isZeroPaymentAmount(paymentAmount) ? "free-pay" : shouldPayOnSubmit ? "pisell1.payment" : "order-details",
|
|
180
180
|
hasFreePayBranch: true
|
|
181
181
|
});
|
|
182
|
-
if (
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
status: _e === null || _e === void 0 ? void 0 : _e.status
|
|
203
|
-
});
|
|
204
|
-
try {
|
|
205
|
-
yield runModuleAction("restoreOrder");
|
|
206
|
-
} catch (error) {
|
|
207
|
-
logScanOrder(utils, "restoreOrder after payment failed", scanOrderError(error), "error");
|
|
208
|
-
}
|
|
182
|
+
if (!isAdditionalOrder && (yield handleScanOrderFreePayment({
|
|
183
|
+
orderId,
|
|
184
|
+
amount: paymentAmount,
|
|
185
|
+
utils,
|
|
186
|
+
restoreOrder: () => runModuleAction("restoreOrder"),
|
|
187
|
+
showFailure: showSubmitFailedTip
|
|
188
|
+
}))) return;
|
|
189
|
+
if (shouldPayOnSubmit) utils.action({
|
|
190
|
+
type: "pisell1.payment",
|
|
191
|
+
data: {
|
|
192
|
+
order_id: orderId,
|
|
193
|
+
total_amount: paymentAmount,
|
|
194
|
+
sale_channel: saleChannel
|
|
195
|
+
},
|
|
196
|
+
callback: function() {
|
|
197
|
+
var _ref2 = _asyncToGenerator(function* (_e) {
|
|
198
|
+
logScanOrder(utils, "支付回调", {
|
|
199
|
+
orderId,
|
|
200
|
+
type: _e === null || _e === void 0 ? void 0 : _e.type,
|
|
201
|
+
status: _e === null || _e === void 0 ? void 0 : _e.status
|
|
209
202
|
});
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
203
|
+
try {
|
|
204
|
+
yield runModuleAction("restoreOrder");
|
|
205
|
+
} catch (error) {
|
|
206
|
+
logScanOrder(utils, "restoreOrder after payment failed", scanOrderError(error), "error");
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
return function callback(_x2) {
|
|
210
|
+
return _ref2.apply(this, arguments);
|
|
211
|
+
};
|
|
212
|
+
}()
|
|
213
|
+
});
|
|
214
|
+
else {
|
|
216
215
|
var _utils$history, _utils$history2;
|
|
217
216
|
try {
|
|
218
217
|
yield runModuleAction("restoreOrder");
|
|
@@ -35,12 +35,17 @@ function visit(node) {
|
|
|
35
35
|
}
|
|
36
36
|
visit(parsed);
|
|
37
37
|
|
|
38
|
-
test('scan order zero
|
|
39
|
-
for (const [amount, success, payOnSubmit
|
|
38
|
+
test('scan order zero pays regardless of pay-on-submit; positive and additional orders preserve their flow', async () => {
|
|
39
|
+
for (const [amount, success, payOnSubmit, isAdditionalOrder = false] of [
|
|
40
|
+
[0, true, true], ['0.00', true, true], [5, true, true], [0, false, true],
|
|
41
|
+
[0, true, false], ['0.00', true, false], [0, false, false], [5, true, false],
|
|
42
|
+
[0, true, undefined], [0, false, undefined], [5, true, undefined],
|
|
43
|
+
[0, true, true, true], [0, true, false, true],
|
|
44
|
+
]) {
|
|
40
45
|
const events = [];
|
|
41
46
|
const ctx = {
|
|
42
47
|
logScanOrder: logger.logScanOrder, scanOrderError: logger.scanOrderError,
|
|
43
|
-
viewModel: { cartItems: [{}], summary: { total_amount: 99 } }, note: '', channel: 'scan_to_order', entryMode: 'default', isAdditionalOrder
|
|
48
|
+
viewModel: { cartItems: [{}], summary: { total_amount: 99 } }, note: '', channel: 'scan_to_order', entryMode: isAdditionalOrder ? 'additional_order' : 'default', isAdditionalOrder,
|
|
44
49
|
dineInConfig: { 'sale.require_payment_on_submit': payOnSubmit },
|
|
45
50
|
runModuleAction: async (name) => { events.push(name); return name === 'submitScanOrder' ? { status: true, data: { order_id: 123, order_wait_pay_amount: amount } } : undefined; },
|
|
46
51
|
clearStepCache() {}, refreshViewModel: async () => {},
|
|
@@ -51,12 +56,20 @@ test('scan order zero bypasses modal, positive preserves channel, failed free pa
|
|
|
51
56
|
handleScanOrderFreePayment: api.handleScanOrderFreePayment,
|
|
52
57
|
};
|
|
53
58
|
await vm.runInNewContext(transpile('const run = ' + submit + '; run();'), ctx);
|
|
54
|
-
if (!
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
assert(
|
|
59
|
+
if (!isAdditionalOrder && api.isZeroPaymentAmount(amount)) {
|
|
60
|
+
assert.equal(events.filter(event => event === 'free-pay').length, 1);
|
|
61
|
+
assert(!events.includes('modal'));
|
|
62
|
+
assert(!events.includes('/order/details?id=123'));
|
|
58
63
|
if (success) assert(events.includes('/payment-finish/success?amount=0&order_id=123'));
|
|
59
|
-
else {
|
|
64
|
+
else {
|
|
65
|
+
assert(events.includes('failure')); assert(!events.includes('restoreOrder'));
|
|
66
|
+
assert(!events.includes('/payment-finish/success?amount=0&order_id=123'));
|
|
67
|
+
}
|
|
68
|
+
} else if (payOnSubmit && !isAdditionalOrder) {
|
|
69
|
+
assert(events.includes('modal')); assert(!events.includes('free-pay'));
|
|
70
|
+
} else {
|
|
71
|
+
assert(!events.includes('free-pay')); assert(!events.includes('modal'));
|
|
72
|
+
assert(events.includes('/order/details?id=123'));
|
|
60
73
|
}
|
|
61
74
|
}
|
|
62
75
|
});
|
|
@@ -20,6 +20,7 @@ import { useProducts } from "../../hooks/pisellos/useProducts.js";
|
|
|
20
20
|
import { useService } from "../../../booking/info/service/serviceManager/index.js";
|
|
21
21
|
import ProductDisplayAdapter_default from "../ProductDisplayAdapter/ProductDisplayAdapter.js";
|
|
22
22
|
import { resolveProductDisplayConfig } from "../ProductDisplayAdapter/types.js";
|
|
23
|
+
import "../ProductDisplayAdapter/index.js";
|
|
23
24
|
import notAvailable_default from "../notAvailable/index.js";
|
|
24
25
|
import MultiDayTimeSelectModal from "./MultiDayTimeSelectModal.js";
|
|
25
26
|
import dayjs from "dayjs";
|
|
@@ -3,6 +3,7 @@ import index from "../../plus/productSelect/components/pisellPriceText/index.js"
|
|
|
3
3
|
import { resolveProductPricePresentation } from "../../plus/productSelect/pricing/pricePresentation.js";
|
|
4
4
|
import SettlementPriceList from "../../plus/multiCurrencySettlement/SettlementPriceList.js";
|
|
5
5
|
import { ProductDisplayPresets } from "../ticketBooking/components/ProductDisplayAdapter/types.js";
|
|
6
|
+
import "../ticketBooking/components/ProductDisplayAdapter/index.js";
|
|
6
7
|
import { DEFAULT_BIG_SALE_PRODUCT_LIST_PREFERENCES } from "../bigSale/utils/productListPreferences.js";
|
|
7
8
|
import { translate } from "../../plus/venueBookingDesign/i18n.js";
|
|
8
9
|
import { ProductCard as ProductCard$1 } from "../../plus/venueBookingDesign/shared/ProductCard.js";
|
|
@@ -141,6 +141,8 @@ function buildMachineCodeHolderPayload(context, options) {
|
|
|
141
141
|
};
|
|
142
142
|
}
|
|
143
143
|
function shouldSkipCustomerRepriceForDiscountedLine(line) {
|
|
144
|
+
var _line$metadata;
|
|
145
|
+
if ((_line$metadata = line.metadata) === null || _line$metadata === void 0 ? void 0 : _line$metadata._giftInfo) return true;
|
|
144
146
|
return Array.isArray(line.discount_list) && line.discount_list.some(isDiscountCardApplied);
|
|
145
147
|
}
|
|
146
148
|
//#endregion
|
|
@@ -19,7 +19,7 @@ declare const flowModuleRegistry: {
|
|
|
19
19
|
readonly Component: _$react.FC<FlowModuleProps<string>>;
|
|
20
20
|
readonly initializeWhileInactive: true;
|
|
21
21
|
readonly hardRequires: ("productData" | "booking.selectedCandidate")[];
|
|
22
|
-
readonly refreshOn: ("
|
|
22
|
+
readonly refreshOn: ("productData" | "skuValue" | "quantity" | "booking.customerId" | "booking.duration" | "booking.selectedCandidate")[];
|
|
23
23
|
readonly isApplicable: (context: _$_pisell_materials_src0.SelectionFlowContextValue<SelectionFlowDraft, SelectionFlowDraftUpdate, SelectionDraftField, string, SelectionFlowServices, unknown>) => boolean;
|
|
24
24
|
readonly canInitialize: (context: _$_pisell_materials_src0.SelectionFlowContextValue<SelectionFlowDraft, SelectionFlowDraftUpdate, SelectionDraftField, string, SelectionFlowServices, unknown>) => boolean;
|
|
25
25
|
readonly refresh: (context: SelectionFlowContextValue<string>, module: CompiledSelectionFlowModuleConfig<string>) => Promise<void>;
|
|
@@ -178,43 +178,42 @@ function Check() {
|
|
|
178
178
|
paymentAmount,
|
|
179
179
|
paymentAmountType: typeof paymentAmount,
|
|
180
180
|
amountSource: (res === null || res === void 0 || (_res$data11 = res.data) === null || _res$data11 === void 0 ? void 0 : _res$data11.order_wait_pay_amount) != null ? "response.order_wait_pay_amount" : "viewModel.summary.total_amount",
|
|
181
|
-
branch:
|
|
181
|
+
branch: !isAdditionalOrder && require_freePayment.isZeroPaymentAmount(paymentAmount) ? "free-pay" : shouldPayOnSubmit ? "pisell1.payment" : "order-details",
|
|
182
182
|
hasFreePayBranch: true
|
|
183
183
|
});
|
|
184
|
-
if (
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
status: _e === null || _e === void 0 ? void 0 : _e.status
|
|
205
|
-
});
|
|
206
|
-
try {
|
|
207
|
-
yield runModuleAction("restoreOrder");
|
|
208
|
-
} catch (error) {
|
|
209
|
-
require_paymentLog.logScanOrder(utils, "restoreOrder after payment failed", require_paymentLog.scanOrderError(error), "error");
|
|
210
|
-
}
|
|
184
|
+
if (!isAdditionalOrder && (yield require_freePayment.handleScanOrderFreePayment({
|
|
185
|
+
orderId,
|
|
186
|
+
amount: paymentAmount,
|
|
187
|
+
utils,
|
|
188
|
+
restoreOrder: () => runModuleAction("restoreOrder"),
|
|
189
|
+
showFailure: showSubmitFailedTip
|
|
190
|
+
}))) return;
|
|
191
|
+
if (shouldPayOnSubmit) utils.action({
|
|
192
|
+
type: "pisell1.payment",
|
|
193
|
+
data: {
|
|
194
|
+
order_id: orderId,
|
|
195
|
+
total_amount: paymentAmount,
|
|
196
|
+
sale_channel: saleChannel
|
|
197
|
+
},
|
|
198
|
+
callback: function() {
|
|
199
|
+
var _ref2 = require_asyncToGenerator._asyncToGenerator(function* (_e) {
|
|
200
|
+
require_paymentLog.logScanOrder(utils, "支付回调", {
|
|
201
|
+
orderId,
|
|
202
|
+
type: _e === null || _e === void 0 ? void 0 : _e.type,
|
|
203
|
+
status: _e === null || _e === void 0 ? void 0 : _e.status
|
|
211
204
|
});
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
205
|
+
try {
|
|
206
|
+
yield runModuleAction("restoreOrder");
|
|
207
|
+
} catch (error) {
|
|
208
|
+
require_paymentLog.logScanOrder(utils, "restoreOrder after payment failed", require_paymentLog.scanOrderError(error), "error");
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
return function callback(_x2) {
|
|
212
|
+
return _ref2.apply(this, arguments);
|
|
213
|
+
};
|
|
214
|
+
}()
|
|
215
|
+
});
|
|
216
|
+
else {
|
|
218
217
|
var _utils$history, _utils$history2;
|
|
219
218
|
try {
|
|
220
219
|
yield runModuleAction("restoreOrder");
|
|
@@ -35,12 +35,17 @@ function visit(node) {
|
|
|
35
35
|
}
|
|
36
36
|
visit(parsed);
|
|
37
37
|
|
|
38
|
-
test('scan order zero
|
|
39
|
-
for (const [amount, success, payOnSubmit
|
|
38
|
+
test('scan order zero pays regardless of pay-on-submit; positive and additional orders preserve their flow', async () => {
|
|
39
|
+
for (const [amount, success, payOnSubmit, isAdditionalOrder = false] of [
|
|
40
|
+
[0, true, true], ['0.00', true, true], [5, true, true], [0, false, true],
|
|
41
|
+
[0, true, false], ['0.00', true, false], [0, false, false], [5, true, false],
|
|
42
|
+
[0, true, undefined], [0, false, undefined], [5, true, undefined],
|
|
43
|
+
[0, true, true, true], [0, true, false, true],
|
|
44
|
+
]) {
|
|
40
45
|
const events = [];
|
|
41
46
|
const ctx = {
|
|
42
47
|
logScanOrder: logger.logScanOrder, scanOrderError: logger.scanOrderError,
|
|
43
|
-
viewModel: { cartItems: [{}], summary: { total_amount: 99 } }, note: '', channel: 'scan_to_order', entryMode: 'default', isAdditionalOrder
|
|
48
|
+
viewModel: { cartItems: [{}], summary: { total_amount: 99 } }, note: '', channel: 'scan_to_order', entryMode: isAdditionalOrder ? 'additional_order' : 'default', isAdditionalOrder,
|
|
44
49
|
dineInConfig: { 'sale.require_payment_on_submit': payOnSubmit },
|
|
45
50
|
runModuleAction: async (name) => { events.push(name); return name === 'submitScanOrder' ? { status: true, data: { order_id: 123, order_wait_pay_amount: amount } } : undefined; },
|
|
46
51
|
clearStepCache() {}, refreshViewModel: async () => {},
|
|
@@ -51,12 +56,20 @@ test('scan order zero bypasses modal, positive preserves channel, failed free pa
|
|
|
51
56
|
handleScanOrderFreePayment: api.handleScanOrderFreePayment,
|
|
52
57
|
};
|
|
53
58
|
await vm.runInNewContext(transpile('const run = ' + submit + '; run();'), ctx);
|
|
54
|
-
if (!
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
assert(
|
|
59
|
+
if (!isAdditionalOrder && api.isZeroPaymentAmount(amount)) {
|
|
60
|
+
assert.equal(events.filter(event => event === 'free-pay').length, 1);
|
|
61
|
+
assert(!events.includes('modal'));
|
|
62
|
+
assert(!events.includes('/order/details?id=123'));
|
|
58
63
|
if (success) assert(events.includes('/payment-finish/success?amount=0&order_id=123'));
|
|
59
|
-
else {
|
|
64
|
+
else {
|
|
65
|
+
assert(events.includes('failure')); assert(!events.includes('restoreOrder'));
|
|
66
|
+
assert(!events.includes('/payment-finish/success?amount=0&order_id=123'));
|
|
67
|
+
}
|
|
68
|
+
} else if (payOnSubmit && !isAdditionalOrder) {
|
|
69
|
+
assert(events.includes('modal')); assert(!events.includes('free-pay'));
|
|
70
|
+
} else {
|
|
71
|
+
assert(!events.includes('free-pay')); assert(!events.includes('modal'));
|
|
72
|
+
assert(events.includes('/order/details?id=123'));
|
|
60
73
|
}
|
|
61
74
|
}
|
|
62
75
|
});
|
|
@@ -141,6 +141,8 @@ function buildMachineCodeHolderPayload(context, options) {
|
|
|
141
141
|
};
|
|
142
142
|
}
|
|
143
143
|
function shouldSkipCustomerRepriceForDiscountedLine(line) {
|
|
144
|
+
var _line$metadata;
|
|
145
|
+
if ((_line$metadata = line.metadata) === null || _line$metadata === void 0 ? void 0 : _line$metadata._giftInfo) return true;
|
|
144
146
|
return Array.isArray(line.discount_list) && line.discount_list.some(isDiscountCardApplied);
|
|
145
147
|
}
|
|
146
148
|
//#endregion
|
|
@@ -19,7 +19,7 @@ declare const flowModuleRegistry: {
|
|
|
19
19
|
readonly Component: _$react.FC<FlowModuleProps<string>>;
|
|
20
20
|
readonly initializeWhileInactive: true;
|
|
21
21
|
readonly hardRequires: ("productData" | "booking.selectedCandidate")[];
|
|
22
|
-
readonly refreshOn: ("
|
|
22
|
+
readonly refreshOn: ("productData" | "skuValue" | "quantity" | "booking.customerId" | "booking.duration" | "booking.selectedCandidate")[];
|
|
23
23
|
readonly isApplicable: (context: _$_pisell_materials_src0.SelectionFlowContextValue<SelectionFlowDraft, SelectionFlowDraftUpdate, SelectionDraftField, string, SelectionFlowServices, unknown>) => boolean;
|
|
24
24
|
readonly canInitialize: (context: _$_pisell_materials_src0.SelectionFlowContextValue<SelectionFlowDraft, SelectionFlowDraftUpdate, SelectionDraftField, string, SelectionFlowServices, unknown>) => boolean;
|
|
25
25
|
readonly refresh: (context: SelectionFlowContextValue<string>, module: CompiledSelectionFlowModuleConfig<string>) => Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pisell/private-materials",
|
|
3
|
-
"version": "6.12.
|
|
3
|
+
"version": "6.12.488",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"module": "./es/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -75,10 +75,10 @@
|
|
|
75
75
|
"styled-components": "^6.0.0-rc.3",
|
|
76
76
|
"use-sync-external-store": "^1.6.0",
|
|
77
77
|
"@pisell/pi-payment-sdk": "0.0.5",
|
|
78
|
-
"@pisell/
|
|
78
|
+
"@pisell/icon": "0.0.11",
|
|
79
79
|
"@pisell/utils": "3.0.7",
|
|
80
80
|
"@pisell/date-picker": "3.0.12",
|
|
81
|
-
"@pisell/
|
|
81
|
+
"@pisell/materials": "6.12.107"
|
|
82
82
|
},
|
|
83
83
|
"peerDependencies": {
|
|
84
84
|
"react": "^18.0.0",
|