@pisell/pisellos 2.2.150 → 2.2.151

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.
@@ -50,7 +50,15 @@ function formatReason(template, value) {
50
50
  var c = currency === undefined || currency === null ? '' : String(currency);
51
51
  // 注意:必须先替换 value,再替换 currency
52
52
  // 否则 currency 注入的 "$" 会被后续的 /\$\{value\}/ 正则误吞
53
- return template.replace(/\$\{value\}/g, v).replace(/\{value\}/g, v).replace(/\{currency\}/g, c);
53
+ // 使用函数作为替换参数,避免替换串中的 "$" 被 String.prototype.replace
54
+ // 当作特殊序列(如 $$ -> $、$& 等)处理
55
+ return template.replace(/\$\{value\}/g, function () {
56
+ return v;
57
+ }).replace(/\{value\}/g, function () {
58
+ return v;
59
+ }).replace(/\{currency\}/g, function () {
60
+ return c;
61
+ });
54
62
  }
55
63
 
56
64
  /**
@@ -249,6 +257,7 @@ export var WalletPassEvaluator = /*#__PURE__*/function () {
249
257
  var rawText = this.getText(reasonCode);
250
258
  // 金额类型字段:从 otherParams.getData 取货币符号;非金额或取不到则留空
251
259
  var currency = failedField && AMOUNT_FIELDS.has(failedField) ? ((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 || (_this$otherParams$get = (_this$otherParams2 = _this$otherParams).getData) === null || _this$otherParams$get === void 0 ? void 0 : _this$otherParams$get.call(_this$otherParams2, 'shop_symbol')) || '' : '';
260
+ console.log(currency, 'currency12345');
252
261
  var reason = thresholdValue !== undefined ? formatReason(rawText, thresholdValue, currency) : rawText;
253
262
  results.push({
254
263
  voucher: voucher,
@@ -171,7 +171,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
171
171
  private logSubmitBackendRejected;
172
172
  syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
173
173
  createOrder(params: CommitOrderParams['query']): {
174
- type: "virtual" | "appointment_booking";
174
+ type: "appointment_booking" | "virtual";
175
175
  platform: string;
176
176
  sales_channel: string;
177
177
  order_sales_channel: string;
@@ -25,6 +25,15 @@ export declare class ScheduleModule extends BaseModule implements Module, Schedu
25
25
  setOtherProductsIds(ids: number[]): void;
26
26
  getOtherProductsIds(): number[];
27
27
  storeChange(): void;
28
+ /**
29
+ * 传入一个时间, 判断改时间是否在schedule 内
30
+ * @param param0 { date: string, schedule: any } date: 日期, schedule: schedule
31
+ * @returns
32
+ */
33
+ isInScheduleByDate({ date, schedule, }: {
34
+ date: string;
35
+ schedule: any;
36
+ }): boolean;
28
37
  /**
29
38
  * 传入一个时间, 判断改时间是否在schedule 内
30
39
  * @param param0 { date: string, schedule: any } date: 日期, schedule: schedule
@@ -243,6 +243,18 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
243
243
  });
244
244
  }
245
245
  }
246
+ /**
247
+ * 传入一个时间, 判断改时间是否在schedule 内
248
+ * @param param0 { date: string, schedule: any } date: 日期, schedule: schedule
249
+ * @returns
250
+ */
251
+ }, {
252
+ key: "isInScheduleByDate",
253
+ value: function isInScheduleByDate(_ref2) {
254
+ var date = _ref2.date,
255
+ schedule = _ref2.schedule;
256
+ return getDateIsInSchedule(date, [schedule]);
257
+ }
246
258
  /**
247
259
  * 传入一个时间, 判断改时间是否在schedule 内
248
260
  * @param param0 { date: string, schedule: any } date: 日期, schedule: schedule
@@ -250,10 +262,10 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
250
262
  */
251
263
  }], [{
252
264
  key: "isInScheduleByDate",
253
- value: function isInScheduleByDate(_ref2) {
265
+ value: function isInScheduleByDate(_ref3) {
254
266
  var _schedule$repeat_rule, _schedule$repeat_rule2;
255
- var date = _ref2.date,
256
- schedule = _ref2.schedule;
267
+ var date = _ref3.date,
268
+ schedule = _ref3.schedule;
257
269
  return getDateIsInSchedule(date, [schedule]);
258
270
  if (schedule.start_time && schedule.end_time) {
259
271
  var isBeforeStartTime = dayjs(date).isBefore(dayjs(schedule.start_time));
@@ -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 | 2 | 1 | 5 | 3 | 4 | 6;
314
+ weekNum: 0 | 1 | 2 | 5 | 4 | 3 | 6;
315
315
  }[]>;
316
316
  submitTimeSlot(timeSlots: TimeSliceItem): void;
317
317
  private getScheduleDataByIds;
@@ -59,7 +59,7 @@ function formatReason(template, value, currency = "") {
59
59
  return template;
60
60
  const v = value === void 0 || value === null ? "" : String(value);
61
61
  const c = currency === void 0 || currency === null ? "" : String(currency);
62
- return template.replace(/\$\{value\}/g, v).replace(/\{value\}/g, v).replace(/\{currency\}/g, c);
62
+ return template.replace(/\$\{value\}/g, () => v).replace(/\{value\}/g, () => v).replace(/\{currency\}/g, () => c);
63
63
  }
64
64
  var WalletPassEvaluator = class {
65
65
  constructor() {
@@ -214,6 +214,7 @@ var WalletPassEvaluator = class {
214
214
  }
215
215
  const rawText = this.getText(reasonCode);
216
216
  const currency = failedField && AMOUNT_FIELDS.has(failedField) ? ((_g = (_f = this.otherParams) == null ? void 0 : _f.getData) == null ? void 0 : _g.call(_f, "shop_symbol")) || "" : "";
217
+ console.log(currency, "currency12345");
217
218
  const reason = thresholdValue !== void 0 ? formatReason(rawText, thresholdValue, currency) : rawText;
218
219
  results.push({
219
220
  voucher,
@@ -171,7 +171,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
171
171
  private logSubmitBackendRejected;
172
172
  syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
173
173
  createOrder(params: CommitOrderParams['query']): {
174
- type: "virtual" | "appointment_booking";
174
+ type: "appointment_booking" | "virtual";
175
175
  platform: string;
176
176
  sales_channel: string;
177
177
  order_sales_channel: string;
@@ -25,6 +25,15 @@ export declare class ScheduleModule extends BaseModule implements Module, Schedu
25
25
  setOtherProductsIds(ids: number[]): void;
26
26
  getOtherProductsIds(): number[];
27
27
  storeChange(): void;
28
+ /**
29
+ * 传入一个时间, 判断改时间是否在schedule 内
30
+ * @param param0 { date: string, schedule: any } date: 日期, schedule: schedule
31
+ * @returns
32
+ */
33
+ isInScheduleByDate({ date, schedule, }: {
34
+ date: string;
35
+ schedule: any;
36
+ }): boolean;
28
37
  /**
29
38
  * 传入一个时间, 判断改时间是否在schedule 内
30
39
  * @param param0 { date: string, schedule: any } date: 日期, schedule: schedule
@@ -160,6 +160,17 @@ var ScheduleModule = class extends import_BaseModule.BaseModule {
160
160
  });
161
161
  }
162
162
  }
163
+ /**
164
+ * 传入一个时间, 判断改时间是否在schedule 内
165
+ * @param param0 { date: string, schedule: any } date: 日期, schedule: schedule
166
+ * @returns
167
+ */
168
+ isInScheduleByDate({
169
+ date,
170
+ schedule
171
+ }) {
172
+ return (0, import_getDateIsInSchedule.getDateIsInSchedule)(date, [schedule]);
173
+ }
163
174
  /**
164
175
  * 传入一个时间, 判断改时间是否在schedule 内
165
176
  * @param param0 { date: string, schedule: any } date: 日期, schedule: schedule
@@ -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 | 2 | 1 | 5 | 3 | 4 | 6;
314
+ weekNum: 0 | 1 | 2 | 5 | 4 | 3 | 6;
315
315
  }[]>;
316
316
  submitTimeSlot(timeSlots: TimeSliceItem): void;
317
317
  private getScheduleDataByIds;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.2.150",
4
+ "version": "2.2.151",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",