@pisell/private-materials 6.3.139 → 6.3.141
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/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +5 -5
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +7 -7
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +6 -6
- package/es/components/appointmentBooking/components/Cart/Item/Total.d.ts +1 -0
- package/es/components/appointmentBooking/components/Cart/index.d.ts +1 -0
- package/es/components/appointmentBooking/components/Deposit/index.d.ts +1 -0
- package/es/components/appointmentBooking/components/Footer/index.d.ts +1 -0
- package/es/components/appointmentBooking/components/Guest/components/InformationOptionsModal/index.d.ts +1 -0
- package/es/components/booking/forms/footer.d.ts +1 -0
- package/es/components/booking/forms/sendModal/useSendModal.d.ts +1 -0
- package/es/components/booking/hooks/useClearCart.d.ts +1 -0
- package/es/components/booking/info/dateRange/index.d.ts +1 -0
- package/es/components/booking/notes/NoteBlock/index.d.ts +1 -0
- package/es/components/ecocup/components/AddCustomerModal/index.d.ts +1 -0
- package/es/components/ecocup/components/CupActionList/index.d.ts +1 -0
- package/es/components/ecocup/components/CupActionModal/index.d.ts +1 -0
- package/es/components/ecocup/components/CupStatusModal/index.d.ts +1 -0
- package/es/components/ecocup/components/CustomerAndCupModal/index.d.ts +1 -0
- package/es/components/ecocup/components/MoreDropdown/index.d.ts +1 -0
- package/es/components/ecocup/components/SearchBar/index.d.ts +1 -0
- package/es/components/ecocup/components/SettingModal/index.d.ts +1 -0
- package/es/components/ecocup/cupList/hooks/useColumns.d.ts +1 -0
- package/es/components/ecocup/cupList/hooks/useSummary.d.ts +1 -0
- package/es/components/ecocup/cupList/index.d.ts +1 -0
- package/es/components/eventBooking/components/ErrorTip/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/Cart/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/EmptyHolderModal/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/Event/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/Footer/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/InformationOptionsModal/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/OrderProductModal/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/RemoveOptionConfirmModal.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/Resource/index.d.ts +1 -0
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +1 -0
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +1 -0
- package/es/components/eventBooking/components/bookingDetailModal/components/BookingOptions.d.ts +1 -0
- package/es/components/eventBooking/components/scheduleCalendar/components/ScheduleTimeItem/index.d.ts +1 -0
- package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/index.d.ts +1 -0
- package/es/components/pay/toC/WalletPassBlock/components/WalletUseList/index.d.ts +1 -0
- package/es/components/pisellSelectCustomerModal/RightPanel/List/index.d.ts +1 -0
- package/es/components/scanOrder/components/Cart/index.js +127 -56
- package/es/components/scanOrder/components/Cart/index.less +11 -5
- package/es/components/scanOrder/components/Check/index.js +85 -80
- package/es/components/scanOrder/components/Content/index.js +356 -164
- package/es/components/scanOrder/components/Menu/index.d.ts +11 -0
- package/es/components/scanOrder/components/Menu/index.js +140 -169
- package/es/components/scanOrder/components/Voucher/index.d.ts +8 -0
- package/es/components/scanOrder/components/Voucher/index.js +250 -0
- package/es/components/scanOrder/context.js +38 -13
- package/es/components/scanOrder/hooks.js +4 -1
- package/es/components/scanOrder/locales.d.ts +65 -0
- package/es/components/scanOrder/locales.js +65 -0
- package/es/components/scanOrder/types.d.ts +10 -0
- package/es/components/scanOrder/utils/toShoppingCartProducts.d.ts +1 -0
- package/es/components/scanOrder/utils/toShoppingCartProducts.js +137 -9
- package/es/components/scanOrder/utils/transformProductDetail.js +21 -4
- package/es/components/shoppingCart/hooks/useAddService.d.ts +1 -0
- package/es/components/shoppingCart/hooks/useClearCart.d.ts +1 -0
- package/es/components/venueBooking/components/Addons/index.js +42 -33
- package/es/components/venueBooking/components/Cart/index.js +26 -14
- package/es/components/workSpaceList/components/Modal/index.d.ts +1 -0
- package/es/plus/orderList/components/HandleActions.d.ts +1 -0
- package/es/plus/orderList/components/QuickFilter.d.ts +1 -0
- package/es/plus/orderList/components/Reset.d.ts +1 -0
- package/es/plus/orderList/components/Toolbar.d.ts +1 -0
- package/es/plus/pisellReservation/floorMap/useReservationFloorPlan.d.ts +1 -0
- package/es/plus/saasAttendance/settings/components/membersField/index.d.ts +1 -0
- package/es/plus/saasRegister/components/VertifyEmail.d.ts +1 -0
- package/es/plus/selectHolder/components/ErrorTip/index.d.ts +1 -0
- package/es/plus/skuOptionsSelection/components/OptionsCard/OptionItemCard.d.ts +1 -0
- package/es/plus/skuOptionsSelection/components/OptionsCard/index.d.ts +1 -0
- package/es/plus/skuOptionsSelection/components/OptionsModal/index.d.ts +1 -0
- package/es/plus/walletPassGallery/components/timelineSection/index.d.ts +1 -0
- package/es/pro/pisellPhoneKeyboard/index.d.ts +1 -0
- package/lib/components/appointmentBooking/components/Cart/Item/Total.d.ts +1 -0
- package/lib/components/appointmentBooking/components/Cart/index.d.ts +1 -0
- package/lib/components/appointmentBooking/components/Deposit/index.d.ts +1 -0
- package/lib/components/appointmentBooking/components/Footer/index.d.ts +1 -0
- package/lib/components/appointmentBooking/components/Guest/components/InformationOptionsModal/index.d.ts +1 -0
- package/lib/components/booking/forms/footer.d.ts +1 -0
- package/lib/components/booking/forms/sendModal/useSendModal.d.ts +1 -0
- package/lib/components/booking/hooks/useClearCart.d.ts +1 -0
- package/lib/components/booking/info/dateRange/index.d.ts +1 -0
- package/lib/components/booking/notes/NoteBlock/index.d.ts +1 -0
- package/lib/components/ecocup/components/AddCustomerModal/index.d.ts +1 -0
- package/lib/components/ecocup/components/CupActionList/index.d.ts +1 -0
- package/lib/components/ecocup/components/CupActionModal/index.d.ts +1 -0
- package/lib/components/ecocup/components/CupStatusModal/index.d.ts +1 -0
- package/lib/components/ecocup/components/CustomerAndCupModal/index.d.ts +1 -0
- package/lib/components/ecocup/components/MoreDropdown/index.d.ts +1 -0
- package/lib/components/ecocup/components/SearchBar/index.d.ts +1 -0
- package/lib/components/ecocup/components/SettingModal/index.d.ts +1 -0
- package/lib/components/ecocup/cupList/hooks/useColumns.d.ts +1 -0
- package/lib/components/ecocup/cupList/hooks/useSummary.d.ts +1 -0
- package/lib/components/ecocup/cupList/index.d.ts +1 -0
- package/lib/components/eventBooking/components/ErrorTip/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/Cart/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/EmptyHolderModal/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/Event/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/Footer/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/InformationOptionsModal/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/OrderProductModal/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/RemoveOptionConfirmModal.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/Resource/index.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingDetailModal/components/BookingOptions.d.ts +1 -0
- package/lib/components/eventBooking/components/scheduleCalendar/components/ScheduleTimeItem/index.d.ts +1 -0
- package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/index.d.ts +1 -0
- package/lib/components/pay/toC/WalletPassBlock/components/WalletUseList/index.d.ts +1 -0
- package/lib/components/pisellSelectCustomerModal/RightPanel/List/index.d.ts +1 -0
- package/lib/components/scanOrder/components/Cart/index.js +79 -24
- package/lib/components/scanOrder/components/Cart/index.less +11 -5
- package/lib/components/scanOrder/components/Check/index.js +28 -23
- package/lib/components/scanOrder/components/Content/index.js +136 -42
- package/lib/components/scanOrder/components/Menu/index.d.ts +11 -0
- package/lib/components/scanOrder/components/Menu/index.js +23 -36
- package/lib/components/scanOrder/components/Voucher/index.d.ts +8 -0
- package/lib/components/scanOrder/components/Voucher/index.js +162 -0
- package/lib/components/scanOrder/context.js +21 -10
- package/lib/components/scanOrder/hooks.js +4 -1
- package/lib/components/scanOrder/locales.d.ts +65 -0
- package/lib/components/scanOrder/locales.js +65 -0
- package/lib/components/scanOrder/types.d.ts +10 -0
- package/lib/components/scanOrder/utils/toShoppingCartProducts.d.ts +1 -0
- package/lib/components/scanOrder/utils/toShoppingCartProducts.js +88 -6
- package/lib/components/scanOrder/utils/transformProductDetail.js +10 -3
- package/lib/components/shoppingCart/hooks/useAddService.d.ts +1 -0
- package/lib/components/shoppingCart/hooks/useClearCart.d.ts +1 -0
- package/lib/components/venueBooking/components/Addons/index.js +15 -8
- package/lib/components/venueBooking/components/Cart/index.js +8 -2
- package/lib/components/workSpaceList/components/Modal/index.d.ts +1 -0
- package/lib/plus/orderList/components/HandleActions.d.ts +1 -0
- package/lib/plus/orderList/components/QuickFilter.d.ts +1 -0
- package/lib/plus/orderList/components/Reset.d.ts +1 -0
- package/lib/plus/orderList/components/Toolbar.d.ts +1 -0
- package/lib/plus/pisellReservation/floorMap/useReservationFloorPlan.d.ts +1 -0
- package/lib/plus/saasAttendance/settings/components/membersField/index.d.ts +1 -0
- package/lib/plus/saasRegister/components/VertifyEmail.d.ts +1 -0
- package/lib/plus/selectHolder/components/ErrorTip/index.d.ts +1 -0
- package/lib/plus/skuOptionsSelection/components/OptionsCard/OptionItemCard.d.ts +1 -0
- package/lib/plus/skuOptionsSelection/components/OptionsCard/index.d.ts +1 -0
- package/lib/plus/skuOptionsSelection/components/OptionsModal/index.d.ts +1 -0
- package/lib/plus/walletPassGallery/components/timelineSection/index.d.ts +1 -0
- package/lib/pro/pisellPhoneKeyboard/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -67,6 +67,7 @@ function ScanOrderProvider({
|
|
|
67
67
|
const [entryMode, setEntryMode] = (0, import_react.useState)("default");
|
|
68
68
|
const [submitDisabledTips, setSubmitDisabledTips] = (0, import_react.useState)("");
|
|
69
69
|
const [isCacheHydrated, setIsCacheHydrated] = (0, import_react.useState)(false);
|
|
70
|
+
const [resumeStep, setResumeStep] = (0, import_react.useState)(null);
|
|
70
71
|
const hydratedRef = (0, import_react.useRef)(false);
|
|
71
72
|
const stepList = [...import_hooks.SCAN_ORDER_STEPS];
|
|
72
73
|
const isGatePassed = (0, import_react.useCallback)(
|
|
@@ -89,7 +90,11 @@ function ScanOrderProvider({
|
|
|
89
90
|
const clearStepCache = (0, import_react.useCallback)(() => {
|
|
90
91
|
var _a;
|
|
91
92
|
(_a = scanOrderModule == null ? void 0 : scanOrderModule.clearUIState) == null ? void 0 : _a.call(scanOrderModule);
|
|
93
|
+
setResumeStep(null);
|
|
92
94
|
}, [scanOrderModule]);
|
|
95
|
+
const consumeResumeStep = (0, import_react.useCallback)(() => {
|
|
96
|
+
setResumeStep(null);
|
|
97
|
+
}, []);
|
|
93
98
|
const refreshViewModel = async () => {
|
|
94
99
|
if (scanOrderModule && typeof scanOrderModule.getSummary === "function") {
|
|
95
100
|
try {
|
|
@@ -126,35 +131,37 @@ function ScanOrderProvider({
|
|
|
126
131
|
var _a, _b, _c, _d, _e, _f;
|
|
127
132
|
if (hydratedRef.current || !scanOrderModule) return;
|
|
128
133
|
hydratedRef.current = true;
|
|
129
|
-
const
|
|
134
|
+
const normalizedResourceId = String((entryContext == null ? void 0 : entryContext.resource_id) ?? "");
|
|
135
|
+
const normalizedBiz = String((entryContext == null ? void 0 : entryContext.biz) ?? "");
|
|
130
136
|
const currentHasOrderId = Boolean(entryContext == null ? void 0 : entryContext.order_id);
|
|
131
|
-
const currentBiz = entryContext == null ? void 0 : entryContext.biz;
|
|
132
137
|
const cachedEntry = (_a = scanOrderModule.getUIState) == null ? void 0 : _a.call(scanOrderModule, "entryContext");
|
|
133
|
-
const entrySame = cachedEntry && cachedEntry.resourceId ===
|
|
138
|
+
const entrySame = Boolean(cachedEntry) && String((cachedEntry == null ? void 0 : cachedEntry.resourceId) ?? "") === normalizedResourceId && String((cachedEntry == null ? void 0 : cachedEntry.biz) ?? "") === normalizedBiz;
|
|
134
139
|
if (!entrySame) {
|
|
135
140
|
(_b = scanOrderModule.clearUIState) == null ? void 0 : _b.call(scanOrderModule);
|
|
136
141
|
(_c = scanOrderModule.setUIState) == null ? void 0 : _c.call(scanOrderModule, "entryContext", {
|
|
137
|
-
resourceId:
|
|
142
|
+
resourceId: normalizedResourceId,
|
|
138
143
|
hasOrderId: currentHasOrderId,
|
|
139
|
-
biz:
|
|
144
|
+
biz: normalizedBiz
|
|
140
145
|
});
|
|
141
146
|
setIsCacheHydrated(true);
|
|
142
147
|
return;
|
|
143
148
|
}
|
|
149
|
+
const isResumable = (s) => s === "product" || s === "check";
|
|
144
150
|
const pending = (_d = scanOrderModule.getUIState) == null ? void 0 : _d.call(scanOrderModule, "pendingStep");
|
|
145
|
-
if (
|
|
151
|
+
if (isResumable(pending)) {
|
|
146
152
|
(_e = scanOrderModule.deleteUIState) == null ? void 0 : _e.call(scanOrderModule, "pendingStep");
|
|
147
|
-
|
|
153
|
+
setResumeStep(pending);
|
|
148
154
|
setIsCacheHydrated(true);
|
|
149
155
|
return;
|
|
150
156
|
}
|
|
151
157
|
const cached = (_f = scanOrderModule.getUIState) == null ? void 0 : _f.call(scanOrderModule, "step");
|
|
152
|
-
if (
|
|
158
|
+
if (isResumable(cached)) setResumeStep(cached);
|
|
153
159
|
setIsCacheHydrated(true);
|
|
154
160
|
}, [scanOrderModule, entryContext == null ? void 0 : entryContext.resource_id, entryContext == null ? void 0 : entryContext.order_id, entryContext == null ? void 0 : entryContext.biz]);
|
|
155
161
|
(0, import_react.useEffect)(() => {
|
|
156
162
|
var _a;
|
|
157
163
|
if (!hydratedRef.current || !isCacheHydrated || !scanOrderModule) return;
|
|
164
|
+
if (currentStep === "init") return;
|
|
158
165
|
(_a = scanOrderModule.setUIState) == null ? void 0 : _a.call(scanOrderModule, "step", currentStep);
|
|
159
166
|
}, [currentStep, isCacheHydrated, scanOrderModule]);
|
|
160
167
|
(0, import_react.useEffect)(() => {
|
|
@@ -256,7 +263,9 @@ function ScanOrderProvider({
|
|
|
256
263
|
isCacheHydrated,
|
|
257
264
|
markGate,
|
|
258
265
|
isGatePassed,
|
|
259
|
-
clearStepCache
|
|
266
|
+
clearStepCache,
|
|
267
|
+
resumeStep,
|
|
268
|
+
consumeResumeStep
|
|
260
269
|
};
|
|
261
270
|
}, [
|
|
262
271
|
entryContext,
|
|
@@ -274,7 +283,9 @@ function ScanOrderProvider({
|
|
|
274
283
|
isCacheHydrated,
|
|
275
284
|
markGate,
|
|
276
285
|
isGatePassed,
|
|
277
|
-
clearStepCache
|
|
286
|
+
clearStepCache,
|
|
287
|
+
resumeStep,
|
|
288
|
+
consumeResumeStep
|
|
278
289
|
]);
|
|
279
290
|
return /* @__PURE__ */ import_react.default.createElement(ScanOrderContext.Provider, { value }, children);
|
|
280
291
|
}
|
|
@@ -27,7 +27,20 @@ declare const _default: {
|
|
|
27
27
|
'pisell2.scan.order.pickup.ref.placeholder': string;
|
|
28
28
|
'pisell2.scan.order.products.title': string;
|
|
29
29
|
'pisell2.scan.order.products.empty.tip': string;
|
|
30
|
+
'pisell2.scan.order.check.cart.empty.tip': string;
|
|
30
31
|
'pisell2.scan.order.submit.disabled.default': string;
|
|
32
|
+
'pisell2.text.goodpass': string;
|
|
33
|
+
'pisell2.text.goodpass.product-vouchers': string;
|
|
34
|
+
'pisell2.text.goodpass.view-more': string;
|
|
35
|
+
'pisell2.text.goodpass.code': string;
|
|
36
|
+
'pisell2.text.goodpass.enter-code': string;
|
|
37
|
+
'pisell2.text.goodpass.code-invalid': string;
|
|
38
|
+
'pisell2.text.goodpass.code-invalid-cart': string;
|
|
39
|
+
'pisell2.text.goodpass.code-invalid-expired': string;
|
|
40
|
+
'pisell2.text.goodpass.login': string;
|
|
41
|
+
'pisell2.text.goodpass.login-tip': string;
|
|
42
|
+
'pisell2.text.apply': string;
|
|
43
|
+
'pisell2.text.details': string;
|
|
31
44
|
'pisell2.appointment.booking.empty.data': string;
|
|
32
45
|
'pisell2.appointment.deposit.close': string;
|
|
33
46
|
'pisell2.appointment.policy': string;
|
|
@@ -62,7 +75,20 @@ declare const _default: {
|
|
|
62
75
|
'pisell2.scan.order.pickup.ref.placeholder': string;
|
|
63
76
|
'pisell2.scan.order.products.title': string;
|
|
64
77
|
'pisell2.scan.order.products.empty.tip': string;
|
|
78
|
+
'pisell2.scan.order.check.cart.empty.tip': string;
|
|
65
79
|
'pisell2.scan.order.submit.disabled.default': string;
|
|
80
|
+
'pisell2.text.goodpass': string;
|
|
81
|
+
'pisell2.text.goodpass.product-vouchers': string;
|
|
82
|
+
'pisell2.text.goodpass.view-more': string;
|
|
83
|
+
'pisell2.text.goodpass.code': string;
|
|
84
|
+
'pisell2.text.goodpass.enter-code': string;
|
|
85
|
+
'pisell2.text.goodpass.code-invalid': string;
|
|
86
|
+
'pisell2.text.goodpass.code-invalid-cart': string;
|
|
87
|
+
'pisell2.text.goodpass.code-invalid-expired': string;
|
|
88
|
+
'pisell2.text.goodpass.login': string;
|
|
89
|
+
'pisell2.text.goodpass.login-tip': string;
|
|
90
|
+
'pisell2.text.apply': string;
|
|
91
|
+
'pisell2.text.details': string;
|
|
66
92
|
'pisell2.appointment.booking.empty.data': string;
|
|
67
93
|
'pisell2.appointment.deposit.close': string;
|
|
68
94
|
'pisell2.appointment.policy': string;
|
|
@@ -97,7 +123,20 @@ declare const _default: {
|
|
|
97
123
|
'pisell2.scan.order.pickup.ref.placeholder': string;
|
|
98
124
|
'pisell2.scan.order.products.title': string;
|
|
99
125
|
'pisell2.scan.order.products.empty.tip': string;
|
|
126
|
+
'pisell2.scan.order.check.cart.empty.tip': string;
|
|
100
127
|
'pisell2.scan.order.submit.disabled.default': string;
|
|
128
|
+
'pisell2.text.goodpass': string;
|
|
129
|
+
'pisell2.text.goodpass.product-vouchers': string;
|
|
130
|
+
'pisell2.text.goodpass.view-more': string;
|
|
131
|
+
'pisell2.text.goodpass.code': string;
|
|
132
|
+
'pisell2.text.goodpass.enter-code': string;
|
|
133
|
+
'pisell2.text.goodpass.code-invalid': string;
|
|
134
|
+
'pisell2.text.goodpass.code-invalid-cart': string;
|
|
135
|
+
'pisell2.text.goodpass.code-invalid-expired': string;
|
|
136
|
+
'pisell2.text.goodpass.login': string;
|
|
137
|
+
'pisell2.text.goodpass.login-tip': string;
|
|
138
|
+
'pisell2.text.apply': string;
|
|
139
|
+
'pisell2.text.details': string;
|
|
101
140
|
'pisell2.appointment.booking.empty.data': string;
|
|
102
141
|
'pisell2.appointment.deposit.close': string;
|
|
103
142
|
'pisell2.appointment.policy': string;
|
|
@@ -132,7 +171,20 @@ declare const _default: {
|
|
|
132
171
|
'pisell2.scan.order.pickup.ref.placeholder': string;
|
|
133
172
|
'pisell2.scan.order.products.title': string;
|
|
134
173
|
'pisell2.scan.order.products.empty.tip': string;
|
|
174
|
+
'pisell2.scan.order.check.cart.empty.tip': string;
|
|
135
175
|
'pisell2.scan.order.submit.disabled.default': string;
|
|
176
|
+
'pisell2.text.goodpass': string;
|
|
177
|
+
'pisell2.text.goodpass.product-vouchers': string;
|
|
178
|
+
'pisell2.text.goodpass.view-more': string;
|
|
179
|
+
'pisell2.text.goodpass.code': string;
|
|
180
|
+
'pisell2.text.goodpass.enter-code': string;
|
|
181
|
+
'pisell2.text.goodpass.code-invalid': string;
|
|
182
|
+
'pisell2.text.goodpass.code-invalid-cart': string;
|
|
183
|
+
'pisell2.text.goodpass.code-invalid-expired': string;
|
|
184
|
+
'pisell2.text.goodpass.login': string;
|
|
185
|
+
'pisell2.text.goodpass.login-tip': string;
|
|
186
|
+
'pisell2.text.apply': string;
|
|
187
|
+
'pisell2.text.details': string;
|
|
136
188
|
'pisell2.appointment.booking.empty.data': string;
|
|
137
189
|
'pisell2.appointment.deposit.close': string;
|
|
138
190
|
'pisell2.appointment.policy': string;
|
|
@@ -167,7 +219,20 @@ declare const _default: {
|
|
|
167
219
|
'pisell2.scan.order.pickup.ref.placeholder': string;
|
|
168
220
|
'pisell2.scan.order.products.title': string;
|
|
169
221
|
'pisell2.scan.order.products.empty.tip': string;
|
|
222
|
+
'pisell2.scan.order.check.cart.empty.tip': string;
|
|
170
223
|
'pisell2.scan.order.submit.disabled.default': string;
|
|
224
|
+
'pisell2.text.goodpass': string;
|
|
225
|
+
'pisell2.text.goodpass.product-vouchers': string;
|
|
226
|
+
'pisell2.text.goodpass.view-more': string;
|
|
227
|
+
'pisell2.text.goodpass.code': string;
|
|
228
|
+
'pisell2.text.goodpass.enter-code': string;
|
|
229
|
+
'pisell2.text.goodpass.code-invalid': string;
|
|
230
|
+
'pisell2.text.goodpass.code-invalid-cart': string;
|
|
231
|
+
'pisell2.text.goodpass.code-invalid-expired': string;
|
|
232
|
+
'pisell2.text.goodpass.login': string;
|
|
233
|
+
'pisell2.text.goodpass.login-tip': string;
|
|
234
|
+
'pisell2.text.apply': string;
|
|
235
|
+
'pisell2.text.details': string;
|
|
171
236
|
'pisell2.appointment.booking.empty.data': string;
|
|
172
237
|
'pisell2.appointment.deposit.close': string;
|
|
173
238
|
'pisell2.appointment.policy': string;
|
|
@@ -51,7 +51,20 @@ var locales_default = {
|
|
|
51
51
|
"pisell2.scan.order.pickup.ref.placeholder": "e.g. John",
|
|
52
52
|
"pisell2.scan.order.products.title": "Products",
|
|
53
53
|
"pisell2.scan.order.products.empty.tip": "Please select products",
|
|
54
|
+
"pisell2.scan.order.check.cart.empty.tip": "Please go back to add products",
|
|
54
55
|
"pisell2.scan.order.submit.disabled.default": "Order submission is currently disabled.",
|
|
56
|
+
"pisell2.text.goodpass": "Promotion",
|
|
57
|
+
"pisell2.text.goodpass.product-vouchers": "Product Vouchers",
|
|
58
|
+
"pisell2.text.goodpass.view-more": "View More",
|
|
59
|
+
"pisell2.text.goodpass.code": "Code",
|
|
60
|
+
"pisell2.text.goodpass.enter-code": "Enter Code",
|
|
61
|
+
"pisell2.text.goodpass.code-invalid": "Current code is invalid",
|
|
62
|
+
"pisell2.text.goodpass.code-invalid-cart": "No eligible items in the cart",
|
|
63
|
+
"pisell2.text.goodpass.code-invalid-expired": "Current coupon is not valid in use",
|
|
64
|
+
"pisell2.text.goodpass.login": "Login",
|
|
65
|
+
"pisell2.text.goodpass.login-tip": "to access your promotions",
|
|
66
|
+
"pisell2.text.apply": "Apply",
|
|
67
|
+
"pisell2.text.details": "Details",
|
|
55
68
|
"pisell2.appointment.booking.empty.data": "No data",
|
|
56
69
|
"pisell2.appointment.deposit.close": "Close",
|
|
57
70
|
"pisell2.appointment.policy": "You have read and agreed to this policy",
|
|
@@ -86,7 +99,20 @@ var locales_default = {
|
|
|
86
99
|
"pisell2.scan.order.pickup.ref.placeholder": "例如:小明",
|
|
87
100
|
"pisell2.scan.order.products.title": "商品",
|
|
88
101
|
"pisell2.scan.order.products.empty.tip": "请选择商品",
|
|
102
|
+
"pisell2.scan.order.check.cart.empty.tip": "请返回添加商品",
|
|
89
103
|
"pisell2.scan.order.submit.disabled.default": "当前暂不可下单",
|
|
104
|
+
"pisell2.text.goodpass": "促销",
|
|
105
|
+
"pisell2.text.goodpass.product-vouchers": "商品兑换券",
|
|
106
|
+
"pisell2.text.goodpass.view-more": "查看更多",
|
|
107
|
+
"pisell2.text.goodpass.code": "券码",
|
|
108
|
+
"pisell2.text.goodpass.enter-code": "请输入券码",
|
|
109
|
+
"pisell2.text.goodpass.code-invalid": "当前券码不可用",
|
|
110
|
+
"pisell2.text.goodpass.code-invalid-cart": "当前购物车中无可用商品",
|
|
111
|
+
"pisell2.text.goodpass.code-invalid-expired": "当前优惠券不在使用期限内",
|
|
112
|
+
"pisell2.text.goodpass.login": "登录",
|
|
113
|
+
"pisell2.text.goodpass.login-tip": "以获取会员福利或使用账户积分",
|
|
114
|
+
"pisell2.text.apply": "应用",
|
|
115
|
+
"pisell2.text.details": "详情",
|
|
90
116
|
"pisell2.appointment.booking.empty.data": "暂无数据",
|
|
91
117
|
"pisell2.appointment.deposit.close": "关闭",
|
|
92
118
|
"pisell2.appointment.policy": "您已仔细阅读并同意此协议",
|
|
@@ -121,7 +147,20 @@ var locales_default = {
|
|
|
121
147
|
"pisell2.scan.order.pickup.ref.placeholder": "例如:小明",
|
|
122
148
|
"pisell2.scan.order.products.title": "商品",
|
|
123
149
|
"pisell2.scan.order.products.empty.tip": "請選擇商品",
|
|
150
|
+
"pisell2.scan.order.check.cart.empty.tip": "請返回添加商品",
|
|
124
151
|
"pisell2.scan.order.submit.disabled.default": "當前暫不可下單",
|
|
152
|
+
"pisell2.text.goodpass": "促銷",
|
|
153
|
+
"pisell2.text.goodpass.product-vouchers": "商品兌換券",
|
|
154
|
+
"pisell2.text.goodpass.view-more": "查看更多",
|
|
155
|
+
"pisell2.text.goodpass.code": "券碼",
|
|
156
|
+
"pisell2.text.goodpass.enter-code": "請輸入券碼",
|
|
157
|
+
"pisell2.text.goodpass.code-invalid": "當前券碼不可用",
|
|
158
|
+
"pisell2.text.goodpass.code-invalid-cart": "當前購物車中無可用商品",
|
|
159
|
+
"pisell2.text.goodpass.code-invalid-expired": "當前優惠券不在使用期限內",
|
|
160
|
+
"pisell2.text.goodpass.login": "登錄",
|
|
161
|
+
"pisell2.text.goodpass.login-tip": "以獲取會員福利或使用賬戶積分",
|
|
162
|
+
"pisell2.text.apply": "應用",
|
|
163
|
+
"pisell2.text.details": "詳情",
|
|
125
164
|
"pisell2.appointment.booking.empty.data": "暫無數據",
|
|
126
165
|
"pisell2.appointment.deposit.close": "关闭",
|
|
127
166
|
"pisell2.appointment.policy": "您已仔細閱讀並同意此協議",
|
|
@@ -156,7 +195,20 @@ var locales_default = {
|
|
|
156
195
|
"pisell2.scan.order.pickup.ref.placeholder": "例: ジョン",
|
|
157
196
|
"pisell2.scan.order.products.title": "商品",
|
|
158
197
|
"pisell2.scan.order.products.empty.tip": "商品を選択してください",
|
|
198
|
+
"pisell2.scan.order.check.cart.empty.tip": "商品を追加するには、前の画面に戻ってください",
|
|
159
199
|
"pisell2.scan.order.submit.disabled.default": "現在、注文を送信できません。",
|
|
200
|
+
"pisell2.text.goodpass": "プロモーション",
|
|
201
|
+
"pisell2.text.goodpass.product-vouchers": "商品バウチャー",
|
|
202
|
+
"pisell2.text.goodpass.view-more": "もっと見る",
|
|
203
|
+
"pisell2.text.goodpass.code": "コード",
|
|
204
|
+
"pisell2.text.goodpass.enter-code": "コードを入力",
|
|
205
|
+
"pisell2.text.goodpass.code-invalid": "現在のコードは無効です",
|
|
206
|
+
"pisell2.text.goodpass.code-invalid-cart": "カートに適格な項目がありません",
|
|
207
|
+
"pisell2.text.goodpass.code-invalid-expired": "現在のクーポンは使用期限外です",
|
|
208
|
+
"pisell2.text.goodpass.login": "ログイン",
|
|
209
|
+
"pisell2.text.goodpass.login-tip": "プロモーションにアクセスするため",
|
|
210
|
+
"pisell2.text.apply": "適用",
|
|
211
|
+
"pisell2.text.details": "詳細",
|
|
160
212
|
"pisell2.appointment.booking.empty.data": "データなし",
|
|
161
213
|
"pisell2.appointment.deposit.close": "閉じる",
|
|
162
214
|
"pisell2.appointment.policy": "このポリシーを読み、同意しました",
|
|
@@ -191,7 +243,20 @@ var locales_default = {
|
|
|
191
243
|
"pisell2.scan.order.pickup.ref.placeholder": "Ex.: João",
|
|
192
244
|
"pisell2.scan.order.products.title": "Produtos",
|
|
193
245
|
"pisell2.scan.order.products.empty.tip": "Selecione produtos",
|
|
246
|
+
"pisell2.scan.order.check.cart.empty.tip": "Volte para adicionar produtos",
|
|
194
247
|
"pisell2.scan.order.submit.disabled.default": "No momento, não é possível enviar pedidos.",
|
|
248
|
+
"pisell2.text.goodpass": "Promoção",
|
|
249
|
+
"pisell2.text.goodpass.product-vouchers": "Vales de Produto",
|
|
250
|
+
"pisell2.text.goodpass.view-more": "Ver Mais",
|
|
251
|
+
"pisell2.text.goodpass.code": "Código",
|
|
252
|
+
"pisell2.text.goodpass.enter-code": "Digite o Código",
|
|
253
|
+
"pisell2.text.goodpass.code-invalid": "Código atual é inválido",
|
|
254
|
+
"pisell2.text.goodpass.code-invalid-cart": "Nenhum item elegível no carrinho",
|
|
255
|
+
"pisell2.text.goodpass.code-invalid-expired": "Cupom atual não está no período de uso",
|
|
256
|
+
"pisell2.text.goodpass.login": "Entrar",
|
|
257
|
+
"pisell2.text.goodpass.login-tip": "para acessar suas promoções",
|
|
258
|
+
"pisell2.text.apply": "Aplicar",
|
|
259
|
+
"pisell2.text.details": "Detalhes",
|
|
195
260
|
"pisell2.appointment.booking.empty.data": "Sem dados",
|
|
196
261
|
"pisell2.appointment.deposit.close": "Fechar",
|
|
197
262
|
"pisell2.appointment.policy": "Você leu e concordou com esta política",
|
|
@@ -42,6 +42,8 @@ export interface ScanOrderContextValue {
|
|
|
42
42
|
tableName: string;
|
|
43
43
|
entryMode: ScanOrderEntryMode;
|
|
44
44
|
submitDisabledTips: string;
|
|
45
|
+
/** 折扣/优惠券列表(来自 scanOrder 模块 getDiscountList) */
|
|
46
|
+
discountList: any[];
|
|
45
47
|
isReady: boolean;
|
|
46
48
|
setCurrentStep: (step: ScanOrderStepKey) => void;
|
|
47
49
|
setTableName: (name: string) => void;
|
|
@@ -62,6 +64,14 @@ export interface ScanOrderContextValue {
|
|
|
62
64
|
isGatePassed: (flag: ScanOrderGateKey) => boolean;
|
|
63
65
|
/** 整桶清空(提交成功 / restoreOrder 等场景) */
|
|
64
66
|
clearStepCache: () => void;
|
|
67
|
+
/**
|
|
68
|
+
* bootstrap 结束后要恢复到的目标 step(仅记录 `'product' | 'check'`)。
|
|
69
|
+
* hydrate 阶段不直接 `setCurrentStep`,避免在 checkResourceAvailable 之前让
|
|
70
|
+
* `<Menu>` / `<Check>` mount、提前发出缺 menu_list_ids 的请求。
|
|
71
|
+
*/
|
|
72
|
+
resumeStep: ScanOrderStepKey | null;
|
|
73
|
+
/** 消费并清空 resumeStep;建议在完成 goToStep 后立刻调用 */
|
|
74
|
+
consumeResumeStep: () => void;
|
|
65
75
|
}
|
|
66
76
|
export interface ScanOrderProviderProps {
|
|
67
77
|
entryContext: ScanOrderEntryContext;
|
|
@@ -73,6 +73,76 @@ function normalizeOptions(product) {
|
|
|
73
73
|
};
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
|
+
function getProductOriginRich(product) {
|
|
77
|
+
var _a, _b, _c;
|
|
78
|
+
return ((_a = product == null ? void 0 : product.metadata) == null ? void 0 : _a.origin) || ((_c = (_b = product == null ? void 0 : product._origin) == null ? void 0 : _b.callbackData) == null ? void 0 : _c.origin) || {};
|
|
79
|
+
}
|
|
80
|
+
function findVariantGroupById(groups, groupId) {
|
|
81
|
+
return groups.find((g) => Number(g == null ? void 0 : g.id) === Number(groupId));
|
|
82
|
+
}
|
|
83
|
+
function findVariantItemDisplayName(variantGroup, variantItemId) {
|
|
84
|
+
const items = Array.isArray(variantGroup == null ? void 0 : variantGroup.variant_item) ? variantGroup.variant_item : [];
|
|
85
|
+
const found = items.find(
|
|
86
|
+
(it) => Number(it == null ? void 0 : it.id) === Number(variantItemId)
|
|
87
|
+
);
|
|
88
|
+
const raw = (found == null ? void 0 : found.name) ?? (typeof (found == null ? void 0 : found.title) === "string" ? found.title : found == null ? void 0 : found.title) ?? "";
|
|
89
|
+
return String(raw ?? "").trim();
|
|
90
|
+
}
|
|
91
|
+
function buildVariantStringFromSkuIds(origin, skuIdsRaw) {
|
|
92
|
+
const groups = Array.isArray(origin == null ? void 0 : origin.variant_group) ? origin.variant_group : [];
|
|
93
|
+
const parts = [];
|
|
94
|
+
const segments = String(skuIdsRaw || "").split("_").map((s) => s.trim()).filter(Boolean);
|
|
95
|
+
for (const seg of segments) {
|
|
96
|
+
const colonIdx = seg.indexOf(":");
|
|
97
|
+
if (colonIdx <= 0) continue;
|
|
98
|
+
const groupId = Number(seg.slice(0, colonIdx));
|
|
99
|
+
const itemId = Number(seg.slice(colonIdx + 1));
|
|
100
|
+
if (Number.isNaN(groupId) || Number.isNaN(itemId)) continue;
|
|
101
|
+
const vg = findVariantGroupById(groups, groupId);
|
|
102
|
+
if (!vg) continue;
|
|
103
|
+
const groupName = String((vg == null ? void 0 : vg.name) ?? "").trim();
|
|
104
|
+
const itemName = findVariantItemDisplayName(vg, itemId);
|
|
105
|
+
if (groupName && itemName) parts.push(`${groupName}: ${itemName}`);
|
|
106
|
+
else if (itemName) parts.push(itemName);
|
|
107
|
+
else if (groupName) parts.push(groupName);
|
|
108
|
+
}
|
|
109
|
+
return parts.join(", ");
|
|
110
|
+
}
|
|
111
|
+
function fallbackVariantLabelFromTitles(origin, variantRow) {
|
|
112
|
+
const groups = Array.isArray(origin == null ? void 0 : origin.variant_group) ? origin.variant_group : [];
|
|
113
|
+
const nameObj = (variantRow == null ? void 0 : variantRow.name) || (variantRow == null ? void 0 : variantRow.title);
|
|
114
|
+
if (!nameObj || typeof nameObj !== "object") return "";
|
|
115
|
+
const parts = [];
|
|
116
|
+
for (const g of groups) {
|
|
117
|
+
const pid = g == null ? void 0 : g.position_id;
|
|
118
|
+
if (pid == null) continue;
|
|
119
|
+
const val = nameObj[String(pid)] ?? nameObj[pid];
|
|
120
|
+
if (val == null || val === "") continue;
|
|
121
|
+
const groupName = String((g == null ? void 0 : g.name) ?? "").trim();
|
|
122
|
+
const itemLabel = String(val).trim();
|
|
123
|
+
if (groupName && itemLabel) parts.push(`${groupName}: ${itemLabel}`);
|
|
124
|
+
else if (itemLabel) parts.push(itemLabel);
|
|
125
|
+
}
|
|
126
|
+
if (parts.length) return parts.join(", ");
|
|
127
|
+
const vals = Object.values(nameObj).filter(
|
|
128
|
+
(v) => v != null && String(v).trim() !== ""
|
|
129
|
+
);
|
|
130
|
+
return vals.map((v) => String(v).trim()).join(" / ");
|
|
131
|
+
}
|
|
132
|
+
function getVariantProductOptionString(product) {
|
|
133
|
+
const variantId = product == null ? void 0 : product.product_variant_id;
|
|
134
|
+
if (variantId == null || variantId === "" || Number(variantId) <= 0) return "";
|
|
135
|
+
const origin = getProductOriginRich(product);
|
|
136
|
+
const variants = Array.isArray(origin == null ? void 0 : origin.variant) ? origin.variant : [];
|
|
137
|
+
const matched = variants.find((v) => Number(v == null ? void 0 : v.id) === Number(variantId));
|
|
138
|
+
if (!matched) return "";
|
|
139
|
+
const skuIds = matched == null ? void 0 : matched.sku_ids;
|
|
140
|
+
if (skuIds != null && String(skuIds).trim() !== "") {
|
|
141
|
+
const fromSku = buildVariantStringFromSkuIds(origin, String(skuIds));
|
|
142
|
+
if (fromSku) return fromSku;
|
|
143
|
+
}
|
|
144
|
+
return fallbackVariantLabelFromTitles(origin, matched);
|
|
145
|
+
}
|
|
76
146
|
function normalizeBundles(product) {
|
|
77
147
|
var _a;
|
|
78
148
|
const callbackData = ((_a = product == null ? void 0 : product._origin) == null ? void 0 : _a.callbackData) || {};
|
|
@@ -112,17 +182,22 @@ function toShoppingCartProducts(params) {
|
|
|
112
182
|
const { orderProducts, amountSymbol = "$" } = params;
|
|
113
183
|
if (!Array.isArray(orderProducts)) return [];
|
|
114
184
|
return orderProducts.map((productItem, index) => {
|
|
115
|
-
var _a, _b, _c, _d
|
|
185
|
+
var _a, _b, _c, _d;
|
|
116
186
|
const productNum = toSafeNum(productItem == null ? void 0 : productItem.num);
|
|
117
187
|
const unitPrice = getUnitPrice(productItem);
|
|
118
|
-
const
|
|
188
|
+
const callbackData = ((_a = productItem == null ? void 0 : productItem._origin) == null ? void 0 : _a.callbackData) || {};
|
|
189
|
+
const identityKey = typeof (productItem == null ? void 0 : productItem.identity_key) === "string" && productItem.identity_key.length > 0 ? productItem.identity_key : void 0;
|
|
190
|
+
const rowKey = identityKey ?? `${productItem.product_id ?? "p"}_${productItem.product_variant_id}_${index}`;
|
|
191
|
+
const fromCallbackOptionString = typeof (callbackData == null ? void 0 : callbackData.product_option_string) === "string" ? callbackData.product_option_string.trim() : "";
|
|
192
|
+
const productOptionString = fromCallbackOptionString || getVariantProductOptionString(productItem) || void 0;
|
|
119
193
|
const base = {
|
|
120
194
|
_id: rowKey,
|
|
121
195
|
rowKey,
|
|
122
|
-
identity_key:
|
|
196
|
+
identity_key: identityKey,
|
|
123
197
|
id: productItem.product_id,
|
|
124
198
|
product_id: productItem.product_id,
|
|
125
199
|
product_variant_id: productItem.product_variant_id,
|
|
200
|
+
note: (productItem == null ? void 0 : productItem.note) != null ? String(productItem.note) : "",
|
|
126
201
|
name: getDisplayName(productItem),
|
|
127
202
|
image: getDisplayImage(productItem),
|
|
128
203
|
num: productNum,
|
|
@@ -133,9 +208,16 @@ function toShoppingCartProducts(params) {
|
|
|
133
208
|
options: normalizeOptions(productItem),
|
|
134
209
|
bundle: normalizeBundles(productItem),
|
|
135
210
|
_origin: productItem == null ? void 0 : productItem._origin,
|
|
136
|
-
isNormalProduct: true
|
|
211
|
+
isNormalProduct: true,
|
|
212
|
+
...productOptionString ? { product_option_string: productOptionString } : {}
|
|
137
213
|
};
|
|
138
|
-
if ((
|
|
214
|
+
if (Array.isArray(productItem.product_option_item) && productItem.product_option_item.length) {
|
|
215
|
+
base.product_option_item = productItem.product_option_item;
|
|
216
|
+
}
|
|
217
|
+
if (Array.isArray(productItem.product_bundle) && productItem.product_bundle.length) {
|
|
218
|
+
base.product_bundle = productItem.product_bundle;
|
|
219
|
+
}
|
|
220
|
+
if ((_b = productItem == null ? void 0 : productItem.metadata) == null ? void 0 : _b.venue_booking) {
|
|
139
221
|
const origin = productItem._origin || {};
|
|
140
222
|
const meta = productItem.metadata || {};
|
|
141
223
|
const startDate = origin.start_date;
|
|
@@ -148,7 +230,7 @@ function toShoppingCartProducts(params) {
|
|
|
148
230
|
base.end_time = endTime || "";
|
|
149
231
|
base.duration_type = origin.sub_type || "minutes";
|
|
150
232
|
base.resource_id = meta.resource_id;
|
|
151
|
-
base.relation_form_name = meta.resource_name || ((
|
|
233
|
+
base.relation_form_name = meta.resource_name || ((_d = (_c = origin.resources) == null ? void 0 : _c[0]) == null ? void 0 : _d.main_field) || "";
|
|
152
234
|
if (Array.isArray(origin.resources)) base.resources = origin.resources;
|
|
153
235
|
}
|
|
154
236
|
return base;
|
|
@@ -66,6 +66,12 @@ function normalizeBundleItems(bundleItems) {
|
|
|
66
66
|
};
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
|
+
function findVariantById(origin, variantId) {
|
|
70
|
+
if (!origin || !variantId || variantId <= 0) return null;
|
|
71
|
+
const variants = Array.isArray(origin == null ? void 0 : origin.variant) ? origin.variant : [];
|
|
72
|
+
const matched = variants.find((v) => Number(v == null ? void 0 : v.id) === variantId);
|
|
73
|
+
return matched || null;
|
|
74
|
+
}
|
|
69
75
|
function transformProductDetailToOrderProduct(params) {
|
|
70
76
|
var _a;
|
|
71
77
|
const { payload, fallbackProductId = null, sourceItem = {} } = params;
|
|
@@ -79,17 +85,18 @@ function transformProductDetailToOrderProduct(params) {
|
|
|
79
85
|
0
|
|
80
86
|
);
|
|
81
87
|
const callbackOrigin = (payload == null ? void 0 : payload.origin) || ((_a = payload == null ? void 0 : payload._origin) == null ? void 0 : _a.sourceItem) || (payload == null ? void 0 : payload._origin) || {};
|
|
88
|
+
const matchedVariant = findVariantById(callbackOrigin, productVariantId) ?? findVariantById(sourceItem, productVariantId);
|
|
82
89
|
const sellingPrice = toPriceString(
|
|
83
|
-
(payload == null ? void 0 : payload.price) ?? (payload == null ? void 0 : payload.selling_price) ?? (callbackOrigin == null ? void 0 : callbackOrigin.price) ?? (sourceItem == null ? void 0 : sourceItem.price) ?? (sourceItem == null ? void 0 : sourceItem.selling_price) ?? (sourceItem == null ? void 0 : sourceItem.base_price),
|
|
90
|
+
(payload == null ? void 0 : payload.price) ?? (payload == null ? void 0 : payload.selling_price) ?? (matchedVariant == null ? void 0 : matchedVariant.price) ?? (matchedVariant == null ? void 0 : matchedVariant.base_price) ?? (callbackOrigin == null ? void 0 : callbackOrigin.price) ?? (sourceItem == null ? void 0 : sourceItem.price) ?? (sourceItem == null ? void 0 : sourceItem.selling_price) ?? (sourceItem == null ? void 0 : sourceItem.base_price),
|
|
84
91
|
"0.00"
|
|
85
92
|
);
|
|
86
93
|
const originalPrice = sellingPrice;
|
|
87
94
|
const taxFee = toPriceString(
|
|
88
|
-
(payload == null ? void 0 : payload.tax_fee) ?? (callbackOrigin == null ? void 0 : callbackOrigin.tax_fee) ?? (sourceItem == null ? void 0 : sourceItem.tax_fee),
|
|
95
|
+
(payload == null ? void 0 : payload.tax_fee) ?? (matchedVariant == null ? void 0 : matchedVariant.tax_fee) ?? (callbackOrigin == null ? void 0 : callbackOrigin.tax_fee) ?? (sourceItem == null ? void 0 : sourceItem.tax_fee),
|
|
89
96
|
"0.00"
|
|
90
97
|
);
|
|
91
98
|
const isChargeTax = toNumber(
|
|
92
|
-
(payload == null ? void 0 : payload.is_charge_tax) ?? (callbackOrigin == null ? void 0 : callbackOrigin.is_charge_tax) ?? (sourceItem == null ? void 0 : sourceItem.is_charge_tax),
|
|
99
|
+
(payload == null ? void 0 : payload.is_charge_tax) ?? (matchedVariant == null ? void 0 : matchedVariant.is_charge_tax) ?? (callbackOrigin == null ? void 0 : callbackOrigin.is_charge_tax) ?? (sourceItem == null ? void 0 : sourceItem.is_charge_tax),
|
|
93
100
|
0
|
|
94
101
|
);
|
|
95
102
|
return {
|
|
@@ -93,11 +93,12 @@ function Addons() {
|
|
|
93
93
|
}
|
|
94
94
|
};
|
|
95
95
|
const removeOrderProduct = async (params) => {
|
|
96
|
-
const { product_id, product_variant_id, sourceData } = params;
|
|
96
|
+
const { product_id, product_variant_id, identity_key, sourceData } = params;
|
|
97
97
|
try {
|
|
98
98
|
await runModuleAction("removeProductFromOrder", {
|
|
99
99
|
product_id,
|
|
100
|
-
product_variant_id
|
|
100
|
+
product_variant_id,
|
|
101
|
+
...identity_key ? { identity_key } : {}
|
|
101
102
|
});
|
|
102
103
|
await refreshViewModel();
|
|
103
104
|
} catch (error) {
|
|
@@ -105,16 +106,18 @@ function Addons() {
|
|
|
105
106
|
error,
|
|
106
107
|
sourceData,
|
|
107
108
|
product_id,
|
|
108
|
-
product_variant_id
|
|
109
|
+
product_variant_id,
|
|
110
|
+
identity_key
|
|
109
111
|
});
|
|
110
112
|
}
|
|
111
113
|
};
|
|
112
114
|
const updateOrderProduct = async (params) => {
|
|
113
|
-
const { product_id, product_variant_id, updates, sourceData } = params;
|
|
115
|
+
const { product_id, product_variant_id, identity_key, updates, sourceData } = params;
|
|
114
116
|
try {
|
|
115
117
|
await runModuleAction("updateProductInOrder", {
|
|
116
118
|
product_id,
|
|
117
119
|
product_variant_id,
|
|
120
|
+
...identity_key ? { identity_key } : {},
|
|
118
121
|
updates
|
|
119
122
|
});
|
|
120
123
|
await refreshViewModel();
|
|
@@ -124,6 +127,7 @@ function Addons() {
|
|
|
124
127
|
sourceData,
|
|
125
128
|
product_id,
|
|
126
129
|
product_variant_id,
|
|
130
|
+
identity_key,
|
|
127
131
|
updates
|
|
128
132
|
});
|
|
129
133
|
}
|
|
@@ -158,18 +162,20 @@ function Addons() {
|
|
|
158
162
|
return;
|
|
159
163
|
}
|
|
160
164
|
const normalizedQuantity = Number.isNaN(nextQuantity) ? 0 : Math.max(0, Math.floor(nextQuantity));
|
|
165
|
+
const cartItems = Array.isArray(viewModel == null ? void 0 : viewModel.cartItems) ? viewModel.cartItems : [];
|
|
166
|
+
const existedCartItem = cartItems.find((cartItem) => {
|
|
167
|
+
return String((cartItem == null ? void 0 : cartItem.product_id) ?? null) === String((orderProduct == null ? void 0 : orderProduct.product_id) ?? null) && Number((cartItem == null ? void 0 : cartItem.product_variant_id) ?? 0) === productVariantId;
|
|
168
|
+
});
|
|
169
|
+
const existedIdentityKey = typeof (existedCartItem == null ? void 0 : existedCartItem.identity_key) === "string" && existedCartItem.identity_key.length > 0 ? existedCartItem.identity_key : void 0;
|
|
161
170
|
if (normalizedQuantity <= 0) {
|
|
162
171
|
await removeOrderProduct({
|
|
163
172
|
product_id: (orderProduct == null ? void 0 : orderProduct.product_id) ?? null,
|
|
164
173
|
product_variant_id: productVariantId,
|
|
174
|
+
identity_key: existedIdentityKey,
|
|
165
175
|
sourceData: quantityData
|
|
166
176
|
});
|
|
167
177
|
return;
|
|
168
178
|
}
|
|
169
|
-
const cartItems = Array.isArray(viewModel == null ? void 0 : viewModel.cartItems) ? viewModel.cartItems : [];
|
|
170
|
-
const existedCartItem = cartItems.find((cartItem) => {
|
|
171
|
-
return String((cartItem == null ? void 0 : cartItem.product_id) ?? null) === String((orderProduct == null ? void 0 : orderProduct.product_id) ?? null) && Number((cartItem == null ? void 0 : cartItem.product_variant_id) ?? 0) === productVariantId;
|
|
172
|
-
});
|
|
173
179
|
if (!existedCartItem) {
|
|
174
180
|
await addOrderProduct({
|
|
175
181
|
orderProduct: { ...orderProduct, num: normalizedQuantity },
|
|
@@ -180,6 +186,7 @@ function Addons() {
|
|
|
180
186
|
await updateOrderProduct({
|
|
181
187
|
product_id: (orderProduct == null ? void 0 : orderProduct.product_id) ?? null,
|
|
182
188
|
product_variant_id: productVariantId,
|
|
189
|
+
identity_key: existedIdentityKey,
|
|
183
190
|
updates: {
|
|
184
191
|
num: normalizedQuantity,
|
|
185
192
|
_origin: orderProduct == null ? void 0 : orderProduct._origin
|
|
@@ -139,7 +139,7 @@ function Cart(props) {
|
|
|
139
139
|
const isVenueBookingCartItem = (target) => {
|
|
140
140
|
if (!target || typeof target !== "object") return false;
|
|
141
141
|
if ((target == null ? void 0 : target.start_date) && (target == null ? void 0 : target.end_date)) return true;
|
|
142
|
-
const identity = String((target == null ? void 0 : target.identity_key) ||
|
|
142
|
+
const identity = String((target == null ? void 0 : target.identity_key) || "");
|
|
143
143
|
if (identity.startsWith("venue:")) return true;
|
|
144
144
|
return false;
|
|
145
145
|
};
|
|
@@ -157,8 +157,14 @@ function Cart(props) {
|
|
|
157
157
|
}
|
|
158
158
|
const productId = (targetItem == null ? void 0 : targetItem.product_id) ?? (targetItem == null ? void 0 : targetItem.id) ?? null;
|
|
159
159
|
const productVariantId = Number((targetItem == null ? void 0 : targetItem.product_variant_id) ?? 0);
|
|
160
|
-
const identityKey =
|
|
160
|
+
const identityKey = targetItem == null ? void 0 : targetItem.identity_key;
|
|
161
161
|
if (productId === null && Number.isNaN(productVariantId)) return;
|
|
162
|
+
if (typeof identityKey !== "string" || identityKey.length === 0) {
|
|
163
|
+
console.error("[venueBooking] removeProductFromOrder skipped: missing identity_key", {
|
|
164
|
+
item: targetItem
|
|
165
|
+
});
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
162
168
|
try {
|
|
163
169
|
await runModuleAction("removeProductFromOrder", {
|
|
164
170
|
product_id: productId,
|