@rimori/client 2.5.38 → 2.5.39-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.
package/README.md CHANGED
@@ -38,7 +38,7 @@ The `@rimori/client` package is the framework-agnostic runtime and CLI that powe
38
38
  ```bash
39
39
  npm install @rimori/client
40
40
  # or
41
- yarn add @rimori/client
41
+ pnpm add @rimori/client
42
42
  ```
43
43
 
44
44
  ## Relationship to @rimori/react-client
@@ -97,7 +97,7 @@ npx @rimori/client rimori-init --upgrade # refresh config without changing the
97
97
  Usage:
98
98
 
99
99
  ```bash
100
- yarn build
100
+ pnpm build
101
101
  npx @rimori/client rimori-release alpha
102
102
  ```
103
103
 
@@ -132,11 +132,11 @@ async function main() {
132
132
  console.log('1. Check out ./rimori/readme.md for more information about how to make the most out of the plugin.');
133
133
  console.log('2. Adapt the ./rimori/rimori.config.ts file to your needs.');
134
134
  console.log('3. Under ./public/docs/ you can find the documentation for an example flashcard plugin to get started easier.');
135
- console.log('4. Start development with: yarn dev');
135
+ console.log('4. Start development with: pnpm dev');
136
136
  console.log('');
137
137
  console.log(`The plugin should now be accessible at: http://localhost:${3000}`);
138
138
  console.log('');
139
- console.log('If you want to release the plugin, simply run: "yarn release:<alpha|beta|stable>" (details are available in ./rimori/readme.md)');
139
+ console.log('If you want to release the plugin, simply run: "pnpm release:<alpha|beta|stable>" (details are available in ./rimori/readme.md)');
140
140
  }
141
141
  catch (error) {
142
142
  console.error(`❌ Error: ${error instanceof Error ? error.message : error}`);
@@ -65,11 +65,11 @@ export function updatePackageJson({ pluginId, port, isUpgrade = false }) {
65
65
  packageJson.scripts = {
66
66
  ...packageJson.scripts,
67
67
  dev: `vite --port ${port || 3000}`,
68
- build: 'yarn run check && vite build',
68
+ build: 'pnpm check && vite build',
69
69
  check: 'tsc --project tsconfig.app.json --noEmit --pretty',
70
- 'release:alpha': 'yarn build && yarn rimori-release alpha',
71
- 'release:beta': 'yarn build && yarn rimori-release beta',
72
- 'release:stable': 'yarn build && yarn rimori-release stable',
70
+ 'release:alpha': 'pnpm build && pnpm rimori-release alpha',
71
+ 'release:beta': 'pnpm build && pnpm rimori-release beta',
72
+ 'release:stable': 'pnpm build && pnpm rimori-release stable',
73
73
  'dev:worker': 'VITE_MINIFY=false vite build --watch --config worker/vite.config.ts',
74
74
  'build:worker': 'vite build --config worker/vite.config.ts',
75
75
  };
@@ -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'];
@@ -1,4 +1,4 @@
1
- export type LanguageLevel = 'Pre-A1' | 'A1' | 'A2' | 'B1' | 'B2' | 'C1' | 'C2' | 'Post-C2';
1
+ export type LanguageLevel = 'Pre-A1' | 'A1' | 'A2' | 'B1' | 'B2' | 'C1' | 'C2';
2
2
  export declare function getDifficultyLevel(difficulty: LanguageLevel): number;
3
3
  export declare function getDifficultyLabel(difficulty: number): LanguageLevel;
4
4
  export declare function getNeighborDifficultyLevel(difficulty: LanguageLevel, difficultyAdjustment: number): LanguageLevel;
@@ -1,4 +1,4 @@
1
- const codes = ['Pre-A1', 'A1', 'A2', 'B1', 'B2', 'C1', 'C2', 'Post-C2'];
1
+ const codes = ['Pre-A1', 'A1', 'A2', 'B1', 'B2', 'C1', 'C2'];
2
2
  export function getDifficultyLevel(difficulty) {
3
3
  return codes.indexOf(difficulty) + 1;
4
4
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rimori/client",
3
- "version": "2.5.38",
3
+ "version": "2.5.39-next.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "repository": {
@@ -32,7 +32,7 @@
32
32
  "scripts": {
33
33
  "build": "tsc",
34
34
  "dev": "tsc -w --preserveWatchOutput",
35
- "lint": "npx eslint . --fix",
35
+ "lint": "pnpm exec eslint . --fix",
36
36
  "format": "prettier --write ."
37
37
  },
38
38
  "dependencies": {