@goweekdays/core 2.11.3 → 2.11.4
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/CHANGELOG.md +6 -0
- package/dist/index.js +13 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -8421,16 +8421,25 @@ function useSubscriptionService() {
|
|
|
8421
8421
|
}
|
|
8422
8422
|
}
|
|
8423
8423
|
const isDecrease = existingSubscription && value.seats < existingSubscription.paidSeats;
|
|
8424
|
+
const isNoChange = existingSubscription && value.seats === existingSubscription.paidSeats;
|
|
8425
|
+
const isIncrease = existingSubscription && value.seats > existingSubscription.paidSeats;
|
|
8426
|
+
let subscriptionAmount;
|
|
8427
|
+
if (!existingSubscription) {
|
|
8428
|
+
subscriptionAmount = Math.round(monthlyAmount * 100) / 100;
|
|
8429
|
+
} else if (proratedAmount > 0) {
|
|
8430
|
+
subscriptionAmount = Math.round((existingSubscription.amount + proratedAmount) * 100) / 100;
|
|
8431
|
+
} else if (isIncrease) {
|
|
8432
|
+
subscriptionAmount = Math.round(monthlyAmount * 100) / 100;
|
|
8433
|
+
} else {
|
|
8434
|
+
subscriptionAmount = Math.round(existingSubscription.amount * 100) / 100;
|
|
8435
|
+
}
|
|
8424
8436
|
return {
|
|
8425
8437
|
// The monthly fee for the next billing cycle
|
|
8426
8438
|
monthlyAmount: Math.round(monthlyAmount * 100) / 100,
|
|
8427
8439
|
// The prorated amount to charge now for mid-cycle seat additions
|
|
8428
8440
|
proratedAmount: Math.round(proratedAmount * 100) / 100,
|
|
8429
8441
|
// The new subscription.amount for updates
|
|
8430
|
-
|
|
8431
|
-
// - Seat decrease: keep existing amount (decrease takes effect next cycle)
|
|
8432
|
-
// - Same day change or no proration: use monthlyAmount
|
|
8433
|
-
subscriptionAmount: existingSubscription ? proratedAmount > 0 ? Math.round((existingSubscription.amount + proratedAmount) * 100) / 100 : isDecrease ? Math.round(existingSubscription.amount * 100) / 100 : Math.round(monthlyAmount * 100) / 100 : Math.round(monthlyAmount * 100) / 100,
|
|
8442
|
+
subscriptionAmount,
|
|
8434
8443
|
currency: plan.currency
|
|
8435
8444
|
};
|
|
8436
8445
|
}
|