@pisell/pisellos 0.0.569 → 0.10.2
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/dist/core/index.js +10 -6
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -3
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.js +7 -5
- package/dist/model/strategy/adapter/walletPass/example.js +26 -3
- package/dist/model/strategy/adapter/walletPass/index.js +5 -5
- package/dist/model/strategy/adapter/walletPass/type.d.ts +0 -3
- package/dist/model/strategy/adapter/walletPass/utils.d.ts +0 -26
- package/dist/model/strategy/adapter/walletPass/utils.js +17 -92
- package/dist/model/strategy/strategy-example.js +19 -5
- package/dist/modules/BaseModule.d.ts +1 -1
- package/dist/modules/BaseModule.js +8 -10
- package/dist/modules/Cart/index.js +3 -0
- package/dist/modules/Cart/utils/cartProduct.js +1 -0
- package/dist/modules/Cart/utils/cartResource.js +0 -2
- package/dist/modules/Cart/utils/changePrice.js +9 -16
- package/dist/modules/Date/index.js +5 -1
- package/dist/modules/Discount/index.d.ts +0 -1
- package/dist/modules/Discount/index.js +7 -22
- package/dist/modules/Discount/types.d.ts +0 -1
- package/dist/modules/OpenData/index.js +2 -0
- package/dist/modules/Order/index.js +70 -40
- package/dist/modules/Payment/index.js +162 -97
- package/dist/modules/Payment/types.d.ts +4 -8
- package/dist/modules/Payment/walletpass.d.ts +0 -2
- package/dist/modules/Payment/walletpass.js +5 -4
- package/dist/modules/ProductList/index.d.ts +1 -1
- package/dist/modules/ProductList/index.js +3 -12
- package/dist/modules/ProductList/types.d.ts +0 -1
- package/dist/modules/Rules/index.js +126 -427
- package/dist/modules/SalesSummary/utils.js +1 -2
- package/dist/modules/Schedule/getDateIsInSchedule.js +0 -5
- package/dist/modules/Schedule/index.js +1 -0
- package/dist/modules/Schedule/utils.js +1 -0
- package/dist/modules/Step/index.js +1 -0
- package/dist/modules/Summary/utils.js +22 -43
- package/dist/plugins/request.js +4 -1
- package/dist/plugins/window.js +6 -2
- package/dist/server/index.js +129 -97
- package/dist/server/modules/menu/index.js +41 -32
- package/dist/server/modules/order/index.js +4 -2
- package/dist/server/modules/products/index.js +42 -24
- package/dist/server/modules/quotation/index.js +38 -29
- package/dist/server/modules/resource/index.js +4 -3
- package/dist/server/modules/schedule/index.js +35 -27
- package/dist/server/utils/product.js +1 -0
- package/dist/solution/BaseSales/index.js +41 -38
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingByStep/index.js +60 -11
- package/dist/solution/BookingByStep/utils/capacity.js +11 -1
- package/dist/solution/BookingByStep/utils/resources.js +3 -1
- package/dist/solution/BookingByStep/utils/timeslots.js +43 -2
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +2 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +7 -6
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +31 -25
- package/dist/solution/BookingTicket/utils/scan/index.js +10 -6
- package/dist/solution/BuyTickets/index.js +12 -9
- package/dist/solution/Checkout/index.js +252 -177
- package/dist/solution/Checkout/utils/index.js +16 -4
- package/dist/solution/RegisterAndLogin/index.js +76 -30
- package/dist/solution/ScanOrder/index.js +60 -50
- package/dist/solution/ShopDiscount/index.js +14 -15
- package/dist/solution/ShopDiscount/types.d.ts +4 -5
- package/dist/solution/ShopDiscount/utils.d.ts +0 -9
- package/dist/solution/ShopDiscount/utils.js +0 -9
- package/dist/solution/VenueBooking/index.d.ts +3 -31
- package/dist/solution/VenueBooking/index.js +496 -651
- package/dist/solution/VenueBooking/types.d.ts +1 -3
- package/dist/solution/VenueBooking/types.js +0 -1
- package/dist/solution/VenueBooking/utils/dateSummary.d.ts +2 -2
- package/dist/solution/VenueBooking/utils/dateSummary.js +25 -12
- package/dist/solution/VenueBooking/utils/timeSlot.d.ts +0 -2
- package/dist/solution/VenueBooking/utils/timeSlot.js +4 -9
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/task.js +18 -15
- package/dist/utils/watch.js +1 -0
- package/lib/apis/picoding.js +0 -2
- package/lib/core/index.js +132 -130
- package/lib/effects/index.js +57 -46
- package/lib/index.d.ts +0 -1
- package/lib/index.js +50 -92
- package/lib/model/index.js +21 -14
- package/lib/model/strategy/adapter/dataVariant/adapter.js +50 -38
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +236 -162
- package/lib/model/strategy/adapter/dataVariant/examples.js +237 -229
- package/lib/model/strategy/adapter/dataVariant/index.js +34 -39
- package/lib/model/strategy/adapter/dataVariant/type.js +28 -57
- package/lib/model/strategy/adapter/index.js +64 -100
- package/lib/model/strategy/adapter/itemRule/adapter.js +144 -156
- package/lib/model/strategy/adapter/itemRule/evaluator.js +48 -36
- package/lib/model/strategy/adapter/itemRule/examples.js +225 -295
- package/lib/model/strategy/adapter/itemRule/index.js +57 -83
- package/lib/model/strategy/adapter/itemRule/type.js +36 -97
- package/lib/model/strategy/adapter/promotion/adapter.js +63 -84
- package/lib/model/strategy/adapter/promotion/evaluator.js +231 -381
- package/lib/model/strategy/adapter/promotion/examples.js +159 -139
- package/lib/model/strategy/adapter/promotion/index.js +49 -1
- package/lib/model/strategy/adapter/promotion/type.js +35 -199
- package/lib/model/strategy/adapter/type.js +16 -4
- package/lib/model/strategy/adapter/walletPass/evaluator.js +152 -180
- package/lib/model/strategy/adapter/walletPass/example.js +190 -217
- package/lib/model/strategy/adapter/walletPass/index.js +51 -75
- package/lib/model/strategy/adapter/walletPass/locales.js +58 -36
- package/lib/model/strategy/adapter/walletPass/type.d.ts +0 -3
- package/lib/model/strategy/adapter/walletPass/type.js +16 -4
- package/lib/model/strategy/adapter/walletPass/utils.d.ts +0 -26
- package/lib/model/strategy/adapter/walletPass/utils.js +383 -678
- package/lib/model/strategy/engine.js +168 -270
- package/lib/model/strategy/index.js +34 -49
- package/lib/model/strategy/strategy-example.js +239 -243
- package/lib/model/strategy/type.js +40 -100
- package/lib/modules/Account/index.js +53 -39
- package/lib/modules/Account/types.js +33 -20
- package/lib/modules/AccountList/index.js +154 -116
- package/lib/modules/AccountList/types.js +31 -30
- package/lib/modules/AccountList/utils.js +30 -18
- package/lib/modules/BaseModule.d.ts +1 -1
- package/lib/modules/BaseModule.js +46 -25
- package/lib/modules/BookingContext/index.js +136 -158
- package/lib/modules/BookingContext/types.js +32 -46
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +143 -131
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +82 -75
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +150 -170
- package/lib/modules/BookingContext/utils/flexible.js +55 -38
- package/lib/modules/BookingContext/utils/formatResourceList.js +34 -19
- package/lib/modules/BookingContext/utils/index.js +41 -124
- package/lib/modules/BookingContext/utils/noResource.js +70 -58
- package/lib/modules/BookingContext/utils/orderLineDisplay.js +41 -14
- package/lib/modules/BookingContext/utils/productExtend.js +155 -202
- package/lib/modules/BookingContext/utils/resourceErrors.js +53 -53
- package/lib/modules/BookingContext/utils/resourceSelection.js +41 -19
- package/lib/modules/BookingContext/utils/resources.js +167 -209
- package/lib/modules/BookingContext/utils/serviceTimes.js +116 -115
- package/lib/modules/BookingContext/utils/timeSlices.js +80 -70
- package/lib/modules/Cart/index.js +124 -170
- package/lib/modules/Cart/types.js +51 -46
- package/lib/modules/Cart/utils/cartAccount.js +39 -40
- package/lib/modules/Cart/utils/cartDate.js +61 -56
- package/lib/modules/Cart/utils/cartDiscount.js +33 -28
- package/lib/modules/Cart/utils/cartNote.js +32 -27
- package/lib/modules/Cart/utils/cartProduct.js +251 -321
- package/lib/modules/Cart/utils/cartRelationForms.js +35 -29
- package/lib/modules/Cart/utils/cartResource.js +78 -72
- package/lib/modules/Cart/utils/changePrice.js +50 -28
- package/lib/modules/Cart/utils/index.js +48 -106
- package/lib/modules/Customer/constants.js +34 -13
- package/lib/modules/Customer/index.js +169 -232
- package/lib/modules/Customer/types.js +35 -38
- package/lib/modules/Date/index.js +115 -116
- package/lib/modules/Date/types.js +28 -16
- package/lib/modules/Date/utils.js +123 -174
- package/lib/modules/Discount/index.d.ts +0 -1
- package/lib/modules/Discount/index.js +128 -130
- package/lib/modules/Discount/types.d.ts +0 -1
- package/lib/modules/Discount/types.js +31 -9
- package/lib/modules/Guests/index.js +56 -30
- package/lib/modules/Guests/types.js +33 -23
- package/lib/modules/Holder/index.js +189 -209
- package/lib/modules/Holder/types.js +16 -4
- package/lib/modules/Holder/utils.js +49 -20
- package/lib/modules/OpenData/index.js +76 -69
- package/lib/modules/OpenData/types.js +16 -4
- package/lib/modules/OpenData/utils.js +78 -44
- package/lib/modules/Order/index.js +1909 -1572
- package/lib/modules/Order/types.js +35 -78
- package/lib/modules/Order/utils/bundleDiscountHydration.js +74 -41
- package/lib/modules/Order/utils/manualProductDiscount.js +123 -124
- package/lib/modules/Order/utils/orderCollectionIdentity.js +210 -148
- package/lib/modules/Order/utils.js +634 -799
- package/lib/modules/Payment/cash.js +33 -20
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +76 -145
- package/lib/modules/Payment/eftpos.js +30 -16
- package/lib/modules/Payment/index.js +378 -518
- package/lib/modules/Payment/mx51.js +0 -1
- package/lib/modules/Payment/types.d.ts +4 -8
- package/lib/modules/Payment/types.js +107 -216
- package/lib/modules/Payment/utils.js +48 -51
- package/lib/modules/Payment/walletpass.d.ts +0 -2
- package/lib/modules/Payment/walletpass.js +211 -226
- package/lib/modules/Product/index.js +46 -51
- package/lib/modules/Product/types.js +16 -4
- package/lib/modules/Product/utils.js +33 -32
- package/lib/modules/ProductList/index.d.ts +1 -1
- package/lib/modules/ProductList/index.js +117 -117
- package/lib/modules/ProductList/types.d.ts +0 -1
- package/lib/modules/ProductList/types.js +31 -9
- package/lib/modules/Quotation/index.js +100 -66
- package/lib/modules/Quotation/types.js +16 -4
- package/lib/modules/Resource/index.js +59 -27
- package/lib/modules/Resource/types.js +32 -22
- package/lib/modules/Resource/utils.js +38 -30
- package/lib/modules/ResourcePlanner/index.js +61 -60
- package/lib/modules/ResourcePlanner/planner.js +384 -346
- package/lib/modules/ResourcePlanner/types.js +16 -4
- package/lib/modules/Rules/index.js +903 -1475
- package/lib/modules/Rules/types.js +40 -17
- package/lib/modules/SalesSummary/index.js +90 -85
- package/lib/modules/SalesSummary/types.js +16 -4
- package/lib/modules/SalesSummary/utils.js +427 -351
- package/lib/modules/ScanOrderLogger/index.js +79 -59
- package/lib/modules/ScanOrderLogger/providers/feishu.js +78 -54
- package/lib/modules/ScanOrderLogger/providers/grafana.js +36 -13
- package/lib/modules/ScanOrderLogger/types.js +16 -4
- package/lib/modules/Schedule/getDateIsInSchedule.js +163 -339
- package/lib/modules/Schedule/index.js +114 -100
- package/lib/modules/Schedule/type.js +16 -4
- package/lib/modules/Schedule/types.js +16 -4
- package/lib/modules/Schedule/utils.js +291 -433
- package/lib/modules/Step/index.js +52 -40
- package/lib/modules/Step/tyeps.js +16 -4
- package/lib/modules/Summary/index.js +71 -66
- package/lib/modules/Summary/types.js +16 -4
- package/lib/modules/Summary/utils.js +418 -791
- package/lib/modules/SurchargeList/index.js +60 -46
- package/lib/modules/SurchargeList/types.js +16 -4
- package/lib/modules/index.js +63 -245
- package/lib/plugins/app.js +16 -4
- package/lib/plugins/index.js +25 -36
- package/lib/plugins/request.js +126 -137
- package/lib/plugins/shopStore.js +16 -4
- package/lib/plugins/user.js +16 -4
- package/lib/plugins/window.js +179 -171
- package/lib/server/index.js +2337 -2675
- package/lib/server/modules/floor-plan/index.js +123 -102
- package/lib/server/modules/floor-plan/types.js +30 -15
- package/lib/server/modules/index.js +68 -106
- package/lib/server/modules/menu/index.js +122 -146
- package/lib/server/modules/menu/types.js +31 -18
- package/lib/server/modules/order/index.js +642 -567
- package/lib/server/modules/order/types.js +32 -117
- package/lib/server/modules/order/utils/filterBookings.js +194 -219
- package/lib/server/modules/order/utils/filterOrders.js +92 -118
- package/lib/server/modules/payment/index.js +83 -59
- package/lib/server/modules/payment/types.js +16 -4
- package/lib/server/modules/products/index.js +459 -575
- package/lib/server/modules/products/types.js +34 -44
- package/lib/server/modules/quotation/index.js +172 -137
- package/lib/server/modules/quotation/types.js +31 -21
- package/lib/server/modules/resource/index.js +184 -213
- package/lib/server/modules/resource/types.js +33 -42
- package/lib/server/modules/schedule/index.js +123 -135
- package/lib/server/modules/schedule/types.js +21 -14
- package/lib/server/modules/schedule/utils.js +163 -334
- package/lib/server/types.js +16 -4
- package/lib/server/utils/index.js +23 -25
- package/lib/server/utils/product.js +139 -196
- package/lib/server/utils/schedule.js +41 -34
- package/lib/server/utils/small-ticket.js +456 -478
- package/lib/server/utils/time.js +49 -40
- package/lib/solution/BaseSales/index.js +1016 -850
- package/lib/solution/BaseSales/types.js +37 -41
- package/lib/solution/BaseSales/utils/cartPromotion.js +460 -611
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +105 -85
- package/lib/solution/BaseSales/utils/quotationPrice.js +114 -56
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +143 -102
- package/lib/solution/BaseSales/utils.js +140 -155
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.js +1340 -1530
- package/lib/solution/BookingByStep/types.js +99 -40
- package/lib/solution/BookingByStep/utils/capacity.js +160 -192
- package/lib/solution/BookingByStep/utils/products.js +52 -42
- package/lib/solution/BookingByStep/utils/resources.js +330 -527
- package/lib/solution/BookingByStep/utils/stock.js +44 -65
- package/lib/solution/BookingByStep/utils/timeslots.js +131 -129
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +459 -543
- package/lib/solution/BookingTicket/types.js +77 -99
- package/lib/solution/BookingTicket/utils/addProductDecision.js +184 -219
- package/lib/solution/BookingTicket/utils/addTimeAvailability.js +89 -58
- package/lib/solution/BookingTicket/utils/bookingStatus.js +78 -107
- package/lib/solution/BookingTicket/utils/cartView.js +94 -110
- package/lib/solution/BookingTicket/utils/exampleData.js +0 -185
- package/lib/solution/BookingTicket/utils/orderCustomer.js +41 -18
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +86 -219
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +93 -144
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +91 -79
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +41 -54
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +81 -84
- package/lib/solution/BookingTicket/utils/scan/index.js +104 -98
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +43 -90
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +64 -52
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +58 -56
- package/lib/solution/BuyTickets/index.js +70 -67
- package/lib/solution/BuyTickets/types.js +38 -22
- package/lib/solution/Checkout/index.js +1158 -1451
- package/lib/solution/Checkout/types.js +61 -91
- package/lib/solution/Checkout/utils/index.js +156 -228
- package/lib/solution/PlaceOrder/index.js +0 -55
- package/lib/solution/RegisterAndLogin/config.js +460 -493
- package/lib/solution/RegisterAndLogin/index.js +630 -633
- package/lib/solution/RegisterAndLogin/types.js +76 -189
- package/lib/solution/RegisterAndLogin/utils.js +125 -183
- package/lib/solution/Sales/index.js +320 -317
- package/lib/solution/Sales/types.js +33 -27
- package/lib/solution/ScanOrder/index.js +862 -831
- package/lib/solution/ScanOrder/types.js +34 -33
- package/lib/solution/ScanOrder/utils.js +371 -406
- package/lib/solution/ShopDiscount/index.js +233 -235
- package/lib/solution/ShopDiscount/types.d.ts +4 -5
- package/lib/solution/ShopDiscount/types.js +37 -15
- package/lib/solution/ShopDiscount/utils.d.ts +0 -9
- package/lib/solution/ShopDiscount/utils.js +172 -309
- package/lib/solution/UnifiedBookingSales/index.js +405 -379
- package/lib/solution/UnifiedBookingSales/types.js +31 -12
- package/lib/solution/VenueBooking/index.d.ts +3 -31
- package/lib/solution/VenueBooking/index.js +916 -967
- package/lib/solution/VenueBooking/types.d.ts +1 -3
- package/lib/solution/VenueBooking/types.js +39 -20
- package/lib/solution/VenueBooking/utils/dateSummary.d.ts +2 -2
- package/lib/solution/VenueBooking/utils/dateSummary.js +62 -25
- package/lib/solution/VenueBooking/utils/resource.js +54 -31
- package/lib/solution/VenueBooking/utils/slotMerge.js +107 -94
- package/lib/solution/VenueBooking/utils/timeSlot.d.ts +0 -2
- package/lib/solution/VenueBooking/utils/timeSlot.js +133 -138
- package/lib/solution/VenueBooking/utils.js +67 -130
- package/lib/solution/index.js +41 -124
- package/lib/store/createStore.js +29 -32
- package/lib/types/index.d.ts +1 -1
- package/lib/types/index.js +16 -4
- package/lib/utils/task.js +36 -36
- package/lib/utils/watch.js +47 -81
- package/package.json +2 -4
- package/dist/solution/VenueBooking/utils/smartPricing.d.ts +0 -70
- package/dist/solution/VenueBooking/utils/smartPricing.js +0 -233
- package/lib/solution/VenueBooking/utils/smartPricing.d.ts +0 -70
- package/lib/solution/VenueBooking/utils/smartPricing.js +0 -192
|
@@ -1,220 +1,169 @@
|
|
|
1
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
2
18
|
|
|
3
|
-
|
|
4
|
-
|
|
19
|
+
// src/solution/BookingTicket/utils/scan/applyGlobalScan.ts
|
|
20
|
+
var applyGlobalScan_exports = {};
|
|
21
|
+
__export(applyGlobalScan_exports, {
|
|
22
|
+
applyGlobalScan: () => applyGlobalScan
|
|
5
23
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
/** applyGlobalScan 所需的 BookingTicket 运行时能力 */
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* 处理单条扫码商品的加车决策(含弹窗链)。
|
|
14
|
-
*/
|
|
24
|
+
module.exports = __toCommonJS(applyGlobalScan_exports);
|
|
25
|
+
var import_addProductDecision = require("../addProductDecision");
|
|
26
|
+
var import_cartView = require("../cartView");
|
|
27
|
+
var import_scanProductValues = require("./scanProductValues");
|
|
15
28
|
async function processScannedProductItem(host, item, code, bridge) {
|
|
16
29
|
const ctx = host.buildAddProductCtx();
|
|
17
|
-
if ((0,
|
|
30
|
+
if ((0, import_scanProductValues.isScanProductBundle)(item) || (0, import_scanProductValues.isScanProductOption)(item)) {
|
|
18
31
|
return runRequiresDetailFlow(host, item, ctx, bridge);
|
|
19
32
|
}
|
|
20
|
-
if ((0,
|
|
33
|
+
if ((0, import_scanProductValues.countScanVariantMatches)(item, code) >= 2) {
|
|
21
34
|
return runRequiresDetailFlow(host, item, ctx, bridge);
|
|
22
35
|
}
|
|
23
|
-
const values = (0,
|
|
24
|
-
const itemWithSelection = {
|
|
25
|
-
...item,
|
|
26
|
-
cartDetailValue: values
|
|
27
|
-
};
|
|
36
|
+
const values = (0, import_scanProductValues.genScanProductValues)(item, code);
|
|
37
|
+
const itemWithSelection = { ...item, cartDetailValue: values };
|
|
28
38
|
const decision = host.decideAddProduct(itemWithSelection, ctx);
|
|
29
39
|
return runAddProductDecision(host, item, decision, ctx, bridge);
|
|
30
40
|
}
|
|
31
41
|
async function runRequiresDetailFlow(host, item, ctx, bridge) {
|
|
32
|
-
if (!bridge
|
|
33
|
-
return
|
|
42
|
+
if (!(bridge == null ? void 0 : bridge.openProductDetail)) {
|
|
43
|
+
return "pending";
|
|
34
44
|
}
|
|
35
|
-
const payload = (0,
|
|
45
|
+
const payload = (0, import_addProductDecision.buildRequiresDetailPayload)(item, ctx);
|
|
36
46
|
const detailResult = await bridge.openProductDetail(payload);
|
|
37
47
|
if (!detailResult) {
|
|
38
|
-
return
|
|
48
|
+
return "cancelled";
|
|
39
49
|
}
|
|
40
50
|
if (!bridge.confirmDetail) {
|
|
41
|
-
return
|
|
51
|
+
return "pending";
|
|
42
52
|
}
|
|
43
53
|
await bridge.confirmDetail({
|
|
44
54
|
item: payload.productData ?? payload.item ?? item,
|
|
45
55
|
detailResult
|
|
46
56
|
});
|
|
47
|
-
return
|
|
57
|
+
return "added";
|
|
48
58
|
}
|
|
49
59
|
async function runAddProductDecision(host, catalogItem, decision, ctx, bridge) {
|
|
50
|
-
if (decision.action ===
|
|
51
|
-
return
|
|
60
|
+
if (decision.action === "reloadCatalog") {
|
|
61
|
+
return "cancelled";
|
|
52
62
|
}
|
|
53
|
-
if (decision.action ===
|
|
63
|
+
if (decision.action === "add") {
|
|
54
64
|
const transformed = host.transformDetailToProductAndBooking({
|
|
55
65
|
item: catalogItem,
|
|
56
66
|
cacheItem: decision.cacheItem,
|
|
57
67
|
options: ctx
|
|
58
68
|
});
|
|
59
69
|
await host.addProductToOrder(transformed.product, transformed.booking);
|
|
60
|
-
return
|
|
70
|
+
return "added";
|
|
61
71
|
}
|
|
62
|
-
if (decision.action ===
|
|
72
|
+
if (decision.action === "requiresDetail") {
|
|
63
73
|
return runRequiresDetailFlow(host, catalogItem, ctx, bridge);
|
|
64
74
|
}
|
|
65
|
-
if (decision.action ===
|
|
66
|
-
if (!bridge
|
|
67
|
-
return
|
|
75
|
+
if (decision.action === "requiresBookingEdit") {
|
|
76
|
+
if (!(bridge == null ? void 0 : bridge.openBookingEdit)) {
|
|
77
|
+
return "pending";
|
|
68
78
|
}
|
|
69
79
|
const edited = await bridge.openBookingEdit(decision.payload);
|
|
70
80
|
if (!edited) {
|
|
71
|
-
return
|
|
81
|
+
return "cancelled";
|
|
72
82
|
}
|
|
73
83
|
if (!bridge.confirmBookingEdit) {
|
|
74
|
-
return
|
|
84
|
+
return "pending";
|
|
75
85
|
}
|
|
76
|
-
await bridge.confirmBookingEdit({
|
|
77
|
-
|
|
78
|
-
});
|
|
79
|
-
return 'added';
|
|
86
|
+
await bridge.confirmBookingEdit({ cacheItem: edited });
|
|
87
|
+
return "added";
|
|
80
88
|
}
|
|
81
|
-
return
|
|
89
|
+
return "pending";
|
|
82
90
|
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* 应用全局扫码格式化结果:设客户 / 加车 / 开单 / 弹窗链。
|
|
86
|
-
*
|
|
87
|
-
* @example
|
|
88
|
-
* ```ts
|
|
89
|
-
* const result = await applyGlobalScan(bookingTicket, formatted, bridge);
|
|
90
|
-
* ```
|
|
91
|
-
*/
|
|
92
91
|
async function applyGlobalScan(host, formatted, bridge) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
scanCode
|
|
97
|
-
} = formatted;
|
|
98
|
-
if (searchType === 'wallet') {
|
|
92
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
93
|
+
const { searchType, data, scanCode } = formatted;
|
|
94
|
+
if (searchType === "wallet") {
|
|
99
95
|
if (!data) {
|
|
100
|
-
bridge
|
|
101
|
-
return {
|
|
102
|
-
status: 'failed',
|
|
103
|
-
reason: 'invalid_data'
|
|
104
|
-
};
|
|
96
|
+
(_a = bridge == null ? void 0 : bridge.onNotify) == null ? void 0 : _a.call(bridge, "fail", "pisell2.text.scan-global-failed");
|
|
97
|
+
return { status: "failed", reason: "invalid_data" };
|
|
105
98
|
}
|
|
106
99
|
host.setOrderCustomer(data);
|
|
107
|
-
bridge
|
|
108
|
-
return {
|
|
109
|
-
status: 'success',
|
|
110
|
-
kind: 'customer'
|
|
111
|
-
};
|
|
100
|
+
(_b = bridge == null ? void 0 : bridge.onNotify) == null ? void 0 : _b.call(bridge, "success", "pisell2.text.add-client-success");
|
|
101
|
+
return { status: "success", kind: "customer" };
|
|
112
102
|
}
|
|
113
|
-
if (searchType ===
|
|
103
|
+
if (searchType === "walletPass") {
|
|
114
104
|
if (!data) {
|
|
115
|
-
bridge
|
|
116
|
-
return {
|
|
117
|
-
status: 'failed',
|
|
118
|
-
reason: 'invalid_data'
|
|
119
|
-
};
|
|
105
|
+
(_c = bridge == null ? void 0 : bridge.onNotify) == null ? void 0 : _c.call(bridge, "fail", "pisell2.text.scan-global-failed");
|
|
106
|
+
return { status: "failed", reason: "invalid_data" };
|
|
120
107
|
}
|
|
121
108
|
const snapshot = host.getOrderCustomerSnapshot();
|
|
122
|
-
const scannedCustomerIsWalkIn = (0,
|
|
123
|
-
if ((0,
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
return {
|
|
127
|
-
status: 'failed',
|
|
128
|
-
reason: 'no_bridge'
|
|
129
|
-
};
|
|
109
|
+
const scannedCustomerIsWalkIn = (0, import_cartView.isWalkInCustomer)(data);
|
|
110
|
+
if ((0, import_cartView.isWalkInCustomer)(snapshot) || scannedCustomerIsWalkIn) {
|
|
111
|
+
if (!(bridge == null ? void 0 : bridge.applyPromotionCode)) {
|
|
112
|
+
return { status: "failed", reason: "no_bridge" };
|
|
130
113
|
}
|
|
131
114
|
const result = await bridge.applyPromotionCode(scanCode);
|
|
132
|
-
if (result
|
|
133
|
-
return {
|
|
134
|
-
status: 'success',
|
|
135
|
-
kind: 'promotion'
|
|
136
|
-
};
|
|
115
|
+
if (result == null ? void 0 : result.isAvailable) {
|
|
116
|
+
return { status: "success", kind: "promotion" };
|
|
137
117
|
}
|
|
138
|
-
return {
|
|
139
|
-
status: 'failed',
|
|
140
|
-
reason: 'invalid_data'
|
|
141
|
-
};
|
|
118
|
+
return { status: "failed", reason: "invalid_data" };
|
|
142
119
|
}
|
|
143
120
|
host.setOrderCustomer(data);
|
|
144
|
-
bridge
|
|
145
|
-
return {
|
|
146
|
-
status: 'success',
|
|
147
|
-
kind: 'customer'
|
|
148
|
-
};
|
|
121
|
+
(_d = bridge == null ? void 0 : bridge.onNotify) == null ? void 0 : _d.call(bridge, "success", "pisell2.text.add-client-success");
|
|
122
|
+
return { status: "success", kind: "customer" };
|
|
149
123
|
}
|
|
150
|
-
if (searchType ===
|
|
151
|
-
const list = data
|
|
124
|
+
if (searchType === "product" || searchType === "local_product") {
|
|
125
|
+
const list = data == null ? void 0 : data.list;
|
|
152
126
|
if (!Array.isArray(list) || list.length === 0) {
|
|
153
|
-
bridge
|
|
154
|
-
return {
|
|
155
|
-
status: 'failed',
|
|
156
|
-
reason: 'invalid_data'
|
|
157
|
-
};
|
|
127
|
+
(_e = bridge == null ? void 0 : bridge.onNotify) == null ? void 0 : _e.call(bridge, "fail", "pisell2.text.scan-global-failed");
|
|
128
|
+
return { status: "failed", reason: "invalid_data" };
|
|
158
129
|
}
|
|
159
130
|
let addedCount = 0;
|
|
160
131
|
for (const item of list) {
|
|
161
132
|
const outcome = await processScannedProductItem(host, item, scanCode, bridge);
|
|
162
|
-
if (outcome ===
|
|
133
|
+
if (outcome === "added") {
|
|
163
134
|
addedCount += 1;
|
|
164
135
|
}
|
|
165
|
-
if (outcome ===
|
|
166
|
-
return {
|
|
167
|
-
status: 'cancelled'
|
|
168
|
-
};
|
|
136
|
+
if (outcome === "cancelled") {
|
|
137
|
+
return { status: "cancelled" };
|
|
169
138
|
}
|
|
170
|
-
if (outcome ===
|
|
171
|
-
return {
|
|
172
|
-
status: 'pending',
|
|
173
|
-
kind: 'requiresDetail'
|
|
174
|
-
};
|
|
139
|
+
if (outcome === "pending") {
|
|
140
|
+
return { status: "pending", kind: "requiresDetail" };
|
|
175
141
|
}
|
|
176
142
|
}
|
|
177
143
|
if (addedCount > 0) {
|
|
178
|
-
bridge
|
|
179
|
-
return {
|
|
180
|
-
status: 'success',
|
|
181
|
-
kind: 'products',
|
|
182
|
-
meta: {
|
|
183
|
-
count: addedCount
|
|
184
|
-
}
|
|
185
|
-
};
|
|
144
|
+
(_f = bridge == null ? void 0 : bridge.onNotify) == null ? void 0 : _f.call(bridge, "success");
|
|
145
|
+
return { status: "success", kind: "products", meta: { count: addedCount } };
|
|
186
146
|
}
|
|
187
|
-
return {
|
|
188
|
-
status: 'failed',
|
|
189
|
-
reason: 'no_bridge'
|
|
190
|
-
};
|
|
147
|
+
return { status: "failed", reason: "no_bridge" };
|
|
191
148
|
}
|
|
192
|
-
if (searchType ===
|
|
193
|
-
const orderId = data
|
|
149
|
+
if (searchType === "order") {
|
|
150
|
+
const orderId = (data == null ? void 0 : data.order_id) ?? (data == null ? void 0 : data.id);
|
|
194
151
|
if (!orderId) {
|
|
195
|
-
bridge
|
|
196
|
-
return {
|
|
197
|
-
status: 'failed',
|
|
198
|
-
reason: 'invalid_data'
|
|
199
|
-
};
|
|
152
|
+
(_g = bridge == null ? void 0 : bridge.onNotify) == null ? void 0 : _g.call(bridge, "fail", "pisell2.text.scan-global-failed");
|
|
153
|
+
return { status: "failed", reason: "invalid_data" };
|
|
200
154
|
}
|
|
201
|
-
if (!bridge
|
|
202
|
-
return {
|
|
203
|
-
status: 'pending',
|
|
204
|
-
kind: 'openOrder'
|
|
205
|
-
};
|
|
155
|
+
if (!(bridge == null ? void 0 : bridge.openOrder)) {
|
|
156
|
+
return { status: "pending", kind: "openOrder" };
|
|
206
157
|
}
|
|
207
158
|
bridge.openOrder({
|
|
208
159
|
order_id: Number(orderId),
|
|
209
|
-
business_code: data
|
|
160
|
+
business_code: (data == null ? void 0 : data.business_code) ?? host.getBusinessCode()
|
|
210
161
|
});
|
|
211
|
-
return {
|
|
212
|
-
status: 'pending',
|
|
213
|
-
kind: 'openOrder'
|
|
214
|
-
};
|
|
162
|
+
return { status: "pending", kind: "openOrder" };
|
|
215
163
|
}
|
|
216
|
-
return {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
164
|
+
return { status: "failed", reason: "invalid_data" };
|
|
165
|
+
}
|
|
166
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
167
|
+
0 && (module.exports = {
|
|
168
|
+
applyGlobalScan
|
|
169
|
+
});
|
|
@@ -1,77 +1,85 @@
|
|
|
1
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
2
18
|
|
|
3
|
-
|
|
4
|
-
|
|
19
|
+
// src/solution/BookingTicket/utils/scan/cloudSearch.ts
|
|
20
|
+
var cloudSearch_exports = {};
|
|
21
|
+
__export(cloudSearch_exports, {
|
|
22
|
+
searchOrder: () => searchOrder,
|
|
23
|
+
searchProduct: () => searchProduct,
|
|
24
|
+
searchWallet: () => searchWallet,
|
|
25
|
+
searchWalletPass: () => searchWalletPass
|
|
5
26
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* 搜索通用识别码
|
|
9
|
-
*/
|
|
10
|
-
const searchWalletPass = async (request, code) => {
|
|
27
|
+
module.exports = __toCommonJS(cloudSearch_exports);
|
|
28
|
+
var searchWalletPass = async (request, code) => {
|
|
11
29
|
const params = {
|
|
12
30
|
code,
|
|
13
31
|
translate_flag: 1,
|
|
14
32
|
// 翻译识别码名称 0:不翻译 1:翻译
|
|
15
33
|
relation_product: 1,
|
|
16
34
|
// 组装关联商品: 0不处理 1处理
|
|
17
|
-
with: [
|
|
18
|
-
tags: [
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
35
|
+
with: ["customer"],
|
|
36
|
+
tags: [
|
|
37
|
+
"point_card",
|
|
38
|
+
// 积分卡
|
|
39
|
+
"gift_card",
|
|
40
|
+
// 充值卡
|
|
41
|
+
"product_voucher",
|
|
42
|
+
// 代金券
|
|
43
|
+
"product_discount_card",
|
|
44
|
+
// 折扣卡
|
|
45
|
+
"good_pass",
|
|
46
|
+
// 商品券
|
|
47
|
+
"session_ticket",
|
|
48
|
+
// 场次票
|
|
49
|
+
"appointment_ticket"
|
|
50
|
+
// 预约类门票
|
|
31
51
|
]
|
|
32
52
|
};
|
|
33
53
|
try {
|
|
34
|
-
const res = await request
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
};
|
|
54
|
+
const res = await (request == null ? void 0 : request.get(
|
|
55
|
+
"/machinecode/batch-search",
|
|
56
|
+
params
|
|
57
|
+
));
|
|
58
|
+
if ((res == null ? void 0 : res.code) == 200 && !!(res == null ? void 0 : res.data)) {
|
|
59
|
+
return { searchType: "walletPass", response: res };
|
|
40
60
|
}
|
|
41
|
-
throw new Error(
|
|
61
|
+
throw new Error("没有找到对应的识别码");
|
|
42
62
|
} catch (error) {
|
|
43
63
|
throw error;
|
|
44
64
|
}
|
|
45
65
|
};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
* 搜索钱包
|
|
49
|
-
*/
|
|
50
|
-
exports.searchWalletPass = searchWalletPass;
|
|
51
|
-
const searchWallet = async (request, code) => {
|
|
52
|
-
const params = {
|
|
53
|
-
code,
|
|
54
|
-
with_customer: 1
|
|
55
|
-
};
|
|
66
|
+
var searchWallet = async (request, code) => {
|
|
67
|
+
const params = { code, with_customer: 1 };
|
|
56
68
|
try {
|
|
57
|
-
const res = await request
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
};
|
|
69
|
+
const res = await (request == null ? void 0 : request.post(
|
|
70
|
+
"/wallet/detail/search",
|
|
71
|
+
params
|
|
72
|
+
));
|
|
73
|
+
if ((res == null ? void 0 : res.code) == 200 && !!(res == null ? void 0 : res.data)) {
|
|
74
|
+
return { searchType: "wallet", response: res };
|
|
63
75
|
}
|
|
64
|
-
throw new Error(
|
|
76
|
+
throw new Error("没有找到对应的识别码");
|
|
65
77
|
} catch (error) {
|
|
66
78
|
throw error;
|
|
67
79
|
}
|
|
68
80
|
};
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
* 搜索商品
|
|
72
|
-
*/
|
|
73
|
-
exports.searchWallet = searchWallet;
|
|
74
|
-
const searchProduct = async (request, code) => {
|
|
81
|
+
var searchProduct = async (request, code) => {
|
|
82
|
+
var _a, _b;
|
|
75
83
|
const params = {
|
|
76
84
|
exact_search: code,
|
|
77
85
|
open_bundle: 0,
|
|
@@ -80,43 +88,47 @@ const searchProduct = async (request, code) => {
|
|
|
80
88
|
// 报价单
|
|
81
89
|
skip: 1,
|
|
82
90
|
num: 20,
|
|
83
|
-
status:
|
|
84
|
-
with: [
|
|
85
|
-
with_count: [
|
|
86
|
-
exclude_extension_type: [
|
|
91
|
+
status: "published",
|
|
92
|
+
with: ["variantGroup.variantItem", "optionGroup.optionItem"],
|
|
93
|
+
with_count: ["bundleGroup", "optionGroup"],
|
|
94
|
+
exclude_extension_type: [
|
|
95
|
+
"product_party",
|
|
96
|
+
"product_event",
|
|
97
|
+
"product_series_event",
|
|
98
|
+
"product_package_ticket",
|
|
99
|
+
"ticket",
|
|
100
|
+
"event_item"
|
|
101
|
+
]
|
|
87
102
|
};
|
|
88
103
|
try {
|
|
89
|
-
const res = await request
|
|
90
|
-
if (res
|
|
91
|
-
return {
|
|
92
|
-
searchType: 'product',
|
|
93
|
-
response: res
|
|
94
|
-
};
|
|
104
|
+
const res = await (request == null ? void 0 : request.post("/product/query", params));
|
|
105
|
+
if ((res == null ? void 0 : res.code) == 200 && ((_b = (_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) == null ? void 0 : _b.length) > 0) {
|
|
106
|
+
return { searchType: "product", response: res };
|
|
95
107
|
}
|
|
96
|
-
throw new Error(
|
|
108
|
+
throw new Error("没有找到对应的识别码");
|
|
97
109
|
} catch (error) {
|
|
98
110
|
throw error;
|
|
99
111
|
}
|
|
100
112
|
};
|
|
101
|
-
|
|
102
|
-
const searchOrder = async (request, code) => {
|
|
113
|
+
var searchOrder = async (request, code) => {
|
|
103
114
|
try {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
},
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
if (res?.code == 200 && !!res?.data) {
|
|
112
|
-
return {
|
|
113
|
-
searchType: 'order',
|
|
114
|
-
response: res
|
|
115
|
-
};
|
|
115
|
+
const res = await (request == null ? void 0 : request.get(`/order/sales/${code}`, {
|
|
116
|
+
lookup_mode: "multi"
|
|
117
|
+
}, { customToast: () => {
|
|
118
|
+
}, osServer: true }));
|
|
119
|
+
console.log("searchOrder>>>>>>>", res);
|
|
120
|
+
if ((res == null ? void 0 : res.code) == 200 && !!(res == null ? void 0 : res.data)) {
|
|
121
|
+
return { searchType: "order", response: res };
|
|
116
122
|
}
|
|
117
|
-
throw new Error(
|
|
123
|
+
throw new Error("没有找到对应的识别码");
|
|
118
124
|
} catch (error) {
|
|
119
125
|
throw error;
|
|
120
126
|
}
|
|
121
127
|
};
|
|
122
|
-
|
|
128
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
129
|
+
0 && (module.exports = {
|
|
130
|
+
searchOrder,
|
|
131
|
+
searchProduct,
|
|
132
|
+
searchWallet,
|
|
133
|
+
searchWalletPass
|
|
134
|
+
});
|
|
@@ -1,64 +1,51 @@
|
|
|
1
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
2
18
|
|
|
3
|
-
|
|
4
|
-
|
|
19
|
+
// src/solution/BookingTicket/utils/scan/formatGlobalScan.ts
|
|
20
|
+
var formatGlobalScan_exports = {};
|
|
21
|
+
__export(formatGlobalScan_exports, {
|
|
22
|
+
formatGlobalScanResult: () => formatGlobalScanResult
|
|
5
23
|
});
|
|
6
|
-
exports
|
|
7
|
-
/**
|
|
8
|
-
* 全局扫码搜索结果格式化(对齐 ticketBooking `formatScanGlobal`)。
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* 将 handleGlobalScan 返回的原始结构格式化为 UI/OS 统一结构。
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```ts
|
|
16
|
-
* const formatted = formatGlobalScanResult(
|
|
17
|
-
* { searchType: 'wallet', response: { code: 200, data: { customer: {...} } } },
|
|
18
|
-
* 'WL123',
|
|
19
|
-
* );
|
|
20
|
-
* // => { searchType: 'wallet', data: customerObj, scanCode: 'WL123' }
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
24
|
+
module.exports = __toCommonJS(formatGlobalScan_exports);
|
|
23
25
|
function formatGlobalScanResult(raw, scanCode) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
} = raw;
|
|
28
|
-
const {
|
|
29
|
-
|
|
30
|
-
code
|
|
31
|
-
} = raw.response || {};
|
|
32
|
-
if (code !== 200 && searchType !== 'local_product') {
|
|
26
|
+
var _a;
|
|
27
|
+
if (!(raw == null ? void 0 : raw.searchType))
|
|
28
|
+
return null;
|
|
29
|
+
const { searchType } = raw;
|
|
30
|
+
const { data: resultData, code } = raw.response || {};
|
|
31
|
+
if (code !== 200 && searchType !== "local_product") {
|
|
33
32
|
return null;
|
|
34
33
|
}
|
|
35
|
-
if (searchType ===
|
|
36
|
-
return {
|
|
37
|
-
searchType,
|
|
38
|
-
data: resultData?.customer,
|
|
39
|
-
scanCode
|
|
40
|
-
};
|
|
34
|
+
if (searchType === "wallet") {
|
|
35
|
+
return { searchType, data: resultData == null ? void 0 : resultData.customer, scanCode };
|
|
41
36
|
}
|
|
42
|
-
if (searchType ===
|
|
43
|
-
return {
|
|
44
|
-
searchType,
|
|
45
|
-
data: resultData?.[0]?.customer,
|
|
46
|
-
scanCode
|
|
47
|
-
};
|
|
37
|
+
if (searchType === "walletPass") {
|
|
38
|
+
return { searchType, data: (_a = resultData == null ? void 0 : resultData[0]) == null ? void 0 : _a.customer, scanCode };
|
|
48
39
|
}
|
|
49
|
-
if (searchType ===
|
|
50
|
-
return {
|
|
51
|
-
searchType,
|
|
52
|
-
data: resultData,
|
|
53
|
-
scanCode
|
|
54
|
-
};
|
|
40
|
+
if (searchType === "product" || searchType === "local_product") {
|
|
41
|
+
return { searchType, data: resultData, scanCode };
|
|
55
42
|
}
|
|
56
|
-
if (searchType ===
|
|
57
|
-
return {
|
|
58
|
-
searchType,
|
|
59
|
-
data: resultData,
|
|
60
|
-
scanCode
|
|
61
|
-
};
|
|
43
|
+
if (searchType === "order") {
|
|
44
|
+
return { searchType, data: resultData, scanCode };
|
|
62
45
|
}
|
|
63
46
|
return null;
|
|
64
|
-
}
|
|
47
|
+
}
|
|
48
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
+
0 && (module.exports = {
|
|
50
|
+
formatGlobalScanResult
|
|
51
|
+
});
|