@munchi_oy/license-sdk 0.2.1 → 0.4.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/README.md +2 -0
- package/dist/index.cjs +41 -2
- package/dist/index.d.cts +41 -2
- package/dist/index.d.ts +41 -2
- package/dist/index.js +35 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -30,3 +30,5 @@ const snapshot = await license.entitlements(venueId); // full snapshot, null = u
|
|
|
30
30
|
| `mode: "enforce"` | `can()` returns `false` for features the venue doesn't have, or while it is suspended |
|
|
31
31
|
|
|
32
32
|
Call `invalidate(venueId)` when you receive a `license.changed` event.
|
|
33
|
+
|
|
34
|
+
It also exports the shared names: `PRODUCTS` and `PLANS` (catalog codes), `USAGE_METRICS` (what usage can cost money) and `REQUESTABLE_PRODUCTS` (what a store asks Munchi for in the dashboard: `ari`, `business_account`, `capital`).
|
package/dist/index.cjs
CHANGED
|
@@ -21,10 +21,44 @@ 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
|
+
REQUESTABLE_PRODUCTS: () => REQUESTABLE_PRODUCTS,
|
|
28
|
+
USAGE_METRICS: () => USAGE_METRICS,
|
|
29
|
+
USAGE_METRIC_NAMES: () => USAGE_METRIC_NAMES
|
|
25
30
|
});
|
|
26
31
|
module.exports = __toCommonJS(index_exports);
|
|
27
32
|
|
|
33
|
+
// ../license-core/src/catalog/products.ts
|
|
34
|
+
var PRODUCTS = {
|
|
35
|
+
start: "MUN-START",
|
|
36
|
+
one: "MUN-ONE",
|
|
37
|
+
kiosk: "MUN-ADD-KIOSK",
|
|
38
|
+
mobileApp: "MUN-ADD-APP",
|
|
39
|
+
mobileAppSetup: "MUN-SETUP-APP",
|
|
40
|
+
sms: "MUN-SMS",
|
|
41
|
+
loyaltyOverage: "MUN-OVR-LOYALTY"
|
|
42
|
+
};
|
|
43
|
+
var PLANS = [
|
|
44
|
+
PRODUCTS.start,
|
|
45
|
+
PRODUCTS.one
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
// ../license-core/src/requestable-products.ts
|
|
49
|
+
var REQUESTABLE_PRODUCTS = [
|
|
50
|
+
"ari",
|
|
51
|
+
"business_account",
|
|
52
|
+
"capital"
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
// ../license-core/src/usage-metrics.ts
|
|
56
|
+
var USAGE_METRICS = {
|
|
57
|
+
sms: "sum",
|
|
58
|
+
loyaltyMembers: "peak"
|
|
59
|
+
};
|
|
60
|
+
var USAGE_METRIC_NAMES = Object.keys(USAGE_METRICS);
|
|
61
|
+
|
|
28
62
|
// src/license-client.ts
|
|
29
63
|
var UNREACHABLE = /* @__PURE__ */ Symbol("unreachable");
|
|
30
64
|
var LicenseClient = class {
|
|
@@ -165,5 +199,10 @@ var LicenseClient = class {
|
|
|
165
199
|
};
|
|
166
200
|
// Annotate the CommonJS export names for ESM import in node:
|
|
167
201
|
0 && (module.exports = {
|
|
168
|
-
LicenseClient
|
|
202
|
+
LicenseClient,
|
|
203
|
+
PLANS,
|
|
204
|
+
PRODUCTS,
|
|
205
|
+
REQUESTABLE_PRODUCTS,
|
|
206
|
+
USAGE_METRICS,
|
|
207
|
+
USAGE_METRIC_NAMES
|
|
169
208
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,3 +1,41 @@
|
|
|
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
|
+
* Products a store asks Munchi for in the dashboard because they can't be bought online
|
|
21
|
+
* (ADR 0022). These are the dashboard's product ids, not catalog codes (`MUN-*`); the mobile app
|
|
22
|
+
* has its own request flow (ADR 0021). A new one is added here first.
|
|
23
|
+
*/
|
|
24
|
+
declare const REQUESTABLE_PRODUCTS: readonly ["ari", "business_account", "capital"];
|
|
25
|
+
type RequestableProduct = (typeof REQUESTABLE_PRODUCTS)[number];
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* What the apps report and the monthly bill can charge for: reminder SMS segments sent (added
|
|
29
|
+
* up), and loyalty members (the month's highest count, since Start includes 150 and each one
|
|
30
|
+
* above is charged once a month). A new billable usage is added here first.
|
|
31
|
+
*/
|
|
32
|
+
declare const USAGE_METRICS: {
|
|
33
|
+
readonly sms: "sum";
|
|
34
|
+
readonly loyaltyMembers: "peak";
|
|
35
|
+
};
|
|
36
|
+
type UsageMetric = keyof typeof USAGE_METRICS;
|
|
37
|
+
declare const USAGE_METRIC_NAMES: [UsageMetric, ...UsageMetric[]];
|
|
38
|
+
|
|
1
39
|
type ProductCode = string;
|
|
2
40
|
type FeatureCode = string;
|
|
3
41
|
|
|
@@ -5,7 +43,8 @@ type LicenseState = "trial" | "active" | "grace" | "start" | "suspended" | "term
|
|
|
5
43
|
type PaymentMethodStatus = "ok" | "missing" | "failing";
|
|
6
44
|
type PaymentsMode = "munchi" | "external";
|
|
7
45
|
type PaymentsStatus = "not_started" | "submitted" | "pre_check" | "in_review" | "action_required" | "approved" | "live" | "rejected" | "restricted";
|
|
8
|
-
|
|
46
|
+
declare const SUSPENSION_REASONS: readonly ["misconduct", "fraud_suspected", "chargebacks", "legal_request", "terms_breach", "customer_request", "trial_ended", "payment_overdue", "other"];
|
|
47
|
+
type SuspensionReason = (typeof SUSPENSION_REASONS)[number];
|
|
9
48
|
interface Suspension {
|
|
10
49
|
reason: SuspensionReason;
|
|
11
50
|
mode: "read_only" | "off";
|
|
@@ -135,4 +174,4 @@ declare class LicenseClient {
|
|
|
135
174
|
private report;
|
|
136
175
|
}
|
|
137
176
|
|
|
138
|
-
export { type DeniedEvent, LicenseClient, type LicenseClientOptions, type Snapshot };
|
|
177
|
+
export { type DeniedEvent, type KnownProductCode, LicenseClient, type LicenseClientOptions, PLANS, PRODUCTS, type PlanCode, REQUESTABLE_PRODUCTS, type RequestableProduct, type Snapshot, USAGE_METRICS, USAGE_METRIC_NAMES, type UsageMetric };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,41 @@
|
|
|
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
|
+
* Products a store asks Munchi for in the dashboard because they can't be bought online
|
|
21
|
+
* (ADR 0022). These are the dashboard's product ids, not catalog codes (`MUN-*`); the mobile app
|
|
22
|
+
* has its own request flow (ADR 0021). A new one is added here first.
|
|
23
|
+
*/
|
|
24
|
+
declare const REQUESTABLE_PRODUCTS: readonly ["ari", "business_account", "capital"];
|
|
25
|
+
type RequestableProduct = (typeof REQUESTABLE_PRODUCTS)[number];
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* What the apps report and the monthly bill can charge for: reminder SMS segments sent (added
|
|
29
|
+
* up), and loyalty members (the month's highest count, since Start includes 150 and each one
|
|
30
|
+
* above is charged once a month). A new billable usage is added here first.
|
|
31
|
+
*/
|
|
32
|
+
declare const USAGE_METRICS: {
|
|
33
|
+
readonly sms: "sum";
|
|
34
|
+
readonly loyaltyMembers: "peak";
|
|
35
|
+
};
|
|
36
|
+
type UsageMetric = keyof typeof USAGE_METRICS;
|
|
37
|
+
declare const USAGE_METRIC_NAMES: [UsageMetric, ...UsageMetric[]];
|
|
38
|
+
|
|
1
39
|
type ProductCode = string;
|
|
2
40
|
type FeatureCode = string;
|
|
3
41
|
|
|
@@ -5,7 +43,8 @@ type LicenseState = "trial" | "active" | "grace" | "start" | "suspended" | "term
|
|
|
5
43
|
type PaymentMethodStatus = "ok" | "missing" | "failing";
|
|
6
44
|
type PaymentsMode = "munchi" | "external";
|
|
7
45
|
type PaymentsStatus = "not_started" | "submitted" | "pre_check" | "in_review" | "action_required" | "approved" | "live" | "rejected" | "restricted";
|
|
8
|
-
|
|
46
|
+
declare const SUSPENSION_REASONS: readonly ["misconduct", "fraud_suspected", "chargebacks", "legal_request", "terms_breach", "customer_request", "trial_ended", "payment_overdue", "other"];
|
|
47
|
+
type SuspensionReason = (typeof SUSPENSION_REASONS)[number];
|
|
9
48
|
interface Suspension {
|
|
10
49
|
reason: SuspensionReason;
|
|
11
50
|
mode: "read_only" | "off";
|
|
@@ -135,4 +174,4 @@ declare class LicenseClient {
|
|
|
135
174
|
private report;
|
|
136
175
|
}
|
|
137
176
|
|
|
138
|
-
export { type DeniedEvent, LicenseClient, type LicenseClientOptions, type Snapshot };
|
|
177
|
+
export { type DeniedEvent, type KnownProductCode, LicenseClient, type LicenseClientOptions, PLANS, PRODUCTS, type PlanCode, REQUESTABLE_PRODUCTS, type RequestableProduct, type Snapshot, USAGE_METRICS, USAGE_METRIC_NAMES, type UsageMetric };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,35 @@
|
|
|
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/requestable-products.ts
|
|
20
|
+
var REQUESTABLE_PRODUCTS = [
|
|
21
|
+
"ari",
|
|
22
|
+
"business_account",
|
|
23
|
+
"capital"
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
// ../license-core/src/usage-metrics.ts
|
|
27
|
+
var USAGE_METRICS = {
|
|
28
|
+
sms: "sum",
|
|
29
|
+
loyaltyMembers: "peak"
|
|
30
|
+
};
|
|
31
|
+
var USAGE_METRIC_NAMES = Object.keys(USAGE_METRICS);
|
|
32
|
+
|
|
4
33
|
// src/license-client.ts
|
|
5
34
|
var UNREACHABLE = /* @__PURE__ */ Symbol("unreachable");
|
|
6
35
|
var LicenseClient = class {
|
|
@@ -140,5 +169,10 @@ var LicenseClient = class {
|
|
|
140
169
|
}
|
|
141
170
|
};
|
|
142
171
|
export {
|
|
143
|
-
LicenseClient
|
|
172
|
+
LicenseClient,
|
|
173
|
+
PLANS,
|
|
174
|
+
PRODUCTS,
|
|
175
|
+
REQUESTABLE_PRODUCTS,
|
|
176
|
+
USAGE_METRICS,
|
|
177
|
+
USAGE_METRIC_NAMES
|
|
144
178
|
};
|
package/package.json
CHANGED