@munchi_oy/license-sdk 0.2.1 → 0.3.0

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/dist/index.cjs CHANGED
@@ -21,10 +21,36 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  // src/index.ts
22
22
  var index_exports = {};
23
23
  __export(index_exports, {
24
- LicenseClient: () => LicenseClient
24
+ LicenseClient: () => LicenseClient,
25
+ PLANS: () => PLANS,
26
+ PRODUCTS: () => PRODUCTS,
27
+ USAGE_METRICS: () => USAGE_METRICS,
28
+ USAGE_METRIC_NAMES: () => USAGE_METRIC_NAMES
25
29
  });
26
30
  module.exports = __toCommonJS(index_exports);
27
31
 
32
+ // ../license-core/src/catalog/products.ts
33
+ var PRODUCTS = {
34
+ start: "MUN-START",
35
+ one: "MUN-ONE",
36
+ kiosk: "MUN-ADD-KIOSK",
37
+ mobileApp: "MUN-ADD-APP",
38
+ mobileAppSetup: "MUN-SETUP-APP",
39
+ sms: "MUN-SMS",
40
+ loyaltyOverage: "MUN-OVR-LOYALTY"
41
+ };
42
+ var PLANS = [
43
+ PRODUCTS.start,
44
+ PRODUCTS.one
45
+ ];
46
+
47
+ // ../license-core/src/usage-metrics.ts
48
+ var USAGE_METRICS = {
49
+ sms: "sum",
50
+ loyaltyMembers: "peak"
51
+ };
52
+ var USAGE_METRIC_NAMES = Object.keys(USAGE_METRICS);
53
+
28
54
  // src/license-client.ts
29
55
  var UNREACHABLE = /* @__PURE__ */ Symbol("unreachable");
30
56
  var LicenseClient = class {
@@ -165,5 +191,9 @@ var LicenseClient = class {
165
191
  };
166
192
  // Annotate the CommonJS export names for ESM import in node:
167
193
  0 && (module.exports = {
168
- LicenseClient
194
+ LicenseClient,
195
+ PLANS,
196
+ PRODUCTS,
197
+ USAGE_METRICS,
198
+ USAGE_METRIC_NAMES
169
199
  });
package/dist/index.d.cts CHANGED
@@ -1,3 +1,33 @@
1
+ /**
2
+ * Munchi's product codes, for code that names one (apps, the dashboard). Codes are immutable and
3
+ * never reused; a catalog may still carry products added later, so this is not the full list.
4
+ */
5
+ declare const PRODUCTS: {
6
+ readonly start: "MUN-START";
7
+ readonly one: "MUN-ONE";
8
+ readonly kiosk: "MUN-ADD-KIOSK";
9
+ readonly mobileApp: "MUN-ADD-APP";
10
+ readonly mobileAppSetup: "MUN-SETUP-APP";
11
+ readonly sms: "MUN-SMS";
12
+ readonly loyaltyOverage: "MUN-OVR-LOYALTY";
13
+ };
14
+ type KnownProductCode = (typeof PRODUCTS)[keyof typeof PRODUCTS];
15
+ /** The plans, cheapest first. */
16
+ declare const PLANS: readonly ["MUN-START", "MUN-ONE"];
17
+ type PlanCode = (typeof PLANS)[number];
18
+
19
+ /**
20
+ * What the apps report and the monthly bill can charge for: reminder SMS segments sent (added
21
+ * up), and loyalty members (the month's highest count, since Start includes 150 and each one
22
+ * above is charged once a month). A new billable usage is added here first.
23
+ */
24
+ declare const USAGE_METRICS: {
25
+ readonly sms: "sum";
26
+ readonly loyaltyMembers: "peak";
27
+ };
28
+ type UsageMetric = keyof typeof USAGE_METRICS;
29
+ declare const USAGE_METRIC_NAMES: [UsageMetric, ...UsageMetric[]];
30
+
1
31
  type ProductCode = string;
2
32
  type FeatureCode = string;
3
33
 
@@ -5,7 +35,8 @@ type LicenseState = "trial" | "active" | "grace" | "start" | "suspended" | "term
5
35
  type PaymentMethodStatus = "ok" | "missing" | "failing";
6
36
  type PaymentsMode = "munchi" | "external";
7
37
  type PaymentsStatus = "not_started" | "submitted" | "pre_check" | "in_review" | "action_required" | "approved" | "live" | "rejected" | "restricted";
8
- type SuspensionReason = "misconduct" | "fraud_suspected" | "chargebacks" | "legal_request" | "terms_breach" | "customer_request" | "other";
38
+ declare const SUSPENSION_REASONS: readonly ["misconduct", "fraud_suspected", "chargebacks", "legal_request", "terms_breach", "customer_request", "trial_ended", "payment_overdue", "other"];
39
+ type SuspensionReason = (typeof SUSPENSION_REASONS)[number];
9
40
  interface Suspension {
10
41
  reason: SuspensionReason;
11
42
  mode: "read_only" | "off";
@@ -135,4 +166,4 @@ declare class LicenseClient {
135
166
  private report;
136
167
  }
137
168
 
138
- export { type DeniedEvent, LicenseClient, type LicenseClientOptions, type Snapshot };
169
+ export { type DeniedEvent, type KnownProductCode, LicenseClient, type LicenseClientOptions, PLANS, PRODUCTS, type PlanCode, type Snapshot, USAGE_METRICS, USAGE_METRIC_NAMES, type UsageMetric };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,33 @@
1
+ /**
2
+ * Munchi's product codes, for code that names one (apps, the dashboard). Codes are immutable and
3
+ * never reused; a catalog may still carry products added later, so this is not the full list.
4
+ */
5
+ declare const PRODUCTS: {
6
+ readonly start: "MUN-START";
7
+ readonly one: "MUN-ONE";
8
+ readonly kiosk: "MUN-ADD-KIOSK";
9
+ readonly mobileApp: "MUN-ADD-APP";
10
+ readonly mobileAppSetup: "MUN-SETUP-APP";
11
+ readonly sms: "MUN-SMS";
12
+ readonly loyaltyOverage: "MUN-OVR-LOYALTY";
13
+ };
14
+ type KnownProductCode = (typeof PRODUCTS)[keyof typeof PRODUCTS];
15
+ /** The plans, cheapest first. */
16
+ declare const PLANS: readonly ["MUN-START", "MUN-ONE"];
17
+ type PlanCode = (typeof PLANS)[number];
18
+
19
+ /**
20
+ * What the apps report and the monthly bill can charge for: reminder SMS segments sent (added
21
+ * up), and loyalty members (the month's highest count, since Start includes 150 and each one
22
+ * above is charged once a month). A new billable usage is added here first.
23
+ */
24
+ declare const USAGE_METRICS: {
25
+ readonly sms: "sum";
26
+ readonly loyaltyMembers: "peak";
27
+ };
28
+ type UsageMetric = keyof typeof USAGE_METRICS;
29
+ declare const USAGE_METRIC_NAMES: [UsageMetric, ...UsageMetric[]];
30
+
1
31
  type ProductCode = string;
2
32
  type FeatureCode = string;
3
33
 
@@ -5,7 +35,8 @@ type LicenseState = "trial" | "active" | "grace" | "start" | "suspended" | "term
5
35
  type PaymentMethodStatus = "ok" | "missing" | "failing";
6
36
  type PaymentsMode = "munchi" | "external";
7
37
  type PaymentsStatus = "not_started" | "submitted" | "pre_check" | "in_review" | "action_required" | "approved" | "live" | "rejected" | "restricted";
8
- type SuspensionReason = "misconduct" | "fraud_suspected" | "chargebacks" | "legal_request" | "terms_breach" | "customer_request" | "other";
38
+ declare const SUSPENSION_REASONS: readonly ["misconduct", "fraud_suspected", "chargebacks", "legal_request", "terms_breach", "customer_request", "trial_ended", "payment_overdue", "other"];
39
+ type SuspensionReason = (typeof SUSPENSION_REASONS)[number];
9
40
  interface Suspension {
10
41
  reason: SuspensionReason;
11
42
  mode: "read_only" | "off";
@@ -135,4 +166,4 @@ declare class LicenseClient {
135
166
  private report;
136
167
  }
137
168
 
138
- export { type DeniedEvent, LicenseClient, type LicenseClientOptions, type Snapshot };
169
+ export { type DeniedEvent, type KnownProductCode, LicenseClient, type LicenseClientOptions, PLANS, PRODUCTS, type PlanCode, type Snapshot, USAGE_METRICS, USAGE_METRIC_NAMES, type UsageMetric };
package/dist/index.js CHANGED
@@ -1,6 +1,28 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
3
 
4
+ // ../license-core/src/catalog/products.ts
5
+ var PRODUCTS = {
6
+ start: "MUN-START",
7
+ one: "MUN-ONE",
8
+ kiosk: "MUN-ADD-KIOSK",
9
+ mobileApp: "MUN-ADD-APP",
10
+ mobileAppSetup: "MUN-SETUP-APP",
11
+ sms: "MUN-SMS",
12
+ loyaltyOverage: "MUN-OVR-LOYALTY"
13
+ };
14
+ var PLANS = [
15
+ PRODUCTS.start,
16
+ PRODUCTS.one
17
+ ];
18
+
19
+ // ../license-core/src/usage-metrics.ts
20
+ var USAGE_METRICS = {
21
+ sms: "sum",
22
+ loyaltyMembers: "peak"
23
+ };
24
+ var USAGE_METRIC_NAMES = Object.keys(USAGE_METRICS);
25
+
4
26
  // src/license-client.ts
5
27
  var UNREACHABLE = /* @__PURE__ */ Symbol("unreachable");
6
28
  var LicenseClient = class {
@@ -140,5 +162,9 @@ var LicenseClient = class {
140
162
  }
141
163
  };
142
164
  export {
143
- LicenseClient
165
+ LicenseClient,
166
+ PLANS,
167
+ PRODUCTS,
168
+ USAGE_METRICS,
169
+ USAGE_METRIC_NAMES
144
170
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@munchi_oy/license-sdk",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "Client for the Munchi license service: cached entitlements and feature checks per venue",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",