@reactionary/feeds 0.10.45 → 0.10.47

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 (2) hide show
  1. package/cli.cjs +21 -5
  2. package/package.json +9 -9
package/cli.cjs CHANGED
@@ -113404,7 +113404,7 @@ var init_order_search_factory2 = __esm({
113404
113404
  pageNumber: (Math.ceil(data.offset / data.limit) || 0) + 1,
113405
113405
  pageSize: data.limit,
113406
113406
  totalCount: data.total || 0,
113407
- totalPages: Math.ceil((data.total || 0) / data.limit || 0) + 1,
113407
+ totalPages: data.limit > 0 ? Math.ceil((data.total || 0) / data.limit) : 0,
113408
113408
  items: data.results.map((order) => this.parseOrderSearchItem(context2, order))
113409
113409
  };
113410
113410
  return this.orderSearchResultSchema.parse(result);
@@ -113920,7 +113920,7 @@ var init_product_search_factory3 = __esm({
113920
113920
  pageNumber: (Math.ceil(data.offset / data.limit) || 0) + 1,
113921
113921
  pageSize: data.limit,
113922
113922
  totalCount: data.total || 0,
113923
- totalPages: Math.ceil((data.total || 0) / data.limit || 0) + 1,
113923
+ totalPages: data.limit > 0 ? Math.ceil((data.total || 0) / data.limit) : 0,
113924
113924
  items,
113925
113925
  facets
113926
113926
  };
@@ -138469,6 +138469,22 @@ var init_checkout_capability5 = __esm({
138469
138469
  cart_id: payload.checkout.key
138470
138470
  };
138471
138471
  }
138472
+ /**
138473
+ * Whether a Medusa shipping option's calculated price is usable, i.e. has an
138474
+ * actual amount (which may be `0` for valid free shipping) rather than no
138475
+ * price data at all. `calculated_amount`/`original_amount` are `number | null`;
138476
+ * checking them with a plain falsy check would incorrectly treat a `0` amount
138477
+ * (free shipping) the same as a missing price and drop the option.
138478
+ *
138479
+ * Override this if a project needs different rules for which shipping
138480
+ * options are considered usable.
138481
+ */
138482
+ hasUsableShippingPrice(calculatedPrice) {
138483
+ if (!calculatedPrice) {
138484
+ return false;
138485
+ }
138486
+ return calculatedPrice.calculated_amount != null || calculatedPrice.original_amount != null;
138487
+ }
138472
138488
  async getAvailableShippingMethods(payload) {
138473
138489
  const client = await this.medusaApi.getClient();
138474
138490
  if (debug23.enabled) {
@@ -138503,7 +138519,7 @@ var init_checkout_capability5 = __esm({
138503
138519
  }
138504
138520
  }
138505
138521
  for (const sm of shippingMethodResponse.shipping_options) {
138506
- if (!sm.calculated_price || !sm.calculated_price.calculated_amount && !sm.calculated_price.original_amount) {
138522
+ if (!this.hasUsableShippingPrice(sm.calculated_price)) {
138507
138523
  console.warn(`Skipping shipping method ${sm.name}/${sm.provider.id} because it has no calculated price for checkout ${payload.checkout.key}`);
138508
138524
  continue;
138509
138525
  }
@@ -162274,7 +162290,7 @@ var init_order_search_factory5 = __esm({
162274
162290
  pageNumber: (Math.ceil(data.offset / data.limit) || 0) + 1,
162275
162291
  pageSize: data.limit,
162276
162292
  totalCount: data.count,
162277
- totalPages: Math.ceil(data.count / data.limit || 0) + 1,
162293
+ totalPages: Math.ceil(data.count / data.limit || 0),
162278
162294
  items: orders
162279
162295
  };
162280
162296
  return this.orderSearchResultSchema.parse(result);
@@ -162616,7 +162632,7 @@ var init_product_search_factory6 = __esm({
162616
162632
  pageNumber: (Math.ceil(remote.offset / remote.limit) || 0) + 1,
162617
162633
  pageSize: remote.limit,
162618
162634
  totalCount: remote.count,
162619
- totalPages: Math.ceil(remote.count / remote.limit || 0) + 1,
162635
+ totalPages: Math.ceil(remote.count / remote.limit || 0),
162620
162636
  items: products,
162621
162637
  facets: []
162622
162638
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reactionary/feeds",
3
- "version": "0.10.45",
3
+ "version": "0.10.47",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "types": "./src/index.d.ts",
@@ -12,14 +12,14 @@
12
12
  "url": "git+https://github.com/Solteq/reactionary.git"
13
13
  },
14
14
  "dependencies": {
15
- "@reactionary/algolia": "0.10.45",
16
- "@reactionary/commercetools": "0.10.45",
17
- "@reactionary/core": "0.10.45",
18
- "@reactionary/fake": "0.10.45",
19
- "@reactionary/magento": "0.10.45",
20
- "@reactionary/medusa": "0.10.45",
21
- "@reactionary/meilisearch": "0.10.45",
22
- "@reactionary/unomi": "0.10.45",
15
+ "@reactionary/algolia": "0.10.47",
16
+ "@reactionary/commercetools": "0.10.47",
17
+ "@reactionary/core": "0.10.47",
18
+ "@reactionary/fake": "0.10.47",
19
+ "@reactionary/magento": "0.10.47",
20
+ "@reactionary/medusa": "0.10.47",
21
+ "@reactionary/meilisearch": "0.10.47",
22
+ "@reactionary/unomi": "0.10.47",
23
23
  "commander": "^15.0.0",
24
24
  "dotenv": "^17.2.2",
25
25
  "sitemap": "^9.0.1",