@nebulr-group/bridge-svelte 1.0.0-alpha.11 → 1.0.0-alpha.12
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/core/upgrade.d.ts +3 -2
- package/dist/core/upgrade.js +6 -2
- package/package.json +1 -1
package/dist/core/upgrade.d.ts
CHANGED
|
@@ -35,7 +35,8 @@ export declare function closeUpgrade(): void;
|
|
|
35
35
|
*
|
|
36
36
|
* Understood: problem details (`type` ending in `plan-required` or
|
|
37
37
|
* `quota-exceeded`, with `entitlement`, `metric`, `used`, `limit`), and the
|
|
38
|
-
* `{ code: 'QUOTA_EXCEEDED', metric, used,
|
|
39
|
-
*
|
|
38
|
+
* shapes server plugins answer with: `{ code: 'QUOTA_EXCEEDED', metric, used,
|
|
39
|
+
* limit, fix }` for a limit, and `{ code: 'FEATURE_NOT_IN_PLAN', flag,
|
|
40
|
+
* feature, fix }` for a flag that is off because the plan lacks a feature.
|
|
40
41
|
*/
|
|
41
42
|
export declare function readPaymentRequired(body: unknown): UpgradeRequest | null;
|
package/dist/core/upgrade.js
CHANGED
|
@@ -27,8 +27,9 @@ function samePath(value) {
|
|
|
27
27
|
*
|
|
28
28
|
* Understood: problem details (`type` ending in `plan-required` or
|
|
29
29
|
* `quota-exceeded`, with `entitlement`, `metric`, `used`, `limit`), and the
|
|
30
|
-
* `{ code: 'QUOTA_EXCEEDED', metric, used,
|
|
31
|
-
*
|
|
30
|
+
* shapes server plugins answer with: `{ code: 'QUOTA_EXCEEDED', metric, used,
|
|
31
|
+
* limit, fix }` for a limit, and `{ code: 'FEATURE_NOT_IN_PLAN', flag,
|
|
32
|
+
* feature, fix }` for a flag that is off because the plan lacks a feature.
|
|
32
33
|
*/
|
|
33
34
|
export function readPaymentRequired(body) {
|
|
34
35
|
if (body === null || typeof body !== 'object')
|
|
@@ -44,5 +45,8 @@ export function readPaymentRequired(body) {
|
|
|
44
45
|
if (code === 'PLAN_REQUIRED' || type.endsWith('plan-required')) {
|
|
45
46
|
return { kind: 'feature', entitlement: str(b['entitlement']), message, upgradeHref };
|
|
46
47
|
}
|
|
48
|
+
if (code === 'FEATURE_NOT_IN_PLAN') {
|
|
49
|
+
return { kind: 'feature', entitlement: str(b['feature']) ?? str(b['entitlement']), flag: str(b['flag']), message, upgradeHref };
|
|
50
|
+
}
|
|
47
51
|
return null;
|
|
48
52
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nebulr-group/bridge-svelte",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.12",
|
|
4
4
|
"description": "The Bridge for SvelteKit: sign-in in your own pages, workspaces, flag-based route guards, plans and checkout, the team panel and live updates, on one setting: the issuer.",
|
|
5
5
|
"author": "Iman Pouya",
|
|
6
6
|
"license": "MIT",
|