@rimori/client 2.5.39 → 2.5.40-next.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.
@@ -94,6 +94,17 @@ export declare class PluginModule {
94
94
  * @returns The translator for the plugin.
95
95
  */
96
96
  getTranslator(): Promise<Translator>;
97
+ /**
98
+ * True if the user's current subscription tier is at or above `minTier`.
99
+ * Use for inline access checks; for upgrade flows pair with `requestUpgrade`.
100
+ */
101
+ hasMinTier(minTier: SubscriptionTier): boolean;
102
+ /**
103
+ * Ask rimori-main to show the upgrade modal for the given required tier.
104
+ * Plugins should call this when a gated action is attempted by a user
105
+ * whose tier is below `requiredTier`.
106
+ */
107
+ requestUpgrade(requiredTier: SubscriptionTier): void;
97
108
  }
98
109
  export interface Buddy {
99
110
  id: string;
@@ -1,4 +1,5 @@
1
1
  import { Translator } from '../../controller/TranslationController';
2
+ import { EventBus } from '../../fromRimori/EventBus';
2
3
  /**
3
4
  * Controller for plugin-related operations.
4
5
  * Provides access to plugin settings, user info, and plugin information.
@@ -180,6 +181,22 @@ export class PluginModule {
180
181
  await this.translator.initialize();
181
182
  return this.translator;
182
183
  }
184
+ /**
185
+ * True if the user's current subscription tier is at or above `minTier`.
186
+ * Use for inline access checks; for upgrade flows pair with `requestUpgrade`.
187
+ */
188
+ hasMinTier(minTier) {
189
+ const userTier = this.rimoriInfo.profile.subscription_tier;
190
+ return TIER_ORDER.indexOf(userTier) >= TIER_ORDER.indexOf(minTier);
191
+ }
192
+ /**
193
+ * Ask rimori-main to show the upgrade modal for the given required tier.
194
+ * Plugins should call this when a gated action is attempted by a user
195
+ * whose tier is below `requiredTier`.
196
+ */
197
+ requestUpgrade(requiredTier) {
198
+ EventBus.emit(this.pluginId, 'global.subscription.triggerUpgrade', { requiredTier });
199
+ }
183
200
  }
184
201
  /** Ordered tiers from lowest to highest access level */
185
202
  export const TIER_ORDER = ['anonymous', 'free', 'standard', 'premium', 'early_access'];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rimori/client",
3
- "version": "2.5.39",
3
+ "version": "2.5.40-next.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "repository": {
@@ -47,5 +47,11 @@
47
47
  "prettier": "^3.6.2",
48
48
  "typescript": "^5.7.2",
49
49
  "typescript-eslint": "^8.46.0"
50
+ },
51
+ "pnpm": {
52
+ "ignoredBuiltDependencies": [
53
+ "core-js",
54
+ "protobufjs"
55
+ ]
50
56
  }
51
57
  }