feeef 0.7.1 → 0.7.3

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.
package/build/index.js CHANGED
@@ -1581,13 +1581,13 @@ function getAvailableShippingTypes(prices, countryCode, stateCode) {
1581
1581
  const stateRates = countryRates[stateCode];
1582
1582
  if (!stateRates) return [];
1583
1583
  const available = [];
1584
- if (stateRates.home !== null) {
1584
+ if (stateRates.home !== null && stateRates.home !== void 0 && Number.isFinite(stateRates.home)) {
1585
1585
  available.push({ type: "home", price: stateRates.home });
1586
1586
  }
1587
- if (stateRates.desk !== null) {
1587
+ if (stateRates.desk !== null && stateRates.desk !== void 0 && Number.isFinite(stateRates.desk)) {
1588
1588
  available.push({ type: "desk", price: stateRates.desk });
1589
1589
  }
1590
- if (stateRates.pickup !== null) {
1590
+ if (stateRates.pickup !== null && stateRates.pickup !== void 0 && Number.isFinite(stateRates.pickup)) {
1591
1591
  available.push({ type: "pickup", price: stateRates.pickup });
1592
1592
  }
1593
1593
  return available;
@@ -2053,14 +2053,15 @@ var CartService = class extends NotifiableService {
2053
2053
  * @param shippingType - The shipping type enum.
2054
2054
  * @returns The corresponding shipping price type.
2055
2055
  */
2056
+ /** Maps order ShippingType to shipping price key. store = pickup (from store), pickup = desk (from relay/desk). */
2056
2057
  mapShippingTypeToPriceType(shippingType) {
2057
2058
  switch (shippingType) {
2058
2059
  case "home" /* home */:
2059
2060
  return "home";
2060
2061
  case "pickup" /* pickup */:
2061
- return "pickup";
2062
- case "store" /* store */:
2063
2062
  return "desk";
2063
+ case "store" /* store */:
2064
+ return "pickup";
2064
2065
  default:
2065
2066
  return "home";
2066
2067
  }
@@ -2175,8 +2176,9 @@ var CartService = class extends NotifiableService {
2175
2176
  *
2176
2177
  * Note: Shipping prices must be loaded and set via setShippingPrice() for the new system to work.
2177
2178
  * If shipping prices are not loaded, the method falls back to the legacy system.
2179
+ * In the new system: price key "desk" → ShippingType.pickup, price key "pickup" → ShippingType.store.
2178
2180
  *
2179
- * @returns An array of available shipping types.
2181
+ * @returns An array of available shipping types. With prices e.g. { desk: 550, home: 800, pickup: null }, returns [home, pickup].
2180
2182
  */
2181
2183
  getAvailableShippingTypes() {
2182
2184
  if (!this.shippingAddress.state) return [];
@@ -2207,9 +2209,9 @@ var CartService = class extends NotifiableService {
2207
2209
  switch (a.type) {
2208
2210
  case "home":
2209
2211
  return "home" /* home */;
2210
- case "pickup":
2211
- return "pickup" /* pickup */;
2212
2212
  case "desk":
2213
+ return "pickup" /* pickup */;
2214
+ case "pickup":
2213
2215
  return "store" /* store */;
2214
2216
  default:
2215
2217
  return "home" /* home */;
@@ -2230,9 +2232,9 @@ var CartService = class extends NotifiableService {
2230
2232
  switch (a.type) {
2231
2233
  case "home":
2232
2234
  return "home" /* home */;
2233
- case "pickup":
2234
- return "pickup" /* pickup */;
2235
2235
  case "desk":
2236
+ return "pickup" /* pickup */;
2237
+ case "pickup":
2236
2238
  return "store" /* store */;
2237
2239
  default:
2238
2240
  return "home" /* home */;