@pisell/pisellos 2.1.120 → 2.1.121
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/modules/OpenData/index.d.ts +1 -0
- package/dist/modules/OpenData/index.js +6 -0
- package/dist/modules/Order/index.js +18 -2
- package/dist/modules/Order/utils.d.ts +3 -0
- package/dist/modules/Order/utils.js +26 -1
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/VenueBooking/index.d.ts +5 -0
- package/dist/solution/VenueBooking/index.js +522 -464
- package/dist/solution/VenueBooking/utils/slotMerge.js +1 -2
- package/lib/model/strategy/adapter/promotion/index.js +49 -0
- package/lib/modules/OpenData/index.d.ts +1 -0
- package/lib/modules/OpenData/index.js +3 -0
- package/lib/modules/Order/index.js +15 -1
- package/lib/modules/Order/utils.d.ts +3 -0
- package/lib/modules/Order/utils.js +22 -3
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/VenueBooking/index.d.ts +5 -0
- package/lib/solution/VenueBooking/index.js +37 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +1 -2
- package/package.json +1 -1
|
@@ -18,6 +18,7 @@ export declare class OpenDataModule extends BaseModule implements Module {
|
|
|
18
18
|
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
19
19
|
fetchOpenData(params: OpenDataFetchParams): Promise<OpenDataConfig>;
|
|
20
20
|
getOpenData(): OpenDataConfig | null;
|
|
21
|
+
getLastFetchedAt(): number | null;
|
|
21
22
|
checkAvailability(scheduleModule?: ScheduleModule): OpenDataAvailabilityResult;
|
|
22
23
|
storeChange(): void;
|
|
23
24
|
}
|
|
@@ -140,6 +140,12 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
140
140
|
value: function getOpenData() {
|
|
141
141
|
return this.store.data;
|
|
142
142
|
}
|
|
143
|
+
}, {
|
|
144
|
+
key: "getLastFetchedAt",
|
|
145
|
+
value: function getLastFetchedAt() {
|
|
146
|
+
var _this$store$lastFetch;
|
|
147
|
+
return (_this$store$lastFetch = this.store.lastFetchedAt) !== null && _this$store$lastFetch !== void 0 ? _this$store$lastFetch : null;
|
|
148
|
+
}
|
|
143
149
|
}, {
|
|
144
150
|
key: "checkAvailability",
|
|
145
151
|
value: function checkAvailability(scheduleModule) {
|
|
@@ -144,10 +144,26 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
144
144
|
}, {
|
|
145
145
|
key: "registerDiscountModules",
|
|
146
146
|
value: function registerDiscountModules(options) {
|
|
147
|
+
var _targetCacheData;
|
|
148
|
+
var targetCacheData = {};
|
|
149
|
+
if (this.cacheId && this.window) {
|
|
150
|
+
var sessionData = this.window.sessionStorage.getItem(this.name);
|
|
151
|
+
if (sessionData) {
|
|
152
|
+
try {
|
|
153
|
+
var data = JSON.parse(sessionData);
|
|
154
|
+
targetCacheData = (data === null || data === void 0 ? void 0 : data[this.cacheId]) || {};
|
|
155
|
+
} catch (_unused) {
|
|
156
|
+
// sessionStorage 损坏则忽略,按空 initialState 走
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
147
160
|
var discount = new DiscountModule("".concat(this.name, "_discount"));
|
|
148
161
|
this.core.registerModule(discount, {
|
|
162
|
+
initialState: (_targetCacheData = targetCacheData) === null || _targetCacheData === void 0 ? void 0 : _targetCacheData[discount.name],
|
|
149
163
|
otherParams: {
|
|
150
|
-
fatherModule: this.name
|
|
164
|
+
fatherModule: this.name,
|
|
165
|
+
openCache: !!this.cacheId,
|
|
166
|
+
cacheId: this.cacheId
|
|
151
167
|
}
|
|
152
168
|
});
|
|
153
169
|
this.store.discount = discount;
|
|
@@ -403,7 +419,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
403
419
|
return;
|
|
404
420
|
}
|
|
405
421
|
this.store.tempOrder = parsedData;
|
|
406
|
-
} catch (
|
|
422
|
+
} catch (_unused2) {
|
|
407
423
|
var _this$window;
|
|
408
424
|
(_this$window = this.window) === null || _this$window === void 0 || (_this$window = _this$window.localStorage) === null || _this$window === void 0 || _this$window.removeItem(key);
|
|
409
425
|
}
|
|
@@ -25,6 +25,9 @@ export declare const getAllDiscountList: (cartItem: CartItem) => any;
|
|
|
25
25
|
export declare function createUuidV4(): string;
|
|
26
26
|
export declare function isTempOrder(data: any): data is ScanOrderTempOrder;
|
|
27
27
|
export declare function formatDateTime(date: Date): string;
|
|
28
|
+
export declare function normalizeSubmitBooking<T extends {
|
|
29
|
+
metadata?: Record<string, any>;
|
|
30
|
+
}>(booking: T): T;
|
|
28
31
|
export declare function createDefaultTempOrder(params: {
|
|
29
32
|
now: string;
|
|
30
33
|
summary?: ScanOrderSummary;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
var _excluded = ["_origin", "identity_key"],
|
|
2
2
|
_excluded2 = ["created_at", "summary", "surcharges"];
|
|
3
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
3
4
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
6
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -133,6 +134,28 @@ function normalizeSubmitProduct(product) {
|
|
|
133
134
|
metadata: cleanMetadata
|
|
134
135
|
});
|
|
135
136
|
}
|
|
137
|
+
var SUBMIT_BOOKING_METADATA_WHITELIST = ['unique_identification_number', 'collect_pax'];
|
|
138
|
+
export function normalizeSubmitBooking(booking) {
|
|
139
|
+
var rawMetadata = booking.metadata || {};
|
|
140
|
+
var cleanMetadata = {};
|
|
141
|
+
var _iterator = _createForOfIteratorHelper(SUBMIT_BOOKING_METADATA_WHITELIST),
|
|
142
|
+
_step;
|
|
143
|
+
try {
|
|
144
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
145
|
+
var key = _step.value;
|
|
146
|
+
if (rawMetadata[key] !== undefined) {
|
|
147
|
+
cleanMetadata[key] = rawMetadata[key];
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
} catch (err) {
|
|
151
|
+
_iterator.e(err);
|
|
152
|
+
} finally {
|
|
153
|
+
_iterator.f();
|
|
154
|
+
}
|
|
155
|
+
return _objectSpread(_objectSpread({}, booking), {}, {
|
|
156
|
+
metadata: cleanMetadata
|
|
157
|
+
});
|
|
158
|
+
}
|
|
136
159
|
var DEFAULT_TABLE_OCCUPANCY_DURATION = 20;
|
|
137
160
|
function resolveTableOccupancyDuration(tempOrder) {
|
|
138
161
|
var _metadata$table_confi, _metadata$tableConfig, _metadata$resource_co, _metadata$resourceCon;
|
|
@@ -254,7 +277,9 @@ export function buildSubmitPayload(params) {
|
|
|
254
277
|
surcharge_fee: summary.surcharge_fee || tempOrder.surcharge_fee || '0.00',
|
|
255
278
|
note: tempOrder.note || '',
|
|
256
279
|
schedule_date: scheduleDate,
|
|
257
|
-
bookings: bookings
|
|
280
|
+
bookings: bookings.map(function (booking) {
|
|
281
|
+
return normalizeSubmitBooking(booking);
|
|
282
|
+
}),
|
|
258
283
|
payments: tempOrder.payments || [],
|
|
259
284
|
// discount_list: tempOrder.discount_list || [],
|
|
260
285
|
relation_forms: tempOrder.relation_forms || [],
|
|
@@ -310,7 +310,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
310
310
|
date: string;
|
|
311
311
|
status: string;
|
|
312
312
|
week: string;
|
|
313
|
-
weekNum: 0 | 2 | 1 | 4 | 3 | 6
|
|
313
|
+
weekNum: 0 | 2 | 1 | 5 | 4 | 3 | 6;
|
|
314
314
|
}[]>;
|
|
315
315
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
316
316
|
private getScheduleDataByIds;
|
|
@@ -34,6 +34,10 @@ export declare class VenueBookingImpl extends BaseModule implements Module {
|
|
|
34
34
|
private loginEffectDisposers;
|
|
35
35
|
private customerLoginRefreshInFlight;
|
|
36
36
|
private customerLoginRefreshIdInFlight;
|
|
37
|
+
private loadAllProductsInFlight;
|
|
38
|
+
private productsLoaded;
|
|
39
|
+
private loadOpenDataConfigInFlight;
|
|
40
|
+
private static readonly OPEN_DATA_CACHE_TTL;
|
|
37
41
|
private getLoggerContext;
|
|
38
42
|
private serializeError;
|
|
39
43
|
private addVenueBookingLog;
|
|
@@ -64,6 +68,7 @@ export declare class VenueBookingImpl extends BaseModule implements Module {
|
|
|
64
68
|
venueProducts: ProductData[];
|
|
65
69
|
addonProducts: ProductData[];
|
|
66
70
|
}>;
|
|
71
|
+
private _doLoadAllProducts;
|
|
67
72
|
loadVenueProducts(): Promise<ProductData[]>;
|
|
68
73
|
loadAddonProducts(): Promise<ProductData[]>;
|
|
69
74
|
getVenueProducts(): ProductData[];
|