@pisell/pisellos 0.0.498 → 0.0.500
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 +2 -2
- 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/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 +2 -2
- 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) {
|
|
@@ -141,10 +141,26 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
141
141
|
}, {
|
|
142
142
|
key: "registerDiscountModules",
|
|
143
143
|
value: function registerDiscountModules(options) {
|
|
144
|
+
var _targetCacheData;
|
|
145
|
+
var targetCacheData = {};
|
|
146
|
+
if (this.cacheId && this.window) {
|
|
147
|
+
var sessionData = this.window.sessionStorage.getItem(this.name);
|
|
148
|
+
if (sessionData) {
|
|
149
|
+
try {
|
|
150
|
+
var data = JSON.parse(sessionData);
|
|
151
|
+
targetCacheData = (data === null || data === void 0 ? void 0 : data[this.cacheId]) || {};
|
|
152
|
+
} catch (_unused) {
|
|
153
|
+
// sessionStorage 损坏则忽略,按空 initialState 走
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
144
157
|
var discount = new DiscountModule("".concat(this.name, "_discount"));
|
|
145
158
|
this.core.registerModule(discount, {
|
|
159
|
+
initialState: (_targetCacheData = targetCacheData) === null || _targetCacheData === void 0 ? void 0 : _targetCacheData[discount.name],
|
|
146
160
|
otherParams: {
|
|
147
|
-
fatherModule: this.name
|
|
161
|
+
fatherModule: this.name,
|
|
162
|
+
openCache: !!this.cacheId,
|
|
163
|
+
cacheId: this.cacheId
|
|
148
164
|
}
|
|
149
165
|
});
|
|
150
166
|
this.store.discount = discount;
|
|
@@ -404,7 +420,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
404
420
|
return;
|
|
405
421
|
}
|
|
406
422
|
this.store.tempOrder = parsedData;
|
|
407
|
-
} catch (
|
|
423
|
+
} catch (_unused2) {
|
|
408
424
|
var _this$window;
|
|
409
425
|
(_this$window = this.window) === null || _this$window === void 0 || (_this$window = _this$window.localStorage) === null || _this$window === void 0 || _this$window.removeItem(key);
|
|
410
426
|
}
|
|
@@ -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 || [],
|
|
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
311
311
|
date: string;
|
|
312
312
|
status: string;
|
|
313
313
|
week: string;
|
|
314
|
-
weekNum: 0 | 1 |
|
|
314
|
+
weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
315
315
|
}[]>;
|
|
316
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
317
|
private getScheduleDataByIds;
|
|
@@ -330,7 +330,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
330
330
|
count: number;
|
|
331
331
|
left: number;
|
|
332
332
|
summaryCount: number;
|
|
333
|
-
status: "
|
|
333
|
+
status: "lots_of_space" | "filling_up_fast" | "sold_out";
|
|
334
334
|
}[];
|
|
335
335
|
/**
|
|
336
336
|
* 找到多个资源的公共可用时间段
|
|
@@ -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[];
|