@thezelijah/majik-subscription 1.0.0 → 1.0.1
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MajikMoney } from "@thezelijah/majik-money";
|
|
2
2
|
import { COSItem, ISODateString, MonthlyCapacity, ObjectType, StartDateInput, SubscriptionID, SubscriptionMetadata, SubscriptionRate, SubscriptionSettings, YYYYMM } from "./types";
|
|
3
|
-
import { CapacityPeriodResizeMode, RateUnit, SubscriptionStatus, SubscriptionType } from "./enums";
|
|
3
|
+
import { BillingCycle, CapacityPeriodResizeMode, RateUnit, SubscriptionStatus, SubscriptionType } from "./enums";
|
|
4
4
|
/**
|
|
5
5
|
* Represents a subscription in the Majik system.
|
|
6
6
|
* Handles metadata, capacity, COS, and finance calculations (revenue, COS, profit, margins) for recurring subscriptions.
|
|
@@ -70,6 +70,12 @@ export declare class MajikSubscription {
|
|
|
70
70
|
* @throws Will throw an error if amount is non-positive.
|
|
71
71
|
*/
|
|
72
72
|
setRateAmount(amount: number): this;
|
|
73
|
+
/**
|
|
74
|
+
* Updates the billing cycle.
|
|
75
|
+
* @param {BillingCycle} cycle - New billing cycle (e.g., monthly, quarterly). use Enum `BillingCycle`.
|
|
76
|
+
* @returns {MajikSubscription} - Returns self for chaining.
|
|
77
|
+
*/
|
|
78
|
+
setBillingCycle(cycle: BillingCycle): this;
|
|
73
79
|
/**
|
|
74
80
|
* Updates the subscription category.
|
|
75
81
|
* @param {string} category - New category name.
|
|
@@ -138,6 +138,18 @@ class MajikSubscription {
|
|
|
138
138
|
this.markFinanceDirty();
|
|
139
139
|
return this;
|
|
140
140
|
}
|
|
141
|
+
/**
|
|
142
|
+
* Updates the billing cycle.
|
|
143
|
+
* @param {BillingCycle} cycle - New billing cycle (e.g., monthly, quarterly). use Enum `BillingCycle`.
|
|
144
|
+
* @returns {MajikSubscription} - Returns self for chaining.
|
|
145
|
+
*/
|
|
146
|
+
setBillingCycle(cycle) {
|
|
147
|
+
this.rate.billingCycle = cycle;
|
|
148
|
+
this.metadata.rate.billingCycle = cycle;
|
|
149
|
+
this.updateTimestamp();
|
|
150
|
+
this.markFinanceDirty();
|
|
151
|
+
return this;
|
|
152
|
+
}
|
|
141
153
|
/**
|
|
142
154
|
* Updates the subscription category.
|
|
143
155
|
* @param {string} category - New category name.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thezelijah/majik-subscription",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Majik Subscription is a fully-featured class representing a subscription-based offering in the Majik system, designed for recurring revenue modeling, cost tracking, and subscriber capacity planning. It provides utilities for computing MRR, ARR, revenue, profit, margins, Cost of Subscription (COS), and net income on a per-period basis. Chainable setter methods make it easy to construct and update subscriptions fluently.",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "Zelijah",
|