@pisell/pisellos 2.3.40 → 2.3.42

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 (230) hide show
  1. package/dist/core/index.d.ts +2 -0
  2. package/dist/core/index.js +7 -0
  3. package/dist/model/strategy/adapter/promotion/adapter.d.ts +4 -0
  4. package/dist/model/strategy/adapter/promotion/adapter.js +23 -0
  5. package/dist/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
  6. package/dist/model/strategy/adapter/promotion/evaluator.js +279 -6
  7. package/dist/model/strategy/adapter/promotion/examples.d.ts +86 -0
  8. package/dist/model/strategy/adapter/promotion/examples.js +99 -0
  9. package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
  10. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  11. package/dist/model/strategy/adapter/promotion/type.d.ts +90 -2
  12. package/dist/model/strategy/adapter/promotion/type.js +45 -0
  13. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +5 -3
  14. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +6 -3
  15. package/dist/modules/Discount/index.d.ts +0 -1
  16. package/dist/modules/Discount/index.js +11 -40
  17. package/dist/modules/Discount/types.d.ts +0 -1
  18. package/dist/modules/OpenData/index.d.ts +2 -0
  19. package/dist/modules/OpenData/index.js +10 -2
  20. package/dist/modules/Order/index.d.ts +29 -12
  21. package/dist/modules/Order/index.js +751 -510
  22. package/dist/modules/Order/payment-utils.d.ts +26 -0
  23. package/dist/modules/Order/payment-utils.js +225 -0
  24. package/dist/modules/Order/types.d.ts +33 -10
  25. package/dist/modules/Order/utils/orderCollectionIdentity.js +7 -2
  26. package/dist/modules/Order/utils.d.ts +0 -10
  27. package/dist/modules/Order/utils.js +13 -41
  28. package/dist/modules/Payment/index.d.ts +2 -0
  29. package/dist/modules/Payment/index.js +79 -50
  30. package/dist/modules/Payment/types.d.ts +99 -28
  31. package/dist/modules/Payment/types.js +20 -3
  32. package/dist/modules/Payment/walletpass.d.ts +25 -1
  33. package/dist/modules/Payment/walletpass.js +707 -157
  34. package/dist/modules/Product/types.d.ts +0 -1
  35. package/dist/modules/ProductList/index.js +14 -33
  36. package/dist/modules/Quotation/index.d.ts +1 -1
  37. package/dist/modules/Quotation/index.js +2 -2
  38. package/dist/modules/Rules/index.d.ts +1 -0
  39. package/dist/modules/Rules/index.js +89 -96
  40. package/dist/modules/SalesSummary/index.js +13 -12
  41. package/dist/modules/ScanOrderLogger/index.d.ts +0 -2
  42. package/dist/modules/ScanOrderLogger/index.js +2 -15
  43. package/dist/modules/ScanOrderLogger/providers/feishu.js +27 -45
  44. package/dist/modules/ScanOrderLogger/types.d.ts +0 -1
  45. package/dist/modules/Schedule/index.d.ts +1 -3
  46. package/dist/modules/Schedule/index.js +16 -21
  47. package/dist/modules/Summary/utils.js +13 -38
  48. package/dist/modules/index.d.ts +0 -2
  49. package/dist/modules/index.js +1 -3
  50. package/dist/plugins/window.d.ts +0 -1
  51. package/dist/server/index.d.ts +16 -14
  52. package/dist/server/index.js +1925 -1143
  53. package/dist/server/modules/order/index.d.ts +54 -4
  54. package/dist/server/modules/order/index.js +1600 -700
  55. package/dist/server/modules/order/types.d.ts +11 -3
  56. package/dist/server/modules/order/types.js +1 -1
  57. package/dist/solution/BaseSales/index.d.ts +109 -20
  58. package/dist/solution/BaseSales/index.js +1800 -480
  59. package/dist/solution/BaseSales/types.d.ts +52 -0
  60. package/dist/solution/BaseSales/types.js +2 -1
  61. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
  62. package/dist/solution/BaseSales/utils/cartPromotion.js +90 -31
  63. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +6 -1
  64. package/dist/solution/BookingByStep/index.d.ts +2 -17
  65. package/dist/solution/BookingByStep/index.js +215 -294
  66. package/dist/solution/BookingByStep/types.d.ts +1 -2
  67. package/dist/solution/BookingByStep/types.js +1 -3
  68. package/dist/solution/BookingByStep/utils/capacity.js +1 -17
  69. package/dist/solution/BookingByStep/utils/timeslots.d.ts +1 -3
  70. package/dist/solution/BookingByStep/utils/timeslots.js +12 -19
  71. package/dist/solution/BookingTicket/index.d.ts +8 -4
  72. package/dist/solution/BookingTicket/index.js +134 -51
  73. package/dist/solution/BookingTicket/utils/addProductDecision.js +6 -0
  74. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +8 -0
  75. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +172 -82
  76. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
  77. package/dist/solution/BookingTicket/utils/scan/handleScan.js +2 -10
  78. package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
  79. package/dist/solution/BookingTicket/utils/weighingProductSku.js +45 -0
  80. package/dist/solution/Sales/index.d.ts +1 -0
  81. package/dist/solution/Sales/index.js +10 -2
  82. package/dist/solution/ScanOrder/index.d.ts +14 -26
  83. package/dist/solution/ScanOrder/index.js +756 -1148
  84. package/dist/solution/ScanOrder/types.d.ts +1 -21
  85. package/dist/solution/ScanOrder/utils.d.ts +0 -8
  86. package/dist/solution/ScanOrder/utils.js +25 -66
  87. package/dist/solution/ShopDiscount/index.d.ts +0 -1
  88. package/dist/solution/ShopDiscount/index.js +87 -125
  89. package/dist/solution/VenueBooking/index.d.ts +11 -39
  90. package/dist/solution/VenueBooking/index.js +860 -1176
  91. package/dist/solution/VenueBooking/types.d.ts +0 -3
  92. package/dist/solution/VenueBooking/utils/resource.js +0 -1
  93. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  94. package/dist/solution/VenueBooking/utils/slotMerge.js +5 -10
  95. package/dist/solution/index.d.ts +0 -1
  96. package/dist/solution/index.js +1 -2
  97. package/dist/types/index.d.ts +1 -1
  98. package/dist/utils/payment-number.d.ts +9 -0
  99. package/dist/utils/payment-number.js +69 -0
  100. package/lib/core/index.d.ts +2 -0
  101. package/lib/core/index.js +4 -0
  102. package/lib/model/strategy/adapter/promotion/adapter.d.ts +4 -0
  103. package/lib/model/strategy/adapter/promotion/adapter.js +20 -0
  104. package/lib/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
  105. package/lib/model/strategy/adapter/promotion/evaluator.js +235 -0
  106. package/lib/model/strategy/adapter/promotion/examples.d.ts +86 -0
  107. package/lib/model/strategy/adapter/promotion/examples.js +91 -0
  108. package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
  109. package/lib/model/strategy/adapter/promotion/index.js +2 -0
  110. package/lib/model/strategy/adapter/promotion/type.d.ts +90 -2
  111. package/lib/model/strategy/adapter/promotion/type.js +2 -0
  112. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +2 -1
  113. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +2 -1
  114. package/lib/modules/Discount/index.d.ts +0 -1
  115. package/lib/modules/Discount/index.js +0 -9
  116. package/lib/modules/Discount/types.d.ts +0 -1
  117. package/lib/modules/OpenData/index.d.ts +2 -0
  118. package/lib/modules/OpenData/index.js +6 -1
  119. package/lib/modules/Order/index.d.ts +29 -12
  120. package/lib/modules/Order/index.js +197 -87
  121. package/lib/modules/Order/payment-utils.d.ts +26 -0
  122. package/lib/modules/Order/payment-utils.js +224 -0
  123. package/lib/modules/Order/types.d.ts +33 -10
  124. package/lib/modules/Order/utils/orderCollectionIdentity.js +3 -0
  125. package/lib/modules/Order/utils.d.ts +0 -10
  126. package/lib/modules/Order/utils.js +16 -40
  127. package/lib/modules/Payment/index.d.ts +2 -0
  128. package/lib/modules/Payment/index.js +34 -13
  129. package/lib/modules/Payment/types.d.ts +99 -28
  130. package/lib/modules/Payment/types.js +4 -3
  131. package/lib/modules/Payment/walletpass.d.ts +25 -1
  132. package/lib/modules/Payment/walletpass.js +470 -21
  133. package/lib/modules/Product/types.d.ts +0 -1
  134. package/lib/modules/ProductList/index.js +31 -40
  135. package/lib/modules/Quotation/index.d.ts +1 -1
  136. package/lib/modules/Quotation/index.js +2 -2
  137. package/lib/modules/Rules/index.d.ts +1 -0
  138. package/lib/modules/Rules/index.js +47 -40
  139. package/lib/modules/SalesSummary/index.js +7 -6
  140. package/lib/modules/ScanOrderLogger/index.d.ts +0 -2
  141. package/lib/modules/ScanOrderLogger/index.js +1 -13
  142. package/lib/modules/ScanOrderLogger/providers/feishu.js +6 -15
  143. package/lib/modules/ScanOrderLogger/types.d.ts +0 -1
  144. package/lib/modules/Schedule/index.d.ts +1 -3
  145. package/lib/modules/Schedule/index.js +8 -10
  146. package/lib/modules/Summary/utils.js +1 -21
  147. package/lib/modules/index.d.ts +0 -2
  148. package/lib/modules/index.js +1 -5
  149. package/lib/plugins/window.d.ts +0 -1
  150. package/lib/server/index.d.ts +16 -14
  151. package/lib/server/index.js +675 -83
  152. package/lib/server/modules/order/index.d.ts +54 -4
  153. package/lib/server/modules/order/index.js +679 -66
  154. package/lib/server/modules/order/types.d.ts +11 -3
  155. package/lib/solution/BaseSales/index.d.ts +109 -20
  156. package/lib/solution/BaseSales/index.js +883 -70
  157. package/lib/solution/BaseSales/types.d.ts +52 -0
  158. package/lib/solution/BaseSales/types.js +2 -1
  159. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
  160. package/lib/solution/BaseSales/utils/cartPromotion.js +63 -12
  161. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +6 -1
  162. package/lib/solution/BookingByStep/index.d.ts +2 -17
  163. package/lib/solution/BookingByStep/index.js +18 -60
  164. package/lib/solution/BookingByStep/types.d.ts +1 -2
  165. package/lib/solution/BookingByStep/types.js +0 -5
  166. package/lib/solution/BookingByStep/utils/capacity.js +1 -20
  167. package/lib/solution/BookingByStep/utils/timeslots.d.ts +1 -3
  168. package/lib/solution/BookingByStep/utils/timeslots.js +11 -19
  169. package/lib/solution/BookingTicket/index.d.ts +8 -4
  170. package/lib/solution/BookingTicket/index.js +64 -19
  171. package/lib/solution/BookingTicket/utils/addProductDecision.js +4 -0
  172. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +8 -0
  173. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +36 -4
  174. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
  175. package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -2
  176. package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
  177. package/lib/solution/BookingTicket/utils/weighingProductSku.js +63 -0
  178. package/lib/solution/Sales/index.d.ts +1 -0
  179. package/lib/solution/Sales/index.js +5 -3
  180. package/lib/solution/ScanOrder/index.d.ts +14 -26
  181. package/lib/solution/ScanOrder/index.js +190 -449
  182. package/lib/solution/ScanOrder/types.d.ts +1 -21
  183. package/lib/solution/ScanOrder/utils.d.ts +0 -8
  184. package/lib/solution/ScanOrder/utils.js +0 -31
  185. package/lib/solution/ShopDiscount/index.d.ts +0 -1
  186. package/lib/solution/ShopDiscount/index.js +0 -14
  187. package/lib/solution/VenueBooking/index.d.ts +11 -39
  188. package/lib/solution/VenueBooking/index.js +123 -328
  189. package/lib/solution/VenueBooking/types.d.ts +0 -3
  190. package/lib/solution/VenueBooking/utils/resource.js +0 -1
  191. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  192. package/lib/solution/VenueBooking/utils/slotMerge.js +4 -6
  193. package/lib/solution/index.d.ts +0 -1
  194. package/lib/solution/index.js +1 -3
  195. package/lib/types/index.d.ts +1 -1
  196. package/lib/utils/payment-number.d.ts +9 -0
  197. package/lib/utils/payment-number.js +64 -0
  198. package/package.json +1 -1
  199. package/dist/modules/Holder/index.d.ts +0 -48
  200. package/dist/modules/Holder/index.js +0 -640
  201. package/dist/modules/Holder/types.d.ts +0 -123
  202. package/dist/modules/Holder/types.js +0 -1
  203. package/dist/modules/Holder/utils.d.ts +0 -13
  204. package/dist/modules/Holder/utils.js +0 -34
  205. package/dist/modules/ResourcePlanner/index.d.ts +0 -24
  206. package/dist/modules/ResourcePlanner/index.js +0 -181
  207. package/dist/modules/ResourcePlanner/planner.d.ts +0 -14
  208. package/dist/modules/ResourcePlanner/planner.js +0 -1069
  209. package/dist/modules/ResourcePlanner/types.d.ts +0 -227
  210. package/dist/modules/ResourcePlanner/types.js +0 -1
  211. package/dist/solution/UnifiedBookingSales/index.d.ts +0 -183
  212. package/dist/solution/UnifiedBookingSales/index.js +0 -1871
  213. package/dist/solution/UnifiedBookingSales/types.d.ts +0 -143
  214. package/dist/solution/UnifiedBookingSales/types.js +0 -11
  215. package/lib/modules/Holder/index.d.ts +0 -48
  216. package/lib/modules/Holder/index.js +0 -402
  217. package/lib/modules/Holder/types.d.ts +0 -123
  218. package/lib/modules/Holder/types.js +0 -17
  219. package/lib/modules/Holder/utils.d.ts +0 -13
  220. package/lib/modules/Holder/utils.js +0 -71
  221. package/lib/modules/ResourcePlanner/index.d.ts +0 -24
  222. package/lib/modules/ResourcePlanner/index.js +0 -148
  223. package/lib/modules/ResourcePlanner/planner.d.ts +0 -14
  224. package/lib/modules/ResourcePlanner/planner.js +0 -933
  225. package/lib/modules/ResourcePlanner/types.d.ts +0 -227
  226. package/lib/modules/ResourcePlanner/types.js +0 -17
  227. package/lib/solution/UnifiedBookingSales/index.d.ts +0 -183
  228. package/lib/solution/UnifiedBookingSales/index.js +0 -1076
  229. package/lib/solution/UnifiedBookingSales/types.d.ts +0 -143
  230. package/lib/solution/UnifiedBookingSales/types.js +0 -33
@@ -1,6 +1,5 @@
1
1
  import { OrderModule, ProductList, SalesSummaryModule, ScanOrderLogInput, ScanOrderLoggerModule, ScanOrderLoggerProviderConfig, ScanOrderLoggerProviderType, DateModule, ScheduleModule, QuotationModule, OpenDataModule } from '../../modules';
2
2
  import type { QuantityCheckResult, QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
3
- import { HolderModule } from '../../modules/Holder';
4
3
  export type { ScanOrderOrderProductIdentity, ScanOrderOrderProduct, ScanOrderSubmitProduct, ScanOrderSummary, ScanOrderTempOrder, ScanOrderSubmitPayload, } from '../ScanOrder/types';
5
4
  export declare enum VenueBookingHooks {
6
5
  onInited = "venueBooking:onInited",
@@ -97,7 +96,6 @@ export interface VenueResourceRawData {
97
96
  export interface ResourceProductMapping {
98
97
  productId: number;
99
98
  productTitle: string;
100
- formName?: string;
101
99
  resourceName: string;
102
100
  formId: number | string;
103
101
  price: string;
@@ -146,7 +144,6 @@ export interface VenueBookingState {
146
144
  passed: boolean | null;
147
145
  failures: QuantityCheckResult[];
148
146
  };
149
- holder?: HolderModule;
150
147
  }
151
148
  export interface VenueBookingLoggerRuntimeConfig {
152
149
  provider?: ScanOrderLoggerProviderType;
@@ -69,7 +69,6 @@ function buildResourceProductMap(products) {
69
69
  const mapping = {
70
70
  productId: product.id,
71
71
  productTitle: product.title,
72
- formName: resource.title,
73
72
  resourceName: resource.title,
74
73
  formId: resource.id,
75
74
  price: product.price || "0.00",
@@ -12,6 +12,10 @@ export declare function buildPriceBreakdown(params: {
12
12
  }) => number;
13
13
  };
14
14
  }): PriceBreakdownEntry[];
15
+ export declare function buildVenueResourceMetadata(params: {
16
+ mapping: ResourceProductMapping;
17
+ rawResource: VenueResourceRawData | undefined;
18
+ }): Record<string, any>;
15
19
  export interface BuildVenueBookingParams {
16
20
  group: MergedSlotGroup;
17
21
  resourceId: number | string;
@@ -25,10 +29,6 @@ export interface BuildVenueBookingParams {
25
29
  */
26
30
  childResources?: VenueResourceRawData[];
27
31
  }
28
- export declare function buildVenueResourceMetadata(params: {
29
- mapping: ResourceProductMapping;
30
- rawResource: VenueResourceRawData | undefined;
31
- }): Record<string, any>;
32
32
  export declare function buildVenueBookingEntry(params: BuildVenueBookingParams): Record<string, any>;
33
33
  /**
34
34
  * 从一条已合并的订单商品还原出独立的时段列表。
@@ -109,12 +109,10 @@ function buildPriceBreakdown(params) {
109
109
  }
110
110
  function buildVenueResourceMetadata(params) {
111
111
  const { mapping, rawResource } = params;
112
- const combined = rawResource == null ? void 0 : rawResource.combined_resource;
113
- const isCombined = !!(combined && combined.status === 1 && Array.isArray(combined.resource_ids));
114
112
  return {
115
- form_name: mapping.formName ?? mapping.resourceName,
116
- resource_name: (rawResource == null ? void 0 : rawResource.main_field) ?? mapping.resourceName,
117
- combined_resource: isCombined ? combined : null
113
+ form_name: (rawResource == null ? void 0 : rawResource.form_name) ?? "",
114
+ resource_name: (rawResource == null ? void 0 : rawResource.main_field) ?? mapping.resourceName ?? "",
115
+ combined_resource: (rawResource == null ? void 0 : rawResource.combined_resource) ?? null
118
116
  };
119
117
  }
120
118
  function buildVenueBookingEntry(params) {
@@ -130,7 +128,7 @@ function buildVenueBookingEntry(params) {
130
128
  form_id: (rawResource == null ? void 0 : rawResource.form_id) ?? mapping.formId,
131
129
  relation_id: resourceId,
132
130
  capacity: 1,
133
- metadata: buildVenueResourceMetadata({ mapping, rawResource })
131
+ metadata: {}
134
132
  };
135
133
  if (childResources && childResources.length) {
136
134
  resourceEntry.children = childResources.map((child) => ({
@@ -8,4 +8,3 @@ export * from './Sales';
8
8
  export * from './ScanOrder';
9
9
  export * from './BaseSales';
10
10
  export * from './VenueBooking';
11
- export * from './UnifiedBookingSales';
@@ -26,7 +26,6 @@ __reExport(solution_exports, require("./Sales"), module.exports);
26
26
  __reExport(solution_exports, require("./ScanOrder"), module.exports);
27
27
  __reExport(solution_exports, require("./BaseSales"), module.exports);
28
28
  __reExport(solution_exports, require("./VenueBooking"), module.exports);
29
- __reExport(solution_exports, require("./UnifiedBookingSales"), module.exports);
30
29
  // Annotate the CommonJS export names for ESM import in node:
31
30
  0 && (module.exports = {
32
31
  ...require("./BuyTickets"),
@@ -38,6 +37,5 @@ __reExport(solution_exports, require("./UnifiedBookingSales"), module.exports);
38
37
  ...require("./Sales"),
39
38
  ...require("./ScanOrder"),
40
39
  ...require("./BaseSales"),
41
- ...require("./VenueBooking"),
42
- ...require("./UnifiedBookingSales")
40
+ ...require("./VenueBooking")
43
41
  });
@@ -6,7 +6,6 @@ export interface Plugin {
6
6
  version: string;
7
7
  initialize: () => Promise<void> | void;
8
8
  destroy?: () => Promise<void> | void;
9
- getLocalStorage?: (key: string) => string | null;
10
9
  }
11
10
  export interface PluginOptions {
12
11
  dependencies?: string[];
@@ -48,6 +47,7 @@ export interface PisellCore {
48
47
  getModule: <T extends Module>(name: string) => T | null;
49
48
  getModuleExports: <T = any>(name: string) => T | null;
50
49
  hasModule: (name: string) => boolean;
50
+ getModuleNames: () => string[];
51
51
  effects: {
52
52
  on: (event: string, callback: (payload: any) => void) => () => void;
53
53
  once: (event: string, callback: (payload: any) => void) => () => void;
@@ -0,0 +1,9 @@
1
+ export type PaymentNumberAppDataGetter = (key: string) => unknown;
2
+ /**
3
+ * Resolve the synchronous fallback without caching runtime device data.
4
+ */
5
+ export declare function resolvePaymentNumberDevicePrefixFromDeviceId(getAppData: PaymentNumberAppDataGetter): string;
6
+ /**
7
+ * Resolve the latest device segment when a new payment number is generated.
8
+ */
9
+ export declare function resolvePaymentNumberDevicePrefix(getAppData: PaymentNumberAppDataGetter): Promise<string>;
@@ -0,0 +1,64 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/utils/payment-number.ts
20
+ var payment_number_exports = {};
21
+ __export(payment_number_exports, {
22
+ resolvePaymentNumberDevicePrefix: () => resolvePaymentNumberDevicePrefix,
23
+ resolvePaymentNumberDevicePrefixFromDeviceId: () => resolvePaymentNumberDevicePrefixFromDeviceId
24
+ });
25
+ module.exports = __toCommonJS(payment_number_exports);
26
+ function normalizeNonEmptyString(value) {
27
+ if (value === void 0 || value === null)
28
+ return null;
29
+ if (typeof value !== "string" && typeof value !== "number")
30
+ return null;
31
+ if (typeof value === "number" && !Number.isFinite(value))
32
+ return null;
33
+ const normalized = String(value).trim();
34
+ return normalized || null;
35
+ }
36
+ function resolvePaymentNumberDevicePrefixFromDeviceId(getAppData) {
37
+ try {
38
+ const deviceId = normalizeNonEmptyString(getAppData("device_id"));
39
+ if (deviceId && deviceId !== "0")
40
+ return deviceId.slice(-2);
41
+ } catch {
42
+ }
43
+ return "LOCAL";
44
+ }
45
+ async function resolvePaymentNumberDevicePrefix(getAppData) {
46
+ try {
47
+ const getAsyncIotDeviceInfo = getAppData("async_iot_device_info");
48
+ if (typeof getAsyncIotDeviceInfo === "function") {
49
+ const info = await getAsyncIotDeviceInfo();
50
+ const shortNumber = normalizeNonEmptyString(
51
+ info == null ? void 0 : info.short_number
52
+ );
53
+ if (shortNumber && shortNumber !== "0")
54
+ return shortNumber;
55
+ }
56
+ } catch {
57
+ }
58
+ return resolvePaymentNumberDevicePrefixFromDeviceId(getAppData);
59
+ }
60
+ // Annotate the CommonJS export names for ESM import in node:
61
+ 0 && (module.exports = {
62
+ resolvePaymentNumberDevicePrefix,
63
+ resolvePaymentNumberDevicePrefixFromDeviceId
64
+ });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.3.40",
4
+ "version": "2.3.42",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -1,48 +0,0 @@
1
- import { Module, PisellCore, ModuleOptions } from '../../types';
2
- import { BaseModule } from '../BaseModule';
3
- import { IFormInfo, IFormRecord, IFormItemData, IFetchFormInfoParams, IFetchFormRecordsParams, IAddFormRecordParams, IAppendFormRecordParams, IEnsureFormDataParams, IEnsureFormByProductParams, IRefreshAllFormRecordsParams, HolderModuleAPI, HolderFormMap } from './types';
4
- export * from './types';
5
- export * from './utils';
6
- export declare class HolderModule extends BaseModule implements Module, HolderModuleAPI {
7
- protected defaultName: string;
8
- protected defaultVersion: string;
9
- private store;
10
- private request;
11
- private cacheId;
12
- private openCache;
13
- private fatherModule;
14
- private isLoading;
15
- private error;
16
- /** 已加载过表单数据的 form_id 缓存标记 */
17
- private loadedFormIds;
18
- private window;
19
- constructor(name?: string, version?: string);
20
- initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
21
- /** 统一提交 formMap,仅此处触发 store changed */
22
- private commitFormMap;
23
- /** 通知 UI 刷新(数据未变但需要 re-read 的场景) */
24
- private notifyFormMapChanged;
25
- getHolderFormMap(): HolderFormMap;
26
- getHolderFormData(formId: number | string): IFormItemData | undefined;
27
- setFormData(formId: number | string, data: Partial<IFormItemData>): void;
28
- private ensureFormItem;
29
- private hasFormData;
30
- private patchFormMap;
31
- fetchFormInfo(params: IFetchFormInfoParams): Promise<IFormInfo | IFormInfo[]>;
32
- fetchRecords(params: IFetchFormRecordsParams): Promise<any>;
33
- ensureFormData(params: IEnsureFormDataParams): Promise<IFormItemData>;
34
- ensureFormByProduct(params: IEnsureFormByProductParams): Promise<IFormItemData | null>;
35
- addFormRecord(params: IAddFormRecordParams): Promise<any>;
36
- /**
37
- * UI 层自行请求添加接口后,将返回记录合并到 holderMap 对应 form_id 的 records 中
38
- */
39
- appendFormRecord(params: IAppendFormRecordParams): IFormRecord;
40
- removeFormRecord(formId: number | string, formRecordId: number): void;
41
- clearFormData(formId?: number | string): void;
42
- /**
43
- * 登录后按当前 holderMap 批量刷新所有表单的 records。
44
- * 遍历 holderMap,从 form.form 中读取 form_id、shop_id,结合 customer_id 重新拉取记录。
45
- */
46
- refreshAllFormRecords(params?: IRefreshAllFormRecordsParams): Promise<HolderFormMap>;
47
- storeChange(path?: string): void;
48
- }