@pisell/pisellos 3.0.78 → 3.0.79

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 (37) hide show
  1. package/dist/modules/Cart/types.d.ts +2 -0
  2. package/dist/modules/Cart/utils/cartProduct.js +21 -1
  3. package/dist/modules/Cart/utils/changePrice.js +6 -0
  4. package/dist/modules/Date/index.d.ts +1 -1
  5. package/dist/modules/Date/index.js +16 -8
  6. package/dist/modules/Discount/index.d.ts +1 -0
  7. package/dist/modules/Discount/index.js +2 -1
  8. package/dist/modules/Rules/index.js +14 -14
  9. package/dist/modules/Schedule/index.d.ts +9 -0
  10. package/dist/modules/Schedule/index.js +76 -0
  11. package/dist/modules/Summary/index.d.ts +3 -0
  12. package/dist/modules/Summary/index.js +134 -15
  13. package/dist/modules/Summary/types.d.ts +7 -0
  14. package/dist/modules/Summary/utils.d.ts +104 -1
  15. package/dist/modules/Summary/utils.js +1131 -13
  16. package/dist/solution/BookingByStep/index.d.ts +4 -7
  17. package/dist/solution/BookingByStep/index.js +232 -119
  18. package/dist/solution/ShopDiscount/index.js +2 -1
  19. package/lib/modules/Cart/types.d.ts +2 -0
  20. package/lib/modules/Cart/utils/cartProduct.js +16 -1
  21. package/lib/modules/Cart/utils/changePrice.js +5 -0
  22. package/lib/modules/Date/index.d.ts +1 -1
  23. package/lib/modules/Date/index.js +7 -1
  24. package/lib/modules/Discount/index.d.ts +1 -0
  25. package/lib/modules/Discount/index.js +2 -1
  26. package/lib/modules/Rules/index.js +3 -3
  27. package/lib/modules/Schedule/index.d.ts +9 -0
  28. package/lib/modules/Schedule/index.js +60 -0
  29. package/lib/modules/Summary/index.d.ts +3 -0
  30. package/lib/modules/Summary/index.js +61 -2
  31. package/lib/modules/Summary/types.d.ts +7 -0
  32. package/lib/modules/Summary/utils.d.ts +104 -1
  33. package/lib/modules/Summary/utils.js +673 -8
  34. package/lib/solution/BookingByStep/index.d.ts +4 -7
  35. package/lib/solution/BookingByStep/index.js +189 -90
  36. package/lib/solution/ShopDiscount/index.js +2 -1
  37. package/package.json +1 -1
@@ -147,6 +147,9 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
147
147
  taxTitle?: string | undefined;
148
148
  totalTaxFee?: string | number | undefined;
149
149
  isPriceIncludeTax?: 0 | 1 | undefined;
150
+ surchargeAmount?: string | number | undefined;
151
+ surcharge?: any[] | undefined;
152
+ taxRate?: string | number | undefined;
150
153
  deposit?: {
151
154
  total?: string | number | undefined;
152
155
  policies?: import("../../modules/Summary/types").IProtocol[] | undefined;
@@ -326,7 +329,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
326
329
  count: number;
327
330
  left: number;
328
331
  summaryCount: number;
329
- status: keyof TimeStatusMap;
332
+ status: "lots_of_space" | "filling_up_fast" | "sold_out";
330
333
  }[];
331
334
  /**
332
335
  * 找到多个资源的公共可用时间段
@@ -391,9 +394,3 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
391
394
  */
392
395
  getContactInfo(params: any): Promise<any>;
393
396
  }
394
- interface TimeStatusMap {
395
- lots_of_space: true;
396
- filling_up_fast: true;
397
- sold_out: true;
398
- }
399
- export {};
@@ -862,7 +862,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
862
862
  resources.push(...dateResources || []);
863
863
  } else {
864
864
  const dateList = this.store.date.getDateList();
865
- dateList.forEach((n) => {
865
+ dateList == null ? void 0 : dateList.forEach((n) => {
866
866
  if (n.resource)
867
867
  resources.push(...n.resource);
868
868
  });
@@ -1447,6 +1447,9 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1447
1447
  }
1448
1448
  });
1449
1449
  }
1450
+ if (resources.length === 0) {
1451
+ resources.push(...this.store.date.getResourcesListByDate(dateRange[0].date) || []);
1452
+ }
1450
1453
  const resourcesMap = (0, import_utils2.getResourcesMap)(resources);
1451
1454
  let duration = 0;
1452
1455
  const accountList = this.store.accountList.getAccounts();
@@ -1749,6 +1752,28 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1749
1752
  newResources.forEach((resource) => {
1750
1753
  var _a3, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k;
1751
1754
  if (((_b2 = (_a3 = item._productOrigin) == null ? void 0 : _a3.duration) == null ? void 0 : _b2.type) === "flexible") {
1755
+ let getEarliestBlockedStartTime = function({
1756
+ currentStartTime: currentStartTime2,
1757
+ times
1758
+ }) {
1759
+ const currentStart = (0, import_dayjs.default)(currentStartTime2);
1760
+ let earliestBlockStart;
1761
+ for (const time of times || []) {
1762
+ for (const event of time.event_list || []) {
1763
+ const eventStart = (0, import_dayjs.default)(event.start_at);
1764
+ const eventEnd = (0, import_dayjs.default)(event.end_at);
1765
+ if (eventStart.isBefore(currentStart) && eventEnd.isAfter(currentStart)) {
1766
+ return currentStart.format("YYYY-MM-DD HH:mm");
1767
+ }
1768
+ if (eventStart.isAfter(currentStart)) {
1769
+ if (!earliestBlockStart || eventStart.isBefore(earliestBlockStart)) {
1770
+ earliestBlockStart = eventStart;
1771
+ }
1772
+ }
1773
+ }
1774
+ }
1775
+ return earliestBlockStart == null ? void 0 : earliestBlockStart.format("YYYY-MM-DD HH:mm");
1776
+ };
1752
1777
  item.duration = {
1753
1778
  type: "minutes",
1754
1779
  value: 10
@@ -1763,13 +1788,22 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1763
1788
  },
1764
1789
  targetResourceTimes[0]
1765
1790
  );
1791
+ const earliestBlockedStartTime = getEarliestBlockedStartTime({
1792
+ currentStartTime,
1793
+ times: targetResourceTimes
1794
+ });
1766
1795
  const resourceDate = (0, import_dayjs.default)(resourcesEndTime.end_at).format(
1767
1796
  "YYYY-MM-DD"
1768
1797
  );
1769
1798
  const operatingBoundaryDateTime = `${resourceDate} ${operating_day_boundary.type === "start_time" ? "23:59" : operating_day_boundary.time}`;
1770
- const endTime = (0, import_dayjs.default)(resourcesEndTime.end_at).isBefore(
1771
- (0, import_dayjs.default)(operatingBoundaryDateTime)
1772
- ) ? resourcesEndTime.end_at : operatingBoundaryDateTime;
1799
+ const endTimeCandidates = [
1800
+ resourcesEndTime.end_at,
1801
+ operatingBoundaryDateTime,
1802
+ ...earliestBlockedStartTime ? [earliestBlockedStartTime] : []
1803
+ ];
1804
+ const endTime = endTimeCandidates.reduce((earliest, value) => {
1805
+ return (0, import_dayjs.default)(value).isBefore((0, import_dayjs.default)(earliest)) ? value : earliest;
1806
+ }, endTimeCandidates[0]);
1773
1807
  let formattedEndTime;
1774
1808
  if (typeof endTime === "string" && endTime.includes(":") && !endTime.includes(" ") && !endTime.includes("T")) {
1775
1809
  const currentDate = timeSlots.start_at.format("YYYY-MM-DD");
@@ -1864,7 +1898,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1864
1898
  resources,
1865
1899
  product
1866
1900
  }) {
1867
- var _a, _b, _c, _d, _e, _f, _g;
1901
+ var _a, _b, _c, _d;
1868
1902
  const targetProduct = this.store.currentProduct;
1869
1903
  const targetProductData = product || targetProduct;
1870
1904
  let targetSchedules = [];
@@ -1907,29 +1941,48 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1907
1941
  return -1;
1908
1942
  return 0;
1909
1943
  });
1910
- const firstEnabledResourceId = (_e = (_d = (_c = targetProductData == null ? void 0 : targetProductData.product_resource) == null ? void 0 : _c.resources) == null ? void 0 : _d.find(
1944
+ const enabledResourceTypeConfigs = ((_d = (_c = targetProductData == null ? void 0 : targetProductData.product_resource) == null ? void 0 : _c.resources) == null ? void 0 : _d.filter(
1911
1945
  (n) => n.status === 1
1912
- )) == null ? void 0 : _e.id;
1913
- const firstEnabledResourceConfig = (_g = (_f = targetProductData == null ? void 0 : targetProductData.product_resource) == null ? void 0 : _f.resources) == null ? void 0 : _g.find(
1914
- (n) => n.status === 1 && n.id === firstEnabledResourceId
1946
+ )) || [];
1947
+ const resourceTypeConfigById = new Map(
1948
+ enabledResourceTypeConfigs.map((n) => [n.id, n])
1915
1949
  );
1916
- const isMultipleBooking = (firstEnabledResourceConfig == null ? void 0 : firstEnabledResourceConfig.type) === "multiple";
1917
1950
  const formatScheduleTimeSlots = scheduleTimeSlots.map((item) => {
1918
1951
  const resourcesUseableMap = {};
1919
- let count = 0;
1920
- let bookingLeft = 0;
1921
- let summaryCount = 0;
1922
- let summaryConfigCount = 0;
1952
+ const statsByResourceType = {};
1953
+ enabledResourceTypeConfigs.forEach((cfg) => {
1954
+ statsByResourceType[cfg.id] = {
1955
+ count: 0,
1956
+ left: 0,
1957
+ summaryCount: 0,
1958
+ summaryConfigCount: 0
1959
+ };
1960
+ });
1923
1961
  allProductResources == null ? void 0 : allProductResources.forEach((m) => {
1924
- let currentResourcesCount = 0;
1925
- let currentResourcesSummaryCount = 0;
1926
- const currentResourcesTimeSlotCanUsedArr = [];
1962
+ const currentResourceTypeConfig = resourceTypeConfigById.get(m.form_id);
1963
+ if (!currentResourceTypeConfig)
1964
+ return;
1965
+ let currentResourceMaxRemainingCapacity = 0;
1966
+ let isAllTimeSlicesUsable = true;
1927
1967
  const mTimes = m.times.filter((n) => {
1928
1968
  return !(0, import_dayjs.default)(n.start_at).isAfter((0, import_dayjs.default)(item.start), "minute") && !(0, import_dayjs.default)(n.end_at).isBefore((0, import_dayjs.default)(item.end), "minute") || m.onlyComputed && (0, import_dayjs.default)(n.start_at).isBefore((0, import_dayjs.default)(item.end), "minute") && (0, import_dayjs.default)(n.end_at).isAfter((0, import_dayjs.default)(item.start), "minute");
1929
1969
  });
1930
1970
  if (mTimes.length === 0) {
1931
1971
  return;
1932
1972
  }
1973
+ if (!m.onlyComputed) {
1974
+ const currentStats2 = statsByResourceType[m.form_id] || {
1975
+ count: 0,
1976
+ left: 0,
1977
+ summaryCount: 0,
1978
+ summaryConfigCount: 0
1979
+ };
1980
+ if (currentResourceTypeConfig.type === "multiple")
1981
+ currentStats2.summaryConfigCount += m.capacity;
1982
+ else
1983
+ currentStats2.summaryConfigCount += 1;
1984
+ statsByResourceType[m.form_id] = currentStats2;
1985
+ }
1933
1986
  mTimes.forEach((childTiem) => {
1934
1987
  const res = (0, import_resources.getIsUsableByTimeItem)({
1935
1988
  timeSlice: {
@@ -1947,52 +2000,61 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1947
2000
  if ((resourcesUseableMap == null ? void 0 : resourcesUseableMap[m.id]) !== false && res.reason !== "capacityOnly") {
1948
2001
  resourcesUseableMap[m.id] = res.usable;
1949
2002
  }
1950
- if (res.usable && res.remainingCapacity >= count && !m.onlyComputed) {
1951
- currentResourcesCount = res.remainingCapacity;
1952
- }
1953
- if (res.usable && !m.onlyComputed && res.remainingCapacity >= currentResourcesSummaryCount) {
1954
- currentResourcesSummaryCount = res.remainingCapacity;
2003
+ if (!res.usable)
2004
+ isAllTimeSlicesUsable = false;
2005
+ if (res.usable && !m.onlyComputed) {
2006
+ if (res.remainingCapacity > currentResourceMaxRemainingCapacity)
2007
+ currentResourceMaxRemainingCapacity = res.remainingCapacity;
1955
2008
  }
1956
- currentResourcesTimeSlotCanUsedArr.push(res.usable);
1957
2009
  });
1958
- if (m.form_id === firstEnabledResourceId) {
1959
- if (isMultipleBooking) {
1960
- summaryConfigCount += m.capacity;
1961
- } else {
1962
- summaryConfigCount += 1;
1963
- }
1964
- }
1965
- if (!currentResourcesTimeSlotCanUsedArr.some(
1966
- (n) => n === false
1967
- ) && // 只统计第一种资源的容量和 left
1968
- m.form_id === firstEnabledResourceId) {
1969
- if (currentResourcesCount >= count) {
1970
- count = currentResourcesCount;
1971
- }
1972
- if (!m.onlyComputed) {
1973
- bookingLeft += 1;
1974
- summaryCount += currentResourcesSummaryCount;
1975
- }
2010
+ if (!isAllTimeSlicesUsable)
2011
+ return;
2012
+ if (m.onlyComputed)
2013
+ return;
2014
+ const currentStats = statsByResourceType[m.form_id] || {
2015
+ count: 0,
2016
+ left: 0,
2017
+ summaryCount: 0,
2018
+ summaryConfigCount: 0
2019
+ };
2020
+ currentStats.left += 1;
2021
+ if (currentResourceTypeConfig.type === "multiple") {
2022
+ currentStats.summaryCount += currentResourceMaxRemainingCapacity;
2023
+ if (currentResourceMaxRemainingCapacity > currentStats.count)
2024
+ currentStats.count = currentResourceMaxRemainingCapacity;
2025
+ } else {
2026
+ currentStats.summaryCount += 1;
2027
+ if (currentStats.count < 1)
2028
+ currentStats.count = 1;
1976
2029
  }
2030
+ statsByResourceType[m.form_id] = currentStats;
1977
2031
  });
1978
2032
  const cartItems2 = this.store.cart.getItems();
1979
2033
  productResources.forEach((n) => {
2034
+ const currentResourceTypeConfig = resourceTypeConfigById.get(n.id);
2035
+ if (!currentResourceTypeConfig)
2036
+ return;
2037
+ const currentStats = statsByResourceType[n.id] || {
2038
+ count: 0,
2039
+ left: 0,
2040
+ summaryCount: 0
2041
+ };
1980
2042
  if (n.type === "single") {
1981
2043
  const currentResourcesSet = /* @__PURE__ */ new Set([...n.optional_resource, ...n.default_resource]);
1982
2044
  const sameCartItems = cartItems2.filter((m) => {
1983
2045
  var _a2, _b2, _c2;
1984
2046
  return ((_b2 = (_a2 = m._productOrigin) == null ? void 0 : _a2.id) == null ? void 0 : _b2.toString()) === ((_c2 = targetProductData == null ? void 0 : targetProductData.id) == null ? void 0 : _c2.toString()) && `${m.start_date} ${m.start_time}` === item.start && `${m.start_date} ${m.end_time}` === item.end;
1985
2047
  });
1986
- if (sameCartItems.length > 0 && sameCartItems.length >= currentResourcesSet.size || sameCartItems.length > bookingLeft) {
1987
- bookingLeft = 0;
1988
- count = 0;
1989
- summaryCount = 0;
2048
+ if (sameCartItems.length > 0 && sameCartItems.length >= currentResourcesSet.size || sameCartItems.length > currentStats.left) {
2049
+ currentStats.left = 0;
2050
+ currentStats.count = 0;
2051
+ currentStats.summaryCount = 0;
1990
2052
  }
1991
2053
  let otherCartItems = cartItems2.filter(
1992
2054
  (m) => {
1993
- var _a2, _b2, _c2, _d2, _e2, _f2;
2055
+ var _a2, _b2, _c2, _d2, _e, _f;
1994
2056
  const isTimeMatch = ((_b2 = (_a2 = m._productOrigin) == null ? void 0 : _a2.id) == null ? void 0 : _b2.toString()) !== ((_c2 = targetProductData == null ? void 0 : targetProductData.id) == null ? void 0 : _c2.toString()) && `${m.start_date} ${m.start_time}` === item.start && `${m.start_date} ${m.end_time}` === item.end;
1995
- const isResourceMatch = (_f2 = (_e2 = (_d2 = m._productOrigin) == null ? void 0 : _d2.product_resource) == null ? void 0 : _e2.resources) == null ? void 0 : _f2.find((m2) => m2.type === n.type && m2.status === 1);
2057
+ const isResourceMatch = (_f = (_e = (_d2 = m._productOrigin) == null ? void 0 : _d2.product_resource) == null ? void 0 : _e.resources) == null ? void 0 : _f.find((m2) => m2.type === n.type && m2.status === 1);
1996
2058
  return isTimeMatch && isResourceMatch;
1997
2059
  }
1998
2060
  );
@@ -2014,9 +2076,9 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
2014
2076
  }
2015
2077
  });
2016
2078
  if (currentResourcesSet.size > 0 && otherCartItems.length + sameCartItems.length >= currentResourcesSet.size) {
2017
- bookingLeft = 0;
2018
- count = 0;
2019
- summaryCount = 0;
2079
+ currentStats.left = 0;
2080
+ currentStats.count = 0;
2081
+ currentStats.summaryCount = 0;
2020
2082
  }
2021
2083
  } else {
2022
2084
  const sameCartItems = cartItems2.filter((m) => {
@@ -2026,9 +2088,9 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
2026
2088
  const sameCartNeedCapacity = sameCartItems.reduce((acc, curr) => acc + (0, import_capacity.getCapacityInfoByCartItem)(curr).currentCapacity, 0);
2027
2089
  const currentProductResourcesCapacity = n.renderList.reduce((acc, curr) => !curr.onlyComputed ? acc + curr.capacity || 0 : acc, 0);
2028
2090
  if (sameCartNeedCapacity >= currentProductResourcesCapacity) {
2029
- bookingLeft = 0;
2030
- count = 0;
2031
- summaryCount = 0;
2091
+ currentStats.left = 0;
2092
+ currentStats.count = 0;
2093
+ currentStats.summaryCount = 0;
2032
2094
  }
2033
2095
  const otherSameTimesCartItems = cartItems2.filter((m) => `${m.start_date} ${m.start_time}` === item.start && `${m.start_date} ${m.end_time}` === item.end);
2034
2096
  const otherCartNeedCapacity = otherSameTimesCartItems.reduce((acc, curr) => acc + (0, import_capacity.getCapacityInfoByCartItem)(curr).currentCapacity, 0);
@@ -2071,51 +2133,68 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
2071
2133
  return acc;
2072
2134
  }, 0);
2073
2135
  if (otherCartNeedCapacity + usedCapacity >= currentTypeResourcesCapacity) {
2074
- bookingLeft = 0;
2075
- count = 0;
2076
- summaryCount = 0;
2136
+ currentStats.left = 0;
2137
+ currentStats.count = 0;
2138
+ currentStats.summaryCount = 0;
2077
2139
  }
2078
2140
  }
2141
+ statsByResourceType[n.id] = currentStats;
2079
2142
  });
2080
2143
  const startDayJs = (0, import_dayjs.default)(item.start);
2081
2144
  const endDayJs = (0, import_dayjs.default)(item.end);
2082
- let timeStatus = "sold_out";
2083
- if (bookingLeft === 0)
2084
- timeStatus = "sold_out";
2085
- else if (isMultipleBooking) {
2086
- if (summaryConfigCount === 0)
2087
- timeStatus = "sold_out";
2088
- else {
2089
- const usageRatio = summaryCount / summaryConfigCount;
2090
- if (usageRatio > 0.5)
2091
- timeStatus = "lots_of_space";
2092
- else if (summaryCount > 0)
2093
- timeStatus = "filling_up_fast";
2094
- else
2095
- timeStatus = "sold_out";
2145
+ let bottleneckResourceTypeId;
2146
+ let bottleneckValue = Infinity;
2147
+ enabledResourceTypeConfigs.forEach((cfg) => {
2148
+ const stats = statsByResourceType[cfg.id] || {
2149
+ count: 0,
2150
+ left: 0,
2151
+ summaryCount: 0,
2152
+ summaryConfigCount: 0
2153
+ };
2154
+ const value = cfg.type === "multiple" ? stats.summaryCount : stats.left;
2155
+ if (value < bottleneckValue) {
2156
+ bottleneckValue = value;
2157
+ bottleneckResourceTypeId = cfg.id;
2096
2158
  }
2159
+ });
2160
+ const bottleneckStats = bottleneckResourceTypeId !== void 0 ? statsByResourceType[bottleneckResourceTypeId] || {
2161
+ count: 0,
2162
+ left: 0,
2163
+ summaryCount: 0,
2164
+ summaryConfigCount: 0
2165
+ } : { count: 0, left: 0, summaryCount: 0, summaryConfigCount: 0 };
2166
+ const bottleneckConfig = bottleneckResourceTypeId !== void 0 ? resourceTypeConfigById.get(bottleneckResourceTypeId) : void 0;
2167
+ let status = "sold_out";
2168
+ if (bottleneckStats.left === 0)
2169
+ status = "sold_out";
2170
+ else if (!bottleneckConfig || bottleneckStats.summaryConfigCount === 0)
2171
+ status = "sold_out";
2172
+ else if (bottleneckConfig.type === "multiple") {
2173
+ const usageRatio = bottleneckStats.summaryCount / bottleneckStats.summaryConfigCount;
2174
+ if (usageRatio > 0.5)
2175
+ status = "lots_of_space";
2176
+ else if (bottleneckStats.summaryCount > 0)
2177
+ status = "filling_up_fast";
2178
+ else
2179
+ status = "sold_out";
2097
2180
  } else {
2098
- if (summaryConfigCount === 0)
2099
- timeStatus = "sold_out";
2100
- else {
2101
- const usageRatio = bookingLeft / summaryConfigCount;
2102
- if (usageRatio > 0.5)
2103
- timeStatus = "lots_of_space";
2104
- else if (count > 0)
2105
- timeStatus = "filling_up_fast";
2106
- else
2107
- timeStatus = "sold_out";
2108
- }
2181
+ const usageRatio = bottleneckStats.left / bottleneckStats.summaryConfigCount;
2182
+ if (usageRatio > 0.5)
2183
+ status = "lots_of_space";
2184
+ else if (bottleneckStats.count > 0)
2185
+ status = "filling_up_fast";
2186
+ else
2187
+ status = "sold_out";
2109
2188
  }
2110
2189
  return {
2111
2190
  start_time: startDayJs.format("HH:mm"),
2112
2191
  end_time: endDayJs.format("HH:mm"),
2113
2192
  start_at: startDayJs,
2114
2193
  end_at: endDayJs,
2115
- count,
2116
- left: bookingLeft,
2117
- summaryCount,
2118
- status: timeStatus
2194
+ count: bottleneckStats.count,
2195
+ left: bottleneckStats.left,
2196
+ summaryCount: bottleneckStats.summaryCount,
2197
+ status
2119
2198
  };
2120
2199
  });
2121
2200
  return formatScheduleTimeSlots;
@@ -2873,7 +2952,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
2873
2952
  const openResources = ((_d = (_c = tempProducts == null ? void 0 : tempProducts.product_resource) == null ? void 0 : _c.resources) == null ? void 0 : _d.filter(
2874
2953
  (m) => m.status === 1
2875
2954
  )) || [];
2876
- const allProductResources = (0, import_resources.sortCombinedResources)(res.data);
2955
+ const allProductResources = (0, import_lodash_es.cloneDeep)((0, import_resources.sortCombinedResources)(res.data) || []);
2877
2956
  allProductResources.forEach((m) => {
2878
2957
  var _a2, _b2;
2879
2958
  const resource = (_b2 = (_a2 = tempProducts == null ? void 0 : tempProducts.product_resource) == null ? void 0 : _a2.resources) == null ? void 0 : _b2.find(
@@ -2920,9 +2999,27 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
2920
2999
  const resourcesUseableMap = {};
2921
3000
  let isAllResourceTypesUseable = true;
2922
3001
  openResources.forEach((resource) => {
3002
+ var _a2;
2923
3003
  const currentResourcesList = allProductResources.filter(
2924
3004
  (n) => n.form_id === resource.resource_type_id
2925
3005
  );
3006
+ (_a2 = resource.renderList) == null ? void 0 : _a2.forEach((item2) => {
3007
+ if (item2.onlyComputed) {
3008
+ const targetIndex = currentResourcesList.findIndex((n) => n.id === item2.id);
3009
+ if (targetIndex && targetIndex !== -1) {
3010
+ currentResourcesList[targetIndex].onlyComputed = true;
3011
+ }
3012
+ }
3013
+ });
3014
+ currentResourcesList.forEach((item2) => {
3015
+ var _a3, _b2;
3016
+ if (!((_a3 = resource.optional_resource) == null ? void 0 : _a3.includes(item2.id)) && !((_b2 = resource.default_resource) == null ? void 0 : _b2.includes(item2.id))) {
3017
+ item2.onlyComputed = true;
3018
+ }
3019
+ });
3020
+ currentResourcesList.sort((a, b) => {
3021
+ return a.onlyComputed ? -1 : 1;
3022
+ });
2926
3023
  let isAnyResourceUseableInType = false;
2927
3024
  currentResourcesList == null ? void 0 : currentResourcesList.forEach((m) => {
2928
3025
  const mTimes = m.times.filter((n) => {
@@ -2930,10 +3027,12 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
2930
3027
  });
2931
3028
  if (mTimes.length === 0)
2932
3029
  return;
2933
- if (resource.type === "multiple") {
2934
- summaryCount += m.capacity;
2935
- } else {
2936
- summaryCount += 1;
3030
+ if (!m.onlyComputed) {
3031
+ if (resource.type === "multiple") {
3032
+ summaryCount += m.capacity;
3033
+ } else {
3034
+ summaryCount += 1;
3035
+ }
2937
3036
  }
2938
3037
  let isAnyTimeSliceUseable = false;
2939
3038
  mTimes.forEach((childTiem) => {
@@ -469,7 +469,8 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
469
469
  action: "create",
470
470
  with_good_pass: 1,
471
471
  with_discount_card: 1,
472
- with_wallet_pass_holder: 1
472
+ with_wallet_pass_holder: 1,
473
+ request_timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
473
474
  }));
474
475
  const scanDiscount = (_c = this.getDiscountList()) == null ? void 0 : _c.filter(
475
476
  (item) => item.isScan
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "3.0.78",
4
+ "version": "3.0.79",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",