@tagadapay/plugin-sdk 2.4.8 → 2.4.9

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.
@@ -152,6 +152,12 @@ export const useShippingRates = ({ onSuccess, checkout } = {}) => {
152
152
  if (!exists) {
153
153
  // Find the cheapest shipping rate and select it
154
154
  const cheapest = shippingRates.reduce((min, rate) => {
155
+ // Prioritize isFree rates first
156
+ if (rate.isFree && !min.isFree)
157
+ return rate;
158
+ if (!rate.isFree && min.isFree)
159
+ return min;
160
+ // If both are free or both are not free, compare by amount
155
161
  return rate.amount < min.amount ? rate : min;
156
162
  }, shippingRates[0]);
157
163
  handleSelectRate(cheapest.id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tagadapay/plugin-sdk",
3
- "version": "2.4.8",
3
+ "version": "2.4.9",
4
4
  "description": "Modern React SDK for building Tagada Pay plugins",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",