@pisell/pisellos 2.2.291 → 2.2.293

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 (174) hide show
  1. package/dist/core/index.d.ts +7 -0
  2. package/dist/core/index.js +108 -65
  3. package/dist/model/strategy/adapter/itemRule/adapter.d.ts +4 -1
  4. package/dist/model/strategy/adapter/itemRule/adapter.js +135 -35
  5. package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +8 -1
  6. package/dist/model/strategy/adapter/itemRule/evaluator.js +25 -1
  7. package/dist/model/strategy/adapter/itemRule/type.d.ts +44 -0
  8. package/dist/model/strategy/adapter/itemRule/type.js +19 -1
  9. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  10. package/dist/modules/BookingContext/index.d.ts +3 -0
  11. package/dist/modules/BookingContext/index.js +42 -13
  12. package/dist/modules/BookingContext/types.d.ts +4 -4
  13. package/dist/modules/BookingContext/types.js +3 -3
  14. package/dist/modules/OpenData/types.d.ts +1 -0
  15. package/dist/modules/Order/index.d.ts +18 -3
  16. package/dist/modules/Order/index.js +885 -485
  17. package/dist/modules/Order/salesNotes.d.ts +31 -0
  18. package/dist/modules/Order/salesNotes.js +492 -0
  19. package/dist/modules/Order/types.d.ts +93 -5
  20. package/dist/modules/Order/types.js +5 -0
  21. package/dist/modules/Order/utils.d.ts +12 -0
  22. package/dist/modules/Order/utils.js +96 -31
  23. package/dist/modules/Product/types.d.ts +2 -0
  24. package/dist/modules/ProductList/clientDataVariants.d.ts +50 -0
  25. package/dist/modules/ProductList/clientDataVariants.js +216 -0
  26. package/dist/modules/ProductList/index.d.ts +18 -3
  27. package/dist/modules/ProductList/index.js +220 -38
  28. package/dist/modules/ProductList/types.d.ts +10 -0
  29. package/dist/modules/Quotation/index.d.ts +22 -0
  30. package/dist/modules/Quotation/index.js +293 -28
  31. package/dist/modules/ResourcePlanner/index.d.ts +0 -22
  32. package/dist/modules/ResourcePlanner/index.js +1 -180
  33. package/dist/modules/ResourcePlanner/localClock.d.ts +33 -0
  34. package/dist/modules/ResourcePlanner/localClock.js +183 -0
  35. package/dist/modules/ResourcePlanner/planner.d.ts +5 -14
  36. package/dist/modules/ResourcePlanner/planner.js +2111 -958
  37. package/dist/modules/ResourcePlanner/types.d.ts +359 -187
  38. package/dist/modules/ResourcePlanner/types.js +33 -1
  39. package/dist/plugins/request.d.ts +1 -0
  40. package/dist/server/index.d.ts +17 -2
  41. package/dist/server/index.js +1134 -932
  42. package/dist/server/modules/floor-plan/index.d.ts +4 -0
  43. package/dist/server/modules/floor-plan/index.js +240 -98
  44. package/dist/server/modules/menu/index.js +48 -23
  45. package/dist/server/modules/order/index.d.ts +17 -7
  46. package/dist/server/modules/order/index.js +419 -207
  47. package/dist/server/modules/products/index.d.ts +10 -4
  48. package/dist/server/modules/products/index.js +177 -84
  49. package/dist/server/modules/resource/index.js +21 -13
  50. package/dist/server/utils/product.d.ts +1 -1
  51. package/dist/server/utils/product.js +186 -22
  52. package/dist/server/utils/small-ticket.d.ts +9 -1
  53. package/dist/server/utils/small-ticket.js +131 -84
  54. package/dist/solution/BaseSales/index.d.ts +26 -3
  55. package/dist/solution/BaseSales/index.js +1384 -905
  56. package/dist/solution/BaseSales/types.d.ts +2 -0
  57. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +3 -0
  58. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +10 -3
  59. package/dist/solution/BaseSales/utils.js +6 -3
  60. package/dist/solution/BookingByStep/index.d.ts +4 -4
  61. package/dist/solution/BookingTicket/index.d.ts +1 -1
  62. package/dist/solution/BookingTicket/index.js +4 -2
  63. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +2 -1
  64. package/dist/solution/BookingTicket/utils/addProductDecision.js +6 -3
  65. package/dist/solution/BookingTicket/utils/orderCustomer.js +3 -2
  66. package/dist/solution/RegisterAndLogin/config.d.ts +9 -3
  67. package/dist/solution/RegisterAndLogin/config.js +95 -40
  68. package/dist/solution/RegisterAndLogin/index.js +4 -1
  69. package/dist/solution/ScanOrder/index.d.ts +1 -0
  70. package/dist/solution/ScanOrder/index.js +31 -27
  71. package/dist/solution/ScanOrder/types.d.ts +2 -0
  72. package/dist/solution/ScanOrder/utils.d.ts +1 -0
  73. package/dist/solution/ScanOrder/utils.js +8 -3
  74. package/dist/solution/UnifiedBookingSales/index.d.ts +128 -74
  75. package/dist/solution/UnifiedBookingSales/index.js +3877 -963
  76. package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +49 -0
  77. package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.js +430 -0
  78. package/dist/solution/UnifiedBookingSales/types.d.ts +161 -77
  79. package/dist/solution/UnifiedBookingSales/types.js +4 -9
  80. package/dist/solution/VenueBooking/index.d.ts +3 -0
  81. package/dist/solution/VenueBooking/index.js +549 -497
  82. package/dist/solution/VenueBooking/utils/dateSummary.d.ts +1 -0
  83. package/dist/solution/VenueBooking/utils/dateSummary.js +3 -1
  84. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +2 -0
  85. package/dist/solution/VenueBooking/utils/slotMerge.js +3 -1
  86. package/dist/utils/platform.d.ts +8 -0
  87. package/dist/utils/platform.js +15 -0
  88. package/lib/core/index.d.ts +7 -0
  89. package/lib/core/index.js +20 -2
  90. package/lib/model/strategy/adapter/itemRule/adapter.d.ts +4 -1
  91. package/lib/model/strategy/adapter/itemRule/adapter.js +73 -4
  92. package/lib/model/strategy/adapter/itemRule/evaluator.d.ts +8 -1
  93. package/lib/model/strategy/adapter/itemRule/evaluator.js +23 -1
  94. package/lib/model/strategy/adapter/itemRule/type.d.ts +44 -0
  95. package/lib/model/strategy/adapter/itemRule/type.js +19 -1
  96. package/lib/modules/BookingContext/index.d.ts +3 -0
  97. package/lib/modules/BookingContext/index.js +35 -8
  98. package/lib/modules/BookingContext/types.d.ts +4 -4
  99. package/lib/modules/BookingContext/types.js +3 -3
  100. package/lib/modules/OpenData/types.d.ts +1 -0
  101. package/lib/modules/Order/index.d.ts +18 -3
  102. package/lib/modules/Order/index.js +325 -28
  103. package/lib/modules/Order/salesNotes.d.ts +31 -0
  104. package/lib/modules/Order/salesNotes.js +382 -0
  105. package/lib/modules/Order/types.d.ts +93 -5
  106. package/lib/modules/Order/types.js +4 -0
  107. package/lib/modules/Order/utils.d.ts +12 -0
  108. package/lib/modules/Order/utils.js +85 -16
  109. package/lib/modules/Product/types.d.ts +2 -0
  110. package/lib/modules/ProductList/clientDataVariants.d.ts +50 -0
  111. package/lib/modules/ProductList/clientDataVariants.js +204 -0
  112. package/lib/modules/ProductList/index.d.ts +18 -3
  113. package/lib/modules/ProductList/index.js +137 -8
  114. package/lib/modules/ProductList/types.d.ts +10 -0
  115. package/lib/modules/Quotation/index.d.ts +22 -0
  116. package/lib/modules/Quotation/index.js +158 -11
  117. package/lib/modules/ResourcePlanner/index.d.ts +0 -22
  118. package/lib/modules/ResourcePlanner/index.js +9 -129
  119. package/lib/modules/ResourcePlanner/localClock.d.ts +33 -0
  120. package/lib/modules/ResourcePlanner/localClock.js +205 -0
  121. package/lib/modules/ResourcePlanner/planner.d.ts +5 -14
  122. package/lib/modules/ResourcePlanner/planner.js +1807 -783
  123. package/lib/modules/ResourcePlanner/types.d.ts +359 -187
  124. package/lib/modules/ResourcePlanner/types.js +13 -1
  125. package/lib/plugins/request.d.ts +1 -0
  126. package/lib/server/index.d.ts +17 -2
  127. package/lib/server/index.js +149 -21
  128. package/lib/server/modules/floor-plan/index.d.ts +4 -0
  129. package/lib/server/modules/floor-plan/index.js +60 -7
  130. package/lib/server/modules/menu/index.js +26 -4
  131. package/lib/server/modules/order/index.d.ts +17 -7
  132. package/lib/server/modules/order/index.js +194 -57
  133. package/lib/server/modules/products/index.d.ts +10 -4
  134. package/lib/server/modules/products/index.js +93 -23
  135. package/lib/server/modules/resource/index.js +12 -2
  136. package/lib/server/utils/product.d.ts +1 -1
  137. package/lib/server/utils/product.js +163 -3
  138. package/lib/server/utils/small-ticket.d.ts +9 -1
  139. package/lib/server/utils/small-ticket.js +123 -79
  140. package/lib/solution/BaseSales/index.d.ts +26 -3
  141. package/lib/solution/BaseSales/index.js +396 -70
  142. package/lib/solution/BaseSales/types.d.ts +2 -0
  143. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +3 -0
  144. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +9 -2
  145. package/lib/solution/BaseSales/utils.js +3 -0
  146. package/lib/solution/BookingByStep/index.d.ts +4 -4
  147. package/lib/solution/BookingTicket/index.d.ts +1 -1
  148. package/lib/solution/BookingTicket/index.js +2 -1
  149. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +2 -1
  150. package/lib/solution/BookingTicket/utils/addProductDecision.js +5 -2
  151. package/lib/solution/BookingTicket/utils/orderCustomer.js +2 -1
  152. package/lib/solution/RegisterAndLogin/config.d.ts +9 -3
  153. package/lib/solution/RegisterAndLogin/config.js +49 -8
  154. package/lib/solution/RegisterAndLogin/index.js +4 -1
  155. package/lib/solution/ScanOrder/index.d.ts +1 -0
  156. package/lib/solution/ScanOrder/index.js +5 -1
  157. package/lib/solution/ScanOrder/types.d.ts +2 -0
  158. package/lib/solution/ScanOrder/utils.d.ts +1 -0
  159. package/lib/solution/ScanOrder/utils.js +4 -0
  160. package/lib/solution/UnifiedBookingSales/index.d.ts +128 -74
  161. package/lib/solution/UnifiedBookingSales/index.js +2592 -424
  162. package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +49 -0
  163. package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.js +316 -0
  164. package/lib/solution/UnifiedBookingSales/types.d.ts +161 -77
  165. package/lib/solution/UnifiedBookingSales/types.js +4 -6
  166. package/lib/solution/VenueBooking/index.d.ts +3 -0
  167. package/lib/solution/VenueBooking/index.js +33 -9
  168. package/lib/solution/VenueBooking/utils/dateSummary.d.ts +1 -0
  169. package/lib/solution/VenueBooking/utils/dateSummary.js +3 -1
  170. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +2 -0
  171. package/lib/solution/VenueBooking/utils/slotMerge.js +3 -1
  172. package/lib/utils/platform.d.ts +8 -0
  173. package/lib/utils/platform.js +22 -0
  174. package/package.json +1 -1
@@ -112,6 +112,8 @@ export interface BaseSalesUpdateOrderProductQuantityParams extends BaseSalesOrde
112
112
  export interface BaseSalesOrderProduct extends BaseSalesOrderProductIdentity {
113
113
  order_detail_id: number | null;
114
114
  num: number;
115
+ /** Product 或当前 Variant 的生产编码 */
116
+ production_code?: string;
115
117
  product_sku: BaseSalesProductSku;
116
118
  /**
117
119
  * 券后 **行 composite 单价** = `metadata.main_product_selling_price`
@@ -3,6 +3,7 @@ import type { ProductData } from '../../../modules/Product/types';
3
3
  export interface BaseProductDetailOptionItem {
4
4
  option_group_item_id?: number | string;
5
5
  option_group_id?: number | string;
6
+ production_code?: string;
6
7
  num?: number | string;
7
8
  quantity?: number | string;
8
9
  price?: number | string;
@@ -10,6 +11,7 @@ export interface BaseProductDetailOptionItem {
10
11
  [key: string]: any;
11
12
  }
12
13
  export interface BaseProductDetailBundleItem {
14
+ production_code?: string;
13
15
  option?: BaseProductDetailOptionItem[];
14
16
  [key: string]: any;
15
17
  }
@@ -18,6 +20,7 @@ export interface BaseProductDetailPayload {
18
20
  product_id?: number | string | null;
19
21
  variant_id?: number | string | null;
20
22
  product_variant_id?: number | string | null;
23
+ production_code?: string;
21
24
  quantity?: number | string;
22
25
  num?: number | string;
23
26
  option?: BaseProductDetailOptionItem[];
@@ -30,6 +30,10 @@ function toPriceString(value) {
30
30
  if (!Number.isFinite(parsedValue)) return fallback;
31
31
  return parsedValue.toFixed(2);
32
32
  }
33
+ function normalizeProductionCode(value) {
34
+ if (value === undefined || value === null) return '';
35
+ return String(value).trim();
36
+ }
33
37
  function isBlankValue(value) {
34
38
  return value === undefined || value === null || typeof value === 'string' && value.trim() === '';
35
39
  }
@@ -104,7 +108,7 @@ function findVariantById(origin, variantId) {
104
108
  * 注意:这里不生成 identity,缺省时由 OrderModule 自动补齐。
105
109
  */
106
110
  export function transformBaseProductToOrderProduct(params) {
107
- var _ref10, _ref11, _ref12, _payload$product_id, _ref13, _ref14, _payload$product_vari, _payload$_origin, _payload$_origin2, _ref15, _findVariantById, _ref16, _ref17, _ref18, _ref19, _ref20, _matchedVariant$price, _ref21, _ref22, _payload$price, _ref23, _payload$line_total, _payload$_extend, _ref24, _ref25, _payload$product_sku$, _payload$product_sku, _payload$bundle, _payload$quantity, _payload$_extend2, _extend, _extend2, _ref26, _ref27, _origin$base_price, _ref28, _ref29, _payload$line_total2, _payload$_extend3, _payload$_extend4, _extend3, _payload$_extend5, _payload$_extend6, _ref30, _ref31, _payload$tax_fee, _ref32, _ref33, _payload$is_charge_ta;
111
+ var _ref10, _ref11, _ref12, _payload$product_id, _ref13, _ref14, _payload$product_vari, _payload$_origin, _payload$_origin2, _ref15, _findVariantById, _origin$production_co, _ref16, _ref17, _ref18, _ref19, _ref20, _matchedVariant$price, _ref21, _ref22, _payload$price, _ref23, _payload$line_total, _payload$_extend, _ref24, _ref25, _payload$product_sku$, _payload$product_sku, _payload$bundle, _payload$quantity, _payload$_extend2, _extend, _extend2, _ref26, _ref27, _origin$base_price, _ref28, _ref29, _payload$line_total2, _payload$_extend3, _payload$_extend4, _extend3, _payload$_extend5, _payload$_extend6, _ref30, _ref31, _payload$tax_fee, _ref32, _ref33, _payload$is_charge_ta;
108
112
  var payload = params.payload,
109
113
  _params$fallbackProdu = params.fallbackProductId,
110
114
  fallbackProductId = _params$fallbackProdu === void 0 ? null : _params$fallbackProdu;
@@ -116,6 +120,7 @@ export function transformBaseProductToOrderProduct(params) {
116
120
  var callbackOrigin = payload.origin || ((_payload$_origin = payload._origin) === null || _payload$_origin === void 0 ? void 0 : _payload$_origin.sourceProduct) || ((_payload$_origin2 = payload._origin) === null || _payload$_origin2 === void 0 ? void 0 : _payload$_origin2.sourceItem) || payload._origin || {};
117
121
  var origin = _objectSpread(_objectSpread({}, sourceProduct || {}), callbackOrigin || {});
118
122
  var matchedVariant = (_ref15 = (_findVariantById = findVariantById(callbackOrigin, productVariantId)) !== null && _findVariantById !== void 0 ? _findVariantById : findVariantById(sourceProduct, productVariantId)) !== null && _ref15 !== void 0 ? _ref15 : findVariantById(origin, productVariantId);
123
+ var productionCode = normalizeProductionCode(Object.prototype.hasOwnProperty.call(payload, 'production_code') ? payload.production_code : productVariantId > 0 ? matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.production_code : (_origin$production_co = origin === null || origin === void 0 ? void 0 : origin.production_code) !== null && _origin$production_co !== void 0 ? _origin$production_co : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.production_code);
119
124
  var hasPriceOverride = payload.price_override !== undefined && payload.price_override !== null && payload.price_override !== '';
120
125
  // 手动改价后 payload.price 是分摊后的主商品售价,不能再作为券前 source。
121
126
  // 此时优先从商品/variant 快照读取目录价;售价仍由 line_total - bundle 推导。
@@ -192,12 +197,14 @@ export function transformBaseProductToOrderProduct(params) {
192
197
  metadata.unique_identification_number = String(uniqueIdentificationNumber);
193
198
  }
194
199
  // 从源头补充商品多语言标题
195
- var productTitle = _objectSpread(_objectSpread({}, (sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.title_i18n) || {}), {}, {
196
- original: (sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.original_title) || (sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.title) || ''
200
+ var productTitleI18n = (sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.title_i18n) || {};
201
+ var productTitle = _objectSpread(_objectSpread({}, productTitleI18n), {}, {
202
+ original: productTitleI18n.original || (sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.original_title) || (sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.title) || ''
197
203
  });
198
204
  return _objectSpread(_objectSpread({
199
205
  product_id: productId,
200
206
  product_variant_id: productVariantId,
207
+ production_code: productionCode,
201
208
  unique_identification_number: uniqueIdentificationNumber ? String(uniqueIdentificationNumber) : undefined,
202
209
  num: resolvedQuantity,
203
210
  product_sku: _objectSpread(_objectSpread({}, payload.product_sku && _typeof(payload.product_sku) === 'object' ? payload.product_sku : {}), {}, {
@@ -256,11 +256,14 @@ export function normalizeOrderProduct(product) {
256
256
  sellingPrice: composedSellingPrice,
257
257
  quantity: getSafeProductNum(product.num)
258
258
  });
259
- return {
259
+ return _objectSpread(_objectSpread({
260
260
  order_detail_id: product.order_detail_id || null,
261
261
  product_id: product.product_id,
262
262
  num: getSafeProductNum(product.num),
263
- product_variant_id: product.product_variant_id,
263
+ product_variant_id: product.product_variant_id
264
+ }, product.production_code !== undefined && product.production_code !== null ? {
265
+ production_code: String(product.production_code).trim()
266
+ } : {}), {}, {
264
267
  product_sku: productSku,
265
268
  selling_price: composedSellingPrice,
266
269
  original_price: finalOriginalPrice,
@@ -270,5 +273,5 @@ export function normalizeOrderProduct(product) {
270
273
  product_bundle: normalizedBundle,
271
274
  metadata: metadata,
272
275
  note: product.note != null ? String(product.note) : ''
273
- };
276
+ });
274
277
  }
@@ -67,7 +67,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
67
67
  product_ids?: number[];
68
68
  collection?: number | string[];
69
69
  schedule_date?: string;
70
- }): Promise<any>;
70
+ }): Promise<ProductData[]>;
71
71
  /**
72
72
  * 通过 schedule 来读取商品,适用于 session 类商品
73
73
  *
@@ -87,7 +87,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
87
87
  date: string;
88
88
  product_ids?: number[];
89
89
  category_ids?: number[];
90
- }): Promise<any>;
90
+ }): Promise<ProductData[]>;
91
91
  /**
92
92
  * 更新完商品数据、切换日期、或者在较后的流程里登录了,检测当前购物车里是否有商品,如果有,则需要更新购物车里的商品价格
93
93
  *
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
326
326
  date: string;
327
327
  status: string;
328
328
  week: string;
329
- weekNum: 0 | 1 | 2 | 5 | 4 | 3 | 6;
329
+ weekNum: 0 | 5 | 3 | 1 | 2 | 4 | 6;
330
330
  }[]>;
331
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
332
332
  private getScheduleDataByIds;
@@ -345,7 +345,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
345
345
  count: number;
346
346
  left: number;
347
347
  summaryCount: number;
348
- status: "lots_of_space" | "filling_up_fast" | "sold_out";
348
+ status: "sold_out" | "lots_of_space" | "filling_up_fast";
349
349
  }[];
350
350
  /**
351
351
  * 找到多个资源的公共可用时间段
@@ -128,7 +128,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
128
128
  loadProducts(params?: ILoadProductsParams, options?: {
129
129
  callback?: (result: any) => void;
130
130
  subscriberId?: string;
131
- }): Promise<any>;
131
+ }): Promise<ProductData[]>;
132
132
  /**
133
133
  * 获取加时商品列表。
134
134
  *
@@ -2338,14 +2338,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2338
2338
  var bookingContextState = this.store.bookingContext.getState();
2339
2339
  var date = (_extra$date2 = extra === null || extra === void 0 ? void 0 : extra.date) !== null && _extra$date2 !== void 0 ? _extra$date2 : bookingContextState.date;
2340
2340
  var orderCustomerId = (_ref12 = (_this$getOrderCustome4 = (_this$getOrderCustome5 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome5 === void 0 ? void 0 : _this$getOrderCustome5.id) !== null && _this$getOrderCustome4 !== void 0 ? _this$getOrderCustome4 : (_this$store$order$get4 = this.store.order.getTempOrder()) === null || _this$store$order$get4 === void 0 ? void 0 : _this$store$order$get4.customer_id) !== null && _ref12 !== void 0 ? _ref12 : undefined;
2341
- return _objectSpread({
2341
+ return _objectSpread(_objectSpread({
2342
2342
  bookingConfig: bookingContextState.bookingConfig,
2343
2343
  resourcesOrigin: bookingContextState.resourcesOrigin,
2344
2344
  resourcesOriginMap: bookingContextState.resourcesOriginMap,
2345
2345
  date: date,
2346
2346
  presetStartTime: (_extra$presetStartTim2 = extra === null || extra === void 0 ? void 0 : extra.presetStartTime) !== null && _extra$presetStartTim2 !== void 0 ? _extra$presetStartTim2 : derivePresetStartTimeFromDate(date),
2347
2347
  customerId: orderCustomerId
2348
- }, extra || {});
2348
+ }, extra || {}), {}, {
2349
+ channel: this.getSubmitOrderSalesChannel()
2350
+ });
2349
2351
  }
2350
2352
 
2351
2353
  /**
@@ -5,7 +5,7 @@ import type { OrderProduct, OrderProductIdentity, AddProductBookingInput } from
5
5
  * cart.addProduct 两阶段决策(与 ticketBooking `handleSelectProduct` 对齐):
6
6
  *
7
7
  * 1. `requiresDetail`:规格 / SKU / 套餐 / Session / 称重弹窗(门禁:`isOpenDetailModal` / `cartDetailValue` / `open_sold_weight`)
8
- * 2. `requiresBookingEdit`:资源 / 时间编辑抽屉(门禁:`getIsAutoClose` on prepared cacheItem)
8
+ * 2. `requiresBookingEdit`:资源 / 时间编辑抽屉(kiosk 强制进入;其他渠道由 `getIsAutoClose` 决定)
9
9
  * 3. `add`:两关均通过,直接 transform + 加车
10
10
  */
11
11
  export type AddProductDecision = {
@@ -65,6 +65,7 @@ export interface AddProductDecideContext extends BookingCalcContext {
65
65
  type?: 'select' | 'detail';
66
66
  quantity?: number;
67
67
  customerId?: number | string;
68
+ channel?: string;
68
69
  }
69
70
  /**
70
71
  * 统一补齐预约商品的运行态字段。
@@ -13,7 +13,7 @@ import { buildProductSkuFromCacheItem } from "./weighingProductSku";
13
13
  * cart.addProduct 两阶段决策(与 ticketBooking `handleSelectProduct` 对齐):
14
14
  *
15
15
  * 1. `requiresDetail`:规格 / SKU / 套餐 / Session / 称重弹窗(门禁:`isOpenDetailModal` / `cartDetailValue` / `open_sold_weight`)
16
- * 2. `requiresBookingEdit`:资源 / 时间编辑抽屉(门禁:`getIsAutoClose` on prepared cacheItem)
16
+ * 2. `requiresBookingEdit`:资源 / 时间编辑抽屉(kiosk 强制进入;其他渠道由 `getIsAutoClose` 决定)
17
17
  * 3. `add`:两关均通过,直接 transform + 加车
18
18
  */
19
19
 
@@ -30,10 +30,11 @@ function needsSpecDetailModal(item) {
30
30
  }
31
31
 
32
32
  /**
33
- * 第二段:预约商品是否仍需打开资源 / 时间编辑(与 info2 `cacheItem.autoClose` 等价)。
33
+ * 第二段:预约商品是否仍需打开资源 / 时间编辑(kiosk 强制打开,其他渠道与 info2 `cacheItem.autoClose` 等价)。
34
34
  */
35
35
  function needsBookingEdit(cacheItem, ctx) {
36
36
  if (isNormalBookingProduct(cacheItem)) return false;
37
+ if ((ctx === null || ctx === void 0 ? void 0 : ctx.channel) === 'kiosk') return true;
37
38
  var isAutoAllocationOn = (ctx === null || ctx === void 0 ? void 0 : ctx.isAutoAllocationOn) || function () {
38
39
  return true;
39
40
  };
@@ -318,7 +319,7 @@ export function transformDetailToProductAndBooking(cacheItem, ctx) {
318
319
  * 把 cacheItem._extend.other 中的字段 + 顶层运行态拼成 `BaseProductDetailPayload`。
319
320
  */
320
321
  function buildBasePayloadFromCacheItem(cacheItem, ctx) {
321
- var _cacheItem$_extend, _cacheItem$_extend$qu, _cacheItem$_extend2, _cacheItem$product_id, _cacheItem$id, _ref5, _other$product_varian, _extend$skuValue, _extend$_skuValue, _extend$price, _extend$price2;
322
+ var _cacheItem$_extend, _cacheItem$_extend$qu, _cacheItem$_extend2, _cacheItem$product_id, _cacheItem$id, _ref5, _other$product_varian, _other$production_cod, _extend$skuValue, _extend$_skuValue, _extend$price, _extend$price2;
322
323
  var other = (cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend = cacheItem._extend) === null || _cacheItem$_extend === void 0 ? void 0 : _cacheItem$_extend.other) || {};
323
324
  var quantity = (ctx === null || ctx === void 0 ? void 0 : ctx.quantity) != null && ctx.quantity > 0 ? ctx.quantity : (_cacheItem$_extend$qu = cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend2 = cacheItem._extend) === null || _cacheItem$_extend2 === void 0 ? void 0 : _cacheItem$_extend2.quantity) !== null && _cacheItem$_extend$qu !== void 0 ? _cacheItem$_extend$qu : 1;
324
325
  var resolvedPid = (_cacheItem$product_id = cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.product_id) !== null && _cacheItem$product_id !== void 0 ? _cacheItem$product_id : cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.id;
@@ -328,6 +329,8 @@ function buildBasePayloadFromCacheItem(cacheItem, ctx) {
328
329
  id: (_cacheItem$id = cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.id) !== null && _cacheItem$id !== void 0 ? _cacheItem$id : cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.product_id,
329
330
  product_id: resolvedPid,
330
331
  variant_id: (_ref5 = (_other$product_varian = other === null || other === void 0 ? void 0 : other.product_variant_id) !== null && _other$product_varian !== void 0 ? _other$product_varian : other === null || other === void 0 ? void 0 : other.variant_id) !== null && _ref5 !== void 0 ? _ref5 : 0,
332
+ // SKUOptionsSelection 已按 Product / Variant 解析好主商品编码;显式空串也需保留。
333
+ production_code: (_other$production_cod = other === null || other === void 0 ? void 0 : other.production_code) !== null && _other$production_cod !== void 0 ? _other$production_cod : cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.production_code,
331
334
  quantity: quantity,
332
335
  // 规格弹窗本次选择是 option 权威源,避免目录/旧订单里的空 option 覆盖它。
333
336
  product_sku: productSku ? _objectSpread(_objectSpread({}, productSku), {}, {
@@ -18,8 +18,9 @@ function resolveCustomerDisplayName(customer) {
18
18
 
19
19
  /** 将 ICustomer 格式化为写入 tempOrder 的协议字段。 */
20
20
  export function formatOrderCustomerPatch(customer) {
21
- var _customer$phone, _customer$email, _country_calling_code, _country_calling_code2;
22
- var rawId = customer.id;
21
+ var _ref, _c$customer_id, _customer$phone, _customer$email, _country_calling_code, _country_calling_code2;
22
+ var c = customer;
23
+ var rawId = (_ref = (_c$customer_id = c.customer_id) !== null && _c$customer_id !== void 0 ? _c$customer_id : c.customerId) !== null && _ref !== void 0 ? _ref : customer.id;
23
24
  var numericId = typeof rawId === 'number' ? rawId : rawId !== undefined && rawId !== null && rawId !== '' ? Number(rawId) : null;
24
25
  return {
25
26
  customer_id: Number.isFinite(numericId) ? numericId : null,
@@ -10,7 +10,11 @@ export interface ApiConfig {
10
10
  method: 'GET' | 'POST' | 'PUT' | 'DELETE';
11
11
  transformParams?: (params: any) => any;
12
12
  transformResponse?: (response: any) => any;
13
- options?: Record<string, any>;
13
+ options?: Record<string, any> | ((params: any) => Record<string, any>);
14
+ }
15
+ export interface ApiCallerOptions {
16
+ baseUrl?: string;
17
+ shopDomain?: string;
14
18
  }
15
19
  /**
16
20
  * 渠道配置接口
@@ -65,12 +69,14 @@ export declare function getChannelConfig(channel: string): ChannelConfig;
65
69
  export declare class ApiCaller {
66
70
  private request;
67
71
  private config;
72
+ private options;
68
73
  constructor(request: {
69
74
  get: <T = any>(url: string, data?: any, options?: any) => Promise<T>;
70
75
  post: <T = any>(url: string, data?: any, options?: any) => Promise<T>;
71
76
  put: <T = any>(url: string, data?: any, options?: any) => Promise<T>;
72
77
  delete: <T = any>(url: string, options?: any) => Promise<T>;
73
- }, config: ChannelConfig);
78
+ }, config: ChannelConfig, options?: ApiCallerOptions);
79
+ private resolveUrl;
74
80
  /**
75
81
  * 执行 API 调用
76
82
  */
@@ -84,4 +90,4 @@ export declare function createApiCaller(request: {
84
90
  post: <T = any>(url: string, data?: any, options?: any) => Promise<T>;
85
91
  put: <T = any>(url: string, data?: any, options?: any) => Promise<T>;
86
92
  delete: <T = any>(url: string, options?: any) => Promise<T>;
87
- }, channel: string): ApiCaller;
93
+ }, channel: string, options?: ApiCallerOptions): ApiCaller;
@@ -1,15 +1,24 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ var _excluded = ["withCredentials"];
2
3
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
3
- 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
- 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
- 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; }
6
4
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
7
5
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
8
6
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9
7
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
10
8
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
9
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
10
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
11
+ 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; }
12
+ 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; }
13
+ 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; }
11
14
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
12
15
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
16
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
17
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
18
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
19
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
20
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
21
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
22
  /**
14
23
  * 注册登录解决方案配置
15
24
  * 根据不同渠道配置不同的接口地址和参数
@@ -19,6 +28,8 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
19
28
  * API 配置接口
20
29
  */
21
30
 
31
+ var h5CustomerAuthApiNames = new Set(['sendEmailVerificationCode', 'sendEmailLoginCode', 'sendSmsRegisterCode', 'sendEmailRegisterLink', 'verifyEmailRegistrationLink', 'emailPasswordLogin', 'emailCodeRegister', 'phoneCodeRegister', 'resendEmailRegisterLink', 'checkEmailLinkCode', 'sendSmsLoginCode', 'phoneCodeLogin', 'guestLogin', 'checkEmailExists', 'checkEmailCode', 'checkMobileCode', 'phonePasswordLogin', 'sendPasswordResetEmail', 'sendPasswordResetSms', 'sendResetPasswordLink', 'checkResetPasswordCode', 'resetPasswordByCode', 'resetPasswordByEmail', 'resetPasswordByPhone', 'verifyCode', 'register', 'login', 'oauthLogin', 'facebookLogin', 'appleLogin']);
32
+
22
33
  /**
23
34
  * 渠道配置接口
24
35
  */
@@ -350,6 +361,31 @@ var onlineStoreConfig = {
350
361
  }
351
362
  }
352
363
  };
364
+ function withH5AuthPrefix(config) {
365
+ var nextConfig = {};
366
+ Object.entries(config).forEach(function (_ref) {
367
+ var _ref2 = _slicedToArray(_ref, 2),
368
+ key = _ref2[0],
369
+ apiConfig = _ref2[1];
370
+ if (!apiConfig.url.startsWith('/auth/')) {
371
+ nextConfig[key] = apiConfig;
372
+ return;
373
+ }
374
+ nextConfig[key] = _objectSpread(_objectSpread({}, apiConfig), {}, {
375
+ url: apiConfig.url.startsWith('/h5/') ? apiConfig.url : "/h5".concat(apiConfig.url),
376
+ options: function options(params) {
377
+ var _ref3 = (typeof apiConfig.options === 'function' ? apiConfig.options(params) : apiConfig.options) || {},
378
+ withCredentials = _ref3.withCredentials,
379
+ baseOptions = _objectWithoutProperties(_ref3, _excluded);
380
+ return _objectSpread(_objectSpread({}, baseOptions), {}, {
381
+ prefix: false
382
+ });
383
+ }
384
+ });
385
+ });
386
+ return nextConfig;
387
+ }
388
+ var h5OnlineStoreConfig = withH5AuthPrefix(onlineStoreConfig);
353
389
 
354
390
  /**
355
391
  * 默认配置(通用配置)
@@ -1346,6 +1382,7 @@ var shopWebposConfig = {
1346
1382
  */
1347
1383
  export var channelConfigMap = {
1348
1384
  'online-store': onlineStoreConfig,
1385
+ 'online-store-h5': h5OnlineStoreConfig,
1349
1386
  'default': defaultConfig,
1350
1387
  'webpos': webposConfig,
1351
1388
  'shop.webpos': shopWebposConfig
@@ -1364,15 +1401,25 @@ export function getChannelConfig(channel) {
1364
1401
  */
1365
1402
  export var ApiCaller = /*#__PURE__*/function () {
1366
1403
  function ApiCaller(request, config) {
1404
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1367
1405
  _classCallCheck(this, ApiCaller);
1368
1406
  this.request = request;
1369
1407
  this.config = config;
1408
+ this.options = options;
1370
1409
  }
1371
-
1372
- /**
1373
- * 执行 API 调用
1374
- */
1375
1410
  _createClass(ApiCaller, [{
1411
+ key: "resolveUrl",
1412
+ value: function resolveUrl(url) {
1413
+ if (!this.options.baseUrl || !url.startsWith('/h5/auth/')) {
1414
+ return url;
1415
+ }
1416
+ return "".concat(this.options.baseUrl.replace(/\/$/, '')).concat(url);
1417
+ }
1418
+
1419
+ /**
1420
+ * 执行 API 调用
1421
+ */
1422
+ }, {
1376
1423
  key: "call",
1377
1424
  value: (function () {
1378
1425
  var _call = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(apiName, params, additionalOptions) {
@@ -1397,7 +1444,15 @@ export var ApiCaller = /*#__PURE__*/function () {
1397
1444
  }
1398
1445
 
1399
1446
  // 构建请求选项
1400
- requestOptions = _objectSpread(_objectSpread({}, options), additionalOptions); // 处理动态 headers
1447
+ requestOptions = _objectSpread(_objectSpread({}, options), additionalOptions);
1448
+ if (apiConfig.url.startsWith('/h5/auth/') && h5CustomerAuthApiNames.has(apiName)) {
1449
+ requestOptions.h5CustomerAuth = true;
1450
+ if (this.options.shopDomain) {
1451
+ requestOptions.h5AuthShopDomain = this.options.shopDomain;
1452
+ }
1453
+ }
1454
+
1455
+ // 处理动态 headers
1401
1456
  if (requestOptions.headers && typeof requestOptions.headers === 'function') {
1402
1457
  requestOptions.headers = requestOptions.headers(params);
1403
1458
  }
@@ -1405,49 +1460,49 @@ export var ApiCaller = /*#__PURE__*/function () {
1405
1460
 
1406
1461
  // 根据 HTTP 方法调用对应的请求方法
1407
1462
  _context.t0 = apiConfig.method;
1408
- _context.next = _context.t0 === 'GET' ? 12 : _context.t0 === 'POST' ? 22 : _context.t0 === 'PUT' ? 26 : _context.t0 === 'DELETE' ? 30 : 34;
1463
+ _context.next = _context.t0 === 'GET' ? 13 : _context.t0 === 'POST' ? 23 : _context.t0 === 'PUT' ? 27 : _context.t0 === 'DELETE' ? 31 : 35;
1409
1464
  break;
1410
- case 12:
1465
+ case 13:
1411
1466
  if (!(transformedParams && Object.keys(transformedParams).length > 0)) {
1412
- _context.next = 18;
1467
+ _context.next = 19;
1413
1468
  break;
1414
1469
  }
1415
- _context.next = 15;
1416
- return this.request.get(apiConfig.url, transformedParams, requestOptions);
1417
- case 15:
1470
+ _context.next = 16;
1471
+ return this.request.get(this.resolveUrl(apiConfig.url), transformedParams, requestOptions);
1472
+ case 16:
1418
1473
  response = _context.sent;
1419
- _context.next = 21;
1474
+ _context.next = 22;
1420
1475
  break;
1421
- case 18:
1422
- _context.next = 20;
1423
- return this.request.get(apiConfig.url, undefined, requestOptions);
1424
- case 20:
1425
- response = _context.sent;
1476
+ case 19:
1477
+ _context.next = 21;
1478
+ return this.request.get(this.resolveUrl(apiConfig.url), undefined, requestOptions);
1426
1479
  case 21:
1427
- return _context.abrupt("break", 35);
1480
+ response = _context.sent;
1428
1481
  case 22:
1429
- _context.next = 24;
1430
- return this.request.post(apiConfig.url, transformedParams, requestOptions);
1431
- case 24:
1482
+ return _context.abrupt("break", 36);
1483
+ case 23:
1484
+ _context.next = 25;
1485
+ return this.request.post(this.resolveUrl(apiConfig.url), transformedParams, requestOptions);
1486
+ case 25:
1432
1487
  response = _context.sent;
1433
- return _context.abrupt("break", 35);
1434
- case 26:
1435
- _context.next = 28;
1436
- return this.request.put(apiConfig.url, transformedParams, requestOptions);
1437
- case 28:
1488
+ return _context.abrupt("break", 36);
1489
+ case 27:
1490
+ _context.next = 29;
1491
+ return this.request.put(this.resolveUrl(apiConfig.url), transformedParams, requestOptions);
1492
+ case 29:
1438
1493
  response = _context.sent;
1439
- return _context.abrupt("break", 35);
1440
- case 30:
1441
- _context.next = 32;
1442
- return this.request.delete(apiConfig.url, requestOptions);
1443
- case 32:
1494
+ return _context.abrupt("break", 36);
1495
+ case 31:
1496
+ _context.next = 33;
1497
+ return this.request.delete(this.resolveUrl(apiConfig.url), requestOptions);
1498
+ case 33:
1444
1499
  response = _context.sent;
1445
- return _context.abrupt("break", 35);
1446
- case 34:
1447
- throw new Error("\u4E0D\u652F\u6301\u7684 HTTP \u65B9\u6CD5: ".concat(apiConfig.method));
1500
+ return _context.abrupt("break", 36);
1448
1501
  case 35:
1449
- return _context.abrupt("return", apiConfig.transformResponse ? apiConfig.transformResponse(response) : response);
1502
+ throw new Error("\u4E0D\u652F\u6301\u7684 HTTP \u65B9\u6CD5: ".concat(apiConfig.method));
1450
1503
  case 36:
1504
+ return _context.abrupt("return", apiConfig.transformResponse ? apiConfig.transformResponse(response) : response);
1505
+ case 37:
1451
1506
  case "end":
1452
1507
  return _context.stop();
1453
1508
  }
@@ -1465,7 +1520,7 @@ export var ApiCaller = /*#__PURE__*/function () {
1465
1520
  /**
1466
1521
  * 创建 API 调用器
1467
1522
  */
1468
- export function createApiCaller(request, channel) {
1523
+ export function createApiCaller(request, channel, options) {
1469
1524
  var config = getChannelConfig(channel);
1470
- return new ApiCaller(request, config);
1525
+ return new ApiCaller(request, config, options);
1471
1526
  }
@@ -323,7 +323,10 @@ export var RegisterAndLoginImpl = /*#__PURE__*/function (_BaseModule) {
323
323
  throw new Error('RegisterAndLogin 模块需要 window 插件支持');
324
324
  case 10:
325
325
  // 创建 API 调用器
326
- this.apiCaller = createApiCaller(this.request, this.channel);
326
+ this.apiCaller = createApiCaller(this.request, this.channel, {
327
+ baseUrl: this.otherParams.h5AuthBaseUrl,
328
+ shopDomain: this.otherParams.h5AuthShopDomain
329
+ });
327
330
 
328
331
  // 尝试从本地存储恢复登录状态
329
332
  _context4.next = 13;
@@ -13,6 +13,7 @@ interface ScanOrderItemRuleRuntimeConfig {
13
13
  pax?: Partial<PaxInfo>;
14
14
  historicalItems?: CartItemSummary[];
15
15
  serviceType?: string;
16
+ channel?: string;
16
17
  submissionIndex?: number;
17
18
  custom?: Record<string, any>;
18
19
  }