jr-common-micro 1.1.102 → 1.1.103
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,10 +1,11 @@
|
|
|
1
1
|
import { BadgeKey } from './badges';
|
|
2
|
-
export declare const PLAN_CODES: readonly ["premium"];
|
|
2
|
+
export declare const PLAN_CODES: readonly ["premium", "gold"];
|
|
3
3
|
export type PlanCode = (typeof PLAN_CODES)[number];
|
|
4
|
-
export declare const FEATURE_KEYS: readonly ["badge.premium", "chat.premium_group", "data.premium"];
|
|
4
|
+
export declare const FEATURE_KEYS: readonly ["badge.premium", "badge.gold", "chat.premium_group", "data.premium"];
|
|
5
5
|
export type FeatureKey = (typeof FEATURE_KEYS)[number];
|
|
6
6
|
export declare const PLAN_FEATURES: Record<PlanCode, readonly FeatureKey[]>;
|
|
7
7
|
export declare const PLAN_BADGE: Record<PlanCode, BadgeKey | null>;
|
|
8
|
+
export declare function higherPlan(a: PlanCode | null | undefined, b: PlanCode | null | undefined): PlanCode | null;
|
|
8
9
|
export declare function isPlanCode(value: string): value is PlanCode;
|
|
9
10
|
export declare function isFeatureKey(value: string): value is FeatureKey;
|
|
10
11
|
export type EntitlementMap = Partial<Record<FeatureKey, Date | null>>;
|
|
@@ -1,22 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ENTITLEMENT_CHANGED_CHANNEL = exports.PLAN_BADGE = exports.PLAN_FEATURES = exports.FEATURE_KEYS = exports.PLAN_CODES = void 0;
|
|
4
|
+
exports.higherPlan = higherPlan;
|
|
4
5
|
exports.isPlanCode = isPlanCode;
|
|
5
6
|
exports.isFeatureKey = isFeatureKey;
|
|
6
7
|
exports.hasEntitlement = hasEntitlement;
|
|
7
8
|
exports.entitlementMapFromWire = entitlementMapFromWire;
|
|
8
|
-
exports.PLAN_CODES = ['premium'];
|
|
9
|
+
exports.PLAN_CODES = ['premium', 'gold'];
|
|
9
10
|
exports.FEATURE_KEYS = [
|
|
10
11
|
'badge.premium',
|
|
12
|
+
'badge.gold',
|
|
11
13
|
'chat.premium_group',
|
|
12
14
|
'data.premium',
|
|
13
15
|
];
|
|
14
16
|
exports.PLAN_FEATURES = {
|
|
15
17
|
premium: ['badge.premium', 'chat.premium_group', 'data.premium'],
|
|
18
|
+
gold: ['badge.gold', 'chat.premium_group', 'data.premium'],
|
|
16
19
|
};
|
|
17
20
|
exports.PLAN_BADGE = {
|
|
18
21
|
premium: 'premium',
|
|
22
|
+
gold: 'gold',
|
|
19
23
|
};
|
|
24
|
+
function higherPlan(a, b) {
|
|
25
|
+
const rank = (p) => p ? exports.PLAN_CODES.indexOf(p) : -1;
|
|
26
|
+
return rank(a) >= rank(b) ? (a ?? null) : (b ?? null);
|
|
27
|
+
}
|
|
20
28
|
function isPlanCode(value) {
|
|
21
29
|
return exports.PLAN_CODES.includes(value);
|
|
22
30
|
}
|