@pisell/pisellos 2.2.266 → 2.2.270
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.d.ts +2 -0
- package/dist/core/index.js +7 -0
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/modules/OpenData/index.d.ts +2 -0
- package/dist/modules/OpenData/index.js +8 -0
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +3 -1
- package/dist/solution/BookingTicket/index.js +10 -3
- package/dist/types/index.d.ts +1 -0
- package/lib/core/index.d.ts +2 -0
- package/lib/core/index.js +4 -0
- package/lib/model/strategy/adapter/promotion/index.js +0 -51
- package/lib/modules/OpenData/index.d.ts +2 -0
- package/lib/modules/OpenData/index.js +5 -0
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +3 -1
- package/lib/solution/BookingTicket/index.js +7 -1
- package/lib/types/index.d.ts +1 -0
- package/package.json +2 -2
package/dist/core/index.d.ts
CHANGED
|
@@ -28,6 +28,8 @@ declare class PisellOSCore implements PisellCore {
|
|
|
28
28
|
getModule<T extends Module>(name: string): T | null;
|
|
29
29
|
getModuleExports<T = any>(name: string): T | null;
|
|
30
30
|
hasModule(name: string): boolean;
|
|
31
|
+
/** 返回当前已注册模块名,供宿主在切换店铺等生命周期中定向清理运行态。 */
|
|
32
|
+
getModuleNames(): string[];
|
|
31
33
|
destroy(): Promise<void>;
|
|
32
34
|
setContext(ctx: Partial<BusinessContext>): void;
|
|
33
35
|
/**
|
package/dist/core/index.js
CHANGED
|
@@ -300,6 +300,13 @@ var PisellOSCore = /*#__PURE__*/function () {
|
|
|
300
300
|
return this.modules.has(name);
|
|
301
301
|
}
|
|
302
302
|
|
|
303
|
+
/** 返回当前已注册模块名,供宿主在切换店铺等生命周期中定向清理运行态。 */
|
|
304
|
+
}, {
|
|
305
|
+
key: "getModuleNames",
|
|
306
|
+
value: function getModuleNames() {
|
|
307
|
+
return Array.from(this.modules.keys());
|
|
308
|
+
}
|
|
309
|
+
|
|
303
310
|
// 销毁方法
|
|
304
311
|
}, {
|
|
305
312
|
key: "destroy",
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// 导出评估器
|
|
2
|
+
export { PromotionEvaluator } from "./evaluator";
|
|
3
|
+
|
|
4
|
+
// 导出适配器
|
|
5
|
+
export { PromotionAdapter } from "./adapter";
|
|
6
|
+
export { default } from "./adapter";
|
|
7
|
+
|
|
8
|
+
// 导出策略配置示例常量
|
|
9
|
+
export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY, ITEM_REWARD_STRATEGY } from "./examples";
|
|
@@ -27,6 +27,8 @@ export declare class OpenDataModule extends BaseModule implements Module {
|
|
|
27
27
|
fetchOpenData(params: OpenDataFetchParams): Promise<OpenDataConfig>;
|
|
28
28
|
getOpenData(): OpenDataConfig | null;
|
|
29
29
|
getLastFetchedAt(): number | null;
|
|
30
|
+
/** 清除内存与 sessionStorage 镜像中的 OpenData,供宿主切店时调用。 */
|
|
31
|
+
clearCache(): void;
|
|
30
32
|
checkAvailability(scheduleModule?: ScheduleModule): OpenDataAvailabilityResult;
|
|
31
33
|
storeChange(): void;
|
|
32
34
|
}
|
|
@@ -166,6 +166,14 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
166
166
|
var _this$store$lastFetch;
|
|
167
167
|
return (_this$store$lastFetch = this.store.lastFetchedAt) !== null && _this$store$lastFetch !== void 0 ? _this$store$lastFetch : null;
|
|
168
168
|
}
|
|
169
|
+
|
|
170
|
+
/** 清除内存与 sessionStorage 镜像中的 OpenData,供宿主切店时调用。 */
|
|
171
|
+
}, {
|
|
172
|
+
key: "clearCache",
|
|
173
|
+
value: function clearCache() {
|
|
174
|
+
this.store.data = null;
|
|
175
|
+
this.store.lastFetchedAt = null;
|
|
176
|
+
}
|
|
169
177
|
}, {
|
|
170
178
|
key: "checkAvailability",
|
|
171
179
|
value: function checkAvailability(scheduleModule) {
|
|
@@ -485,7 +485,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
485
485
|
generateIdempotencyToken(): string;
|
|
486
486
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
487
487
|
createOrder(params: CommitOrderParams['query']): {
|
|
488
|
-
type: "
|
|
488
|
+
type: "appointment_booking" | "virtual";
|
|
489
489
|
platform: string;
|
|
490
490
|
sales_channel: string;
|
|
491
491
|
order_sales_channel: string;
|
|
@@ -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 |
|
|
314
|
+
weekNum: 0 | 2 | 1 | 5 | 4 | 3 | 6;
|
|
315
315
|
}[]>;
|
|
316
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
317
|
private getScheduleDataByIds;
|
|
@@ -46,6 +46,8 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
46
46
|
private getIdGeneratorPlugin;
|
|
47
47
|
private loadOpenDataConfig;
|
|
48
48
|
getOpenData(): Promise<OpenDataConfig | null>;
|
|
49
|
+
/** 清除店铺级 OpenData;下一次 getOpenData 时会重新拉取。 */
|
|
50
|
+
clearOpenDataCache(): void;
|
|
49
51
|
private getShortNumberOrDeviceId;
|
|
50
52
|
private configureIdGeneratorFromOpenData;
|
|
51
53
|
private normalizePositiveInteger;
|
|
@@ -322,7 +324,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
322
324
|
* 获取当前的客户搜索条件
|
|
323
325
|
* @returns 当前搜索条件
|
|
324
326
|
*/
|
|
325
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
327
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
|
|
326
328
|
/**
|
|
327
329
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
328
330
|
* @returns 客户状态
|
|
@@ -337,11 +337,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
337
337
|
key: "getOpenData",
|
|
338
338
|
value: function () {
|
|
339
339
|
var _getOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
340
|
-
var _this$store$openData;
|
|
341
340
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
342
341
|
while (1) switch (_context3.prev = _context3.next) {
|
|
343
342
|
case 0:
|
|
344
|
-
return _context3.abrupt("return",
|
|
343
|
+
return _context3.abrupt("return", this.loadOpenDataConfig());
|
|
345
344
|
case 1:
|
|
346
345
|
case "end":
|
|
347
346
|
return _context3.stop();
|
|
@@ -352,7 +351,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
352
351
|
return _getOpenData.apply(this, arguments);
|
|
353
352
|
}
|
|
354
353
|
return getOpenData;
|
|
355
|
-
}()
|
|
354
|
+
}() /** 清除店铺级 OpenData;下一次 getOpenData 时会重新拉取。 */
|
|
355
|
+
}, {
|
|
356
|
+
key: "clearOpenDataCache",
|
|
357
|
+
value: function clearOpenDataCache() {
|
|
358
|
+
var _this$store$openData;
|
|
359
|
+
this.loadOpenDataConfigInFlight = null;
|
|
360
|
+
this.otherParams.openData = null;
|
|
361
|
+
(_this$store$openData = this.store.openData) === null || _this$store$openData === void 0 || _this$store$openData.clearCache();
|
|
362
|
+
}
|
|
356
363
|
}, {
|
|
357
364
|
key: "getShortNumberOrDeviceId",
|
|
358
365
|
value: function () {
|
package/dist/types/index.d.ts
CHANGED
|
@@ -47,6 +47,7 @@ export interface PisellCore {
|
|
|
47
47
|
getModule: <T extends Module>(name: string) => T | null;
|
|
48
48
|
getModuleExports: <T = any>(name: string) => T | null;
|
|
49
49
|
hasModule: (name: string) => boolean;
|
|
50
|
+
getModuleNames: () => string[];
|
|
50
51
|
effects: {
|
|
51
52
|
on: (event: string, callback: (payload: any) => void) => () => void;
|
|
52
53
|
once: (event: string, callback: (payload: any) => void) => () => void;
|
package/lib/core/index.d.ts
CHANGED
|
@@ -28,6 +28,8 @@ declare class PisellOSCore implements PisellCore {
|
|
|
28
28
|
getModule<T extends Module>(name: string): T | null;
|
|
29
29
|
getModuleExports<T = any>(name: string): T | null;
|
|
30
30
|
hasModule(name: string): boolean;
|
|
31
|
+
/** 返回当前已注册模块名,供宿主在切换店铺等生命周期中定向清理运行态。 */
|
|
32
|
+
getModuleNames(): string[];
|
|
31
33
|
destroy(): Promise<void>;
|
|
32
34
|
setContext(ctx: Partial<BusinessContext>): void;
|
|
33
35
|
/**
|
package/lib/core/index.js
CHANGED
|
@@ -210,6 +210,10 @@ var PisellOSCore = class {
|
|
|
210
210
|
hasModule(name) {
|
|
211
211
|
return this.modules.has(name);
|
|
212
212
|
}
|
|
213
|
+
/** 返回当前已注册模块名,供宿主在切换店铺等生命周期中定向清理运行态。 */
|
|
214
|
+
getModuleNames() {
|
|
215
|
+
return Array.from(this.modules.keys());
|
|
216
|
+
}
|
|
213
217
|
// 销毁方法
|
|
214
218
|
async destroy() {
|
|
215
219
|
for (const [name, module2] of this.modules.entries()) {
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/model/strategy/adapter/promotion/index.ts
|
|
30
|
-
var promotion_exports = {};
|
|
31
|
-
__export(promotion_exports, {
|
|
32
|
-
BUY_X_GET_Y_FREE_STRATEGY: () => import_examples.BUY_X_GET_Y_FREE_STRATEGY,
|
|
33
|
-
ITEM_REWARD_STRATEGY: () => import_examples.ITEM_REWARD_STRATEGY,
|
|
34
|
-
PromotionAdapter: () => import_adapter.PromotionAdapter,
|
|
35
|
-
PromotionEvaluator: () => import_evaluator.PromotionEvaluator,
|
|
36
|
-
X_ITEMS_FOR_Y_PRICE_STRATEGY: () => import_examples.X_ITEMS_FOR_Y_PRICE_STRATEGY,
|
|
37
|
-
default: () => import_adapter2.default
|
|
38
|
-
});
|
|
39
|
-
module.exports = __toCommonJS(promotion_exports);
|
|
40
|
-
var import_evaluator = require("./evaluator");
|
|
41
|
-
var import_adapter = require("./adapter");
|
|
42
|
-
var import_adapter2 = __toESM(require("./adapter"));
|
|
43
|
-
var import_examples = require("./examples");
|
|
44
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
45
|
-
0 && (module.exports = {
|
|
46
|
-
BUY_X_GET_Y_FREE_STRATEGY,
|
|
47
|
-
ITEM_REWARD_STRATEGY,
|
|
48
|
-
PromotionAdapter,
|
|
49
|
-
PromotionEvaluator,
|
|
50
|
-
X_ITEMS_FOR_Y_PRICE_STRATEGY
|
|
51
|
-
});
|
|
@@ -27,6 +27,8 @@ export declare class OpenDataModule extends BaseModule implements Module {
|
|
|
27
27
|
fetchOpenData(params: OpenDataFetchParams): Promise<OpenDataConfig>;
|
|
28
28
|
getOpenData(): OpenDataConfig | null;
|
|
29
29
|
getLastFetchedAt(): number | null;
|
|
30
|
+
/** 清除内存与 sessionStorage 镜像中的 OpenData,供宿主切店时调用。 */
|
|
31
|
+
clearCache(): void;
|
|
30
32
|
checkAvailability(scheduleModule?: ScheduleModule): OpenDataAvailabilityResult;
|
|
31
33
|
storeChange(): void;
|
|
32
34
|
}
|
|
@@ -104,6 +104,11 @@ var OpenDataModule = class extends import_BaseModule.BaseModule {
|
|
|
104
104
|
getLastFetchedAt() {
|
|
105
105
|
return this.store.lastFetchedAt ?? null;
|
|
106
106
|
}
|
|
107
|
+
/** 清除内存与 sessionStorage 镜像中的 OpenData,供宿主切店时调用。 */
|
|
108
|
+
clearCache() {
|
|
109
|
+
this.store.data = null;
|
|
110
|
+
this.store.lastFetchedAt = null;
|
|
111
|
+
}
|
|
107
112
|
checkAvailability(scheduleModule) {
|
|
108
113
|
var _a;
|
|
109
114
|
const scheduleList = scheduleModule ? scheduleModule == null ? void 0 : scheduleModule.getScheduleListByIds(
|
|
@@ -485,7 +485,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
485
485
|
generateIdempotencyToken(): string;
|
|
486
486
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
487
487
|
createOrder(params: CommitOrderParams['query']): {
|
|
488
|
-
type: "
|
|
488
|
+
type: "appointment_booking" | "virtual";
|
|
489
489
|
platform: string;
|
|
490
490
|
sales_channel: string;
|
|
491
491
|
order_sales_channel: string;
|
|
@@ -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 |
|
|
314
|
+
weekNum: 0 | 2 | 1 | 5 | 4 | 3 | 6;
|
|
315
315
|
}[]>;
|
|
316
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
317
|
private getScheduleDataByIds;
|
|
@@ -46,6 +46,8 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
46
46
|
private getIdGeneratorPlugin;
|
|
47
47
|
private loadOpenDataConfig;
|
|
48
48
|
getOpenData(): Promise<OpenDataConfig | null>;
|
|
49
|
+
/** 清除店铺级 OpenData;下一次 getOpenData 时会重新拉取。 */
|
|
50
|
+
clearOpenDataCache(): void;
|
|
49
51
|
private getShortNumberOrDeviceId;
|
|
50
52
|
private configureIdGeneratorFromOpenData;
|
|
51
53
|
private normalizePositiveInteger;
|
|
@@ -322,7 +324,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
322
324
|
* 获取当前的客户搜索条件
|
|
323
325
|
* @returns 当前搜索条件
|
|
324
326
|
*/
|
|
325
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
327
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
|
|
326
328
|
/**
|
|
327
329
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
328
330
|
* @returns 客户状态
|
|
@@ -219,8 +219,14 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
221
|
async getOpenData() {
|
|
222
|
+
return this.loadOpenDataConfig();
|
|
223
|
+
}
|
|
224
|
+
/** 清除店铺级 OpenData;下一次 getOpenData 时会重新拉取。 */
|
|
225
|
+
clearOpenDataCache() {
|
|
222
226
|
var _a;
|
|
223
|
-
|
|
227
|
+
this.loadOpenDataConfigInFlight = null;
|
|
228
|
+
this.otherParams.openData = null;
|
|
229
|
+
(_a = this.store.openData) == null ? void 0 : _a.clearCache();
|
|
224
230
|
}
|
|
225
231
|
async getShortNumberOrDeviceId() {
|
|
226
232
|
const getAsyncIotDeviceInfo = this.getAppData("async_iot_device_info");
|
package/lib/types/index.d.ts
CHANGED
|
@@ -47,6 +47,7 @@ export interface PisellCore {
|
|
|
47
47
|
getModule: <T extends Module>(name: string) => T | null;
|
|
48
48
|
getModuleExports: <T = any>(name: string) => T | null;
|
|
49
49
|
hasModule: (name: string) => boolean;
|
|
50
|
+
getModuleNames: () => string[];
|
|
50
51
|
effects: {
|
|
51
52
|
on: (event: string, callback: (payload: any) => void) => () => void;
|
|
52
53
|
once: (event: string, callback: (payload: any) => void) => () => void;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"private": false,
|
|
3
3
|
"name": "@pisell/pisellos",
|
|
4
|
-
"version": "2.2.
|
|
4
|
+
"version": "2.2.270",
|
|
5
5
|
"description": "一个可扩展的前端模块化SDK框架,支持插件系统",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"format": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,md}\"",
|
|
19
19
|
"changeset": "changeset",
|
|
20
20
|
"version": "changeset version",
|
|
21
|
-
"release": "changeset publish
|
|
21
|
+
"release": "changeset publish && npm run sync && git push",
|
|
22
22
|
"example": "npx parcel-bundler examples/index.html",
|
|
23
23
|
"docs": "typedoc --out docs src/index.ts",
|
|
24
24
|
"sync": "node sync.js",
|