@nebulr-group/bridge-svelte 0.4.0-beta.7 → 0.4.0-beta.8
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/client/components/sdk-auth/PasskeyLogin.svelte +1 -1
- package/dist/client/components/sdk-auth/PasskeySetup.svelte +1 -1
- package/dist/client/components/subscription/BridgeBillingNotice.svelte +4 -12
- package/dist/client/components/subscription/BridgeQuotaBanner.svelte +3 -8
- package/package.json +4 -4
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
|
|
41
41
|
let authResponse: any;
|
|
42
42
|
if (typeof window !== 'undefined' && (window as any).__simpleWebAuthn?.startAuthentication) {
|
|
43
|
-
authResponse = await (window as any).__simpleWebAuthn.startAuthentication(options, autofill);
|
|
43
|
+
authResponse = await (window as any).__simpleWebAuthn.startAuthentication({ optionsJSON: options, useBrowserAutofill: autofill });
|
|
44
44
|
} else {
|
|
45
45
|
// @ts-ignore — @simplewebauthn/browser is an optional peer dependency
|
|
46
46
|
const mod = await import('@simplewebauthn/browser');
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
|
|
55
55
|
let regResponse: any;
|
|
56
56
|
if (typeof window !== 'undefined' && (window as any).__simpleWebAuthn?.startRegistration) {
|
|
57
|
-
regResponse = await (window as any).__simpleWebAuthn.startRegistration(options);
|
|
57
|
+
regResponse = await (window as any).__simpleWebAuthn.startRegistration({ optionsJSON: options });
|
|
58
58
|
} else {
|
|
59
59
|
// @ts-ignore — @simplewebauthn/browser is an optional peer dependency
|
|
60
60
|
const mod = await import('@simplewebauthn/browser');
|
|
@@ -52,9 +52,9 @@
|
|
|
52
52
|
let snapshot = $state<BillingSubscriptionSnapshot>(useBridge().subscription.snapshot());
|
|
53
53
|
let unsubscribe: (() => void) | undefined;
|
|
54
54
|
|
|
55
|
-
// Admin/member variant
|
|
56
|
-
//
|
|
57
|
-
//
|
|
55
|
+
// Admin/member variant. v1 policy: workspace owner only, via
|
|
56
|
+
// canManageBilling() (immutable OWNER role key). Defaults to non-admin if
|
|
57
|
+
// unavailable.
|
|
58
58
|
let isBillingAdmin = $state(false);
|
|
59
59
|
|
|
60
60
|
onMount(() => {
|
|
@@ -65,15 +65,7 @@
|
|
|
65
65
|
const auth = getBridgeAuth();
|
|
66
66
|
const ctx = auth.getApiContext();
|
|
67
67
|
if (ctx.accessToken) {
|
|
68
|
-
|
|
69
|
-
// defensive cast so the component never crashes on missing fields.
|
|
70
|
-
const tokenManager = (auth as unknown as { tokenManager?: { getTokens?: () => { accessToken?: string } } }).tokenManager;
|
|
71
|
-
void tokenManager; // intentionally unused — placeholder until role API is finalized
|
|
72
|
-
// For US-5 default: assume admin if a JWT is present. Subsequent
|
|
73
|
-
// stories will read the exact privilege claim. Keeping permissive so
|
|
74
|
-
// the CTA shows by default; member variant lands when the role check
|
|
75
|
-
// is wired through.
|
|
76
|
-
isBillingAdmin = true;
|
|
68
|
+
isBillingAdmin = auth.canManageBilling();
|
|
77
69
|
}
|
|
78
70
|
|
|
79
71
|
if (!ctx.accessToken) {
|
|
@@ -64,9 +64,8 @@
|
|
|
64
64
|
let snapshot = $state<QuotaSnapshot | undefined>(useBridge().quota(metric));
|
|
65
65
|
let unsubscribe: (() => void) | undefined;
|
|
66
66
|
|
|
67
|
-
// Role variant mirrors BridgeBillingNotice:
|
|
68
|
-
//
|
|
69
|
-
// finalized. Member variant lands when the role probe is wired through.
|
|
67
|
+
// Role variant mirrors BridgeBillingNotice: CTA only for the workspace
|
|
68
|
+
// owner (v1 canManageBilling() policy). Member variant renders otherwise.
|
|
70
69
|
let isBillingAdmin = $state(false);
|
|
71
70
|
|
|
72
71
|
onMount(() => {
|
|
@@ -78,11 +77,7 @@
|
|
|
78
77
|
snapshot = useBridge().quota(metric);
|
|
79
78
|
|
|
80
79
|
try {
|
|
81
|
-
|
|
82
|
-
const ctx = auth.getApiContext();
|
|
83
|
-
if (ctx.accessToken) {
|
|
84
|
-
isBillingAdmin = true;
|
|
85
|
-
}
|
|
80
|
+
isBillingAdmin = getBridgeAuth().canManageBilling();
|
|
86
81
|
} catch {
|
|
87
82
|
// No BridgeAuth instance — render the member variant.
|
|
88
83
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nebulr-group/bridge-svelte",
|
|
3
|
-
"version": "0.4.0-beta.
|
|
3
|
+
"version": "0.4.0-beta.8",
|
|
4
4
|
"description": "Bridge Svelte library, This library helps you to add bridge authentication and feature flags, and payments to your svelte application.",
|
|
5
5
|
"author": "Iman Pouya",
|
|
6
6
|
"license": "MIT",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"svelte": "^5.0.0",
|
|
57
57
|
"@sveltejs/kit": "^2.0.0",
|
|
58
|
-
"@simplewebauthn/browser": "
|
|
58
|
+
"@simplewebauthn/browser": "^13",
|
|
59
59
|
"@stripe/stripe-js": ">=4.0.0"
|
|
60
60
|
},
|
|
61
61
|
"peerDependenciesMeta": {
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
}
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@nebulr-group/bridge-auth-core": "0.4.0-beta.
|
|
70
|
+
"@nebulr-group/bridge-auth-core": "0.4.0-beta.9"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@sveltejs/kit": "^2.16.0",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"publint": "^0.3.2",
|
|
78
78
|
"svelte": "^5.0.0",
|
|
79
79
|
"svelte-check": "^4.0.0",
|
|
80
|
-
"typescript": "^
|
|
80
|
+
"typescript": "^6.0.0",
|
|
81
81
|
"vite": "^6.2.6",
|
|
82
82
|
"vitest": "^4.1.4"
|
|
83
83
|
},
|