@pisell/pisellos 0.10.64 → 0.10.66

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.
Files changed (42) hide show
  1. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  2. package/dist/modules/OpenData/contactInfo.d.ts +20 -0
  3. package/dist/modules/OpenData/contactInfo.js +70 -0
  4. package/dist/modules/OpenData/index.d.ts +1 -0
  5. package/dist/modules/OpenData/index.js +1 -0
  6. package/dist/modules/OpenData/types.d.ts +9 -0
  7. package/dist/modules/Order/index.d.ts +6 -1
  8. package/dist/modules/Order/index.js +564 -475
  9. package/dist/modules/Order/types.d.ts +2 -0
  10. package/dist/modules/Order/utils/discountProductLineIdentity.js +2 -2
  11. package/dist/modules/Order/utils/productVoucherGroups.d.ts +15 -0
  12. package/dist/modules/Order/utils/productVoucherGroups.js +115 -0
  13. package/dist/modules/Product/index.d.ts +1 -1
  14. package/dist/modules/Rules/index.d.ts +2 -0
  15. package/dist/modules/Rules/index.js +29 -21
  16. package/dist/solution/BaseSales/index.d.ts +15 -1
  17. package/dist/solution/BaseSales/index.js +1018 -884
  18. package/dist/solution/BookingByStep/index.d.ts +2 -2
  19. package/dist/solution/BookingTicket/index.d.ts +4 -1
  20. package/dist/solution/BookingTicket/index.js +485 -433
  21. package/dist/solution/BookingTicket/types.d.ts +2 -0
  22. package/lib/modules/OpenData/contactInfo.d.ts +20 -0
  23. package/lib/modules/OpenData/contactInfo.js +56 -0
  24. package/lib/modules/OpenData/index.d.ts +1 -0
  25. package/lib/modules/OpenData/index.js +12 -0
  26. package/lib/modules/OpenData/types.d.ts +9 -0
  27. package/lib/modules/Order/index.d.ts +6 -1
  28. package/lib/modules/Order/index.js +49 -6
  29. package/lib/modules/Order/types.d.ts +2 -0
  30. package/lib/modules/Order/utils/discountProductLineIdentity.js +1 -1
  31. package/lib/modules/Order/utils/productVoucherGroups.d.ts +15 -0
  32. package/lib/modules/Order/utils/productVoucherGroups.js +64 -0
  33. package/lib/modules/Product/index.d.ts +1 -1
  34. package/lib/modules/Rules/index.d.ts +2 -0
  35. package/lib/modules/Rules/index.js +6 -0
  36. package/lib/solution/BaseSales/index.d.ts +15 -1
  37. package/lib/solution/BaseSales/index.js +40 -2
  38. package/lib/solution/BookingByStep/index.d.ts +2 -2
  39. package/lib/solution/BookingTicket/index.d.ts +4 -1
  40. package/lib/solution/BookingTicket/index.js +27 -2
  41. package/lib/solution/BookingTicket/types.d.ts +2 -0
  42. package/package.json +1 -1
@@ -58,6 +58,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
58
58
  private getIdGeneratorPlugin;
59
59
  protected loadOpenDataConfig(): Promise<OpenDataConfig | null>;
60
60
  getOpenData(): Promise<OpenDataConfig | null>;
61
+ protected loadContactInfoOpenData(): Promise<OpenDataConfig | null>;
61
62
  getInvoiceLayoutConfig(): Promise<InvoiceLayoutConfig>;
62
63
  getInvoiceTemplateSettings(): Promise<InvoiceTemplateSettings>;
63
64
  protected isInvoiceOpenDataCacheCurrent(): boolean;
@@ -286,7 +287,9 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
286
287
  /**
287
288
  * 清空下单客户(协议字段 + snapshot)。
288
289
  */
289
- clearOrderCustomer(): void;
290
+ clearOrderCustomer(options?: {
291
+ preserveContactInfo?: boolean;
292
+ }): void;
290
293
  /**
291
294
  * 重置 tempOrder,并同步清空下单客户运行态。
292
295
  *
@@ -39,6 +39,8 @@ var _orderLineDisplay = require("../../modules/BookingContext/utils/orderLineDis
39
39
  var _bookingStatus = require("./utils/bookingStatus");
40
40
  var _resolveBestAddTimePlan = require("./utils/resolveBestAddTimePlan");
41
41
  var _utils = require("../../modules/Order/utils");
42
+ var _contactInfo = require("../../modules/OpenData/contactInfo");
43
+ var _lodashEs = require("lodash-es");
42
44
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
43
45
  const OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow', 'documents'];
44
46
  const OPEN_DATA_CACHE_TTL = 5 * 60 * 1000;
@@ -289,6 +291,9 @@ class BookingTicketImpl extends _BaseSales.BaseSalesImpl {
289
291
  async getOpenData() {
290
292
  return this.loadOpenDataConfig();
291
293
  }
294
+ async loadContactInfoOpenData() {
295
+ return this.store.openData ? this.getOpenData() : super.loadContactInfoOpenData();
296
+ }
292
297
  async getInvoiceLayoutConfig() {
293
298
  const openData = await this.loadOpenDataConfig();
294
299
  if (!openData) return (0, _OpenData.getDefaultInvoiceLayoutConfig)();
@@ -1009,7 +1014,9 @@ class BookingTicketImpl extends _BaseSales.BaseSalesImpl {
1009
1014
  */
1010
1015
  setOrderCustomer(customer, options) {
1011
1016
  if (!customer) {
1012
- this.clearOrderCustomer();
1017
+ this.clearOrderCustomer({
1018
+ preserveContactInfo: options?.source === 'detailHydrate'
1019
+ });
1013
1020
  return;
1014
1021
  }
1015
1022
  const previousCustomerId = this.store.order.getOrderCustomer()?.customer_id;
@@ -1020,6 +1027,9 @@ class BookingTicketImpl extends _BaseSales.BaseSalesImpl {
1020
1027
  this.discountConfigCacheKey = null;
1021
1028
  this.hasManualDiscountSelection = false;
1022
1029
  }
1030
+ if (!customerUnchanged && options?.source !== 'detailHydrate') {
1031
+ this.store.order.updateTempOrderContactsInfo((0, _lodashEs.cloneDeep)((0, _contactInfo.extractCustomerContactInfo)(customer)));
1032
+ }
1023
1033
  this.store.order.setOrderCustomer(patch, customer);
1024
1034
  const snapshotAfterOrderSet = this.store.order.getOrderCustomerSnapshot();
1025
1035
  if (customerUnchanged) {
@@ -1071,7 +1081,8 @@ class BookingTicketImpl extends _BaseSales.BaseSalesImpl {
1071
1081
  /**
1072
1082
  * 清空下单客户(协议字段 + snapshot)。
1073
1083
  */
1074
- clearOrderCustomer() {
1084
+ clearOrderCustomer(options) {
1085
+ if (!options?.preserveContactInfo) this.store.order.updateTempOrderContactsInfo(null);
1075
1086
  this.store.order.clearOrderCustomer();
1076
1087
  this.discountConfigCacheKey = null;
1077
1088
  this.hasManualDiscountSelection = false;
@@ -1699,6 +1710,20 @@ class BookingTicketImpl extends _BaseSales.BaseSalesImpl {
1699
1710
  return bridge.openBookingEdit(payload);
1700
1711
  } : undefined
1701
1712
  } : undefined;
1713
+ if (guardedBridge?.scanScope === 'product-voucher') {
1714
+ if (!guardedBridge.applyPromotionCode) return {
1715
+ status: 'failed',
1716
+ reason: 'no_bridge'
1717
+ };
1718
+ const promotion = await guardedBridge.applyPromotionCode(trimmed);
1719
+ return promotion.isAccepted ?? promotion.isAvailable ? {
1720
+ status: 'success',
1721
+ kind: 'promotion'
1722
+ } : {
1723
+ status: 'failed',
1724
+ reason: 'not_found'
1725
+ };
1726
+ }
1702
1727
  const localSearch = v => this.store.products.findProductsByCodeOrBarcode(v);
1703
1728
  const scanCallback = (0, _handleScan.handleGlobalScan)(this.request, localSearch, this.getSubmitOrderSalesChannel());
1704
1729
  const raw = await scanCallback({
@@ -208,6 +208,8 @@ export interface AddAddTimeProductsToBookingInput {
208
208
  }
209
209
  /** 扫码宿主桥接:SalesSdk 在 pubsub 订阅回调里注入,OS 需要 UI 时直接调用 */
210
210
  export interface GlobalScanHostBridge {
211
+ /** Restrict redemption scans before customer/product side effects. */
212
+ scanScope?: 'all' | 'product-voucher';
211
213
  openProductDetail?: (payload: Record<string, any>) => Promise<any | null>;
212
214
  openBookingEdit?: (payload: Record<string, any>) => Promise<any | null>;
213
215
  confirmDetail?: (input: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "0.10.64",
4
+ "version": "0.10.66",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",