@nebulr-group/bridge-svelte 0.8.0-beta.2 → 0.8.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.
@@ -498,6 +498,7 @@
498
498
  mode={ssoMode}
499
499
  onSuccess={onLogin}
500
500
  onError={onError}
501
+ {messages}
501
502
  class="bridge-btn bridge-btn-secondary bridge-sso-btn"
502
503
  >
503
504
  {#snippet icon()}
@@ -1,4 +1,5 @@
1
1
  <script lang="ts">
2
+ import { onMount } from 'svelte';
2
3
  import type { HTMLAttributes } from 'svelte/elements';
3
4
  import type { MessageOverrides } from '@nebulr-group/bridge-auth-core';
4
5
  import { getBridgeAuth } from '../../../core/bridge-instance.js';
@@ -65,6 +66,37 @@
65
66
  }
66
67
  }
67
68
 
69
+ // TBP-682: the emailed link returns to the page the request was made from,
70
+ // so this component must redeem it as well as send it. Without this branch a
71
+ // link requested here lands back here and does nothing — the token sits in
72
+ // the address bar and the user stays signed out. Mirrors LoginForm, which
73
+ // has always redeemed on mount.
74
+ onMount(async () => {
75
+ if (typeof window === 'undefined') return;
76
+
77
+ const params = new URLSearchParams(window.location.search);
78
+ const magicToken = params.get('bridge_magic_link_token');
79
+ if (!magicToken) return;
80
+
81
+ // Drop the token from the URL before redeeming, so a reload or a shared
82
+ // link cannot replay it.
83
+ params.delete('bridge_magic_link_token');
84
+ const newSearch = params.toString();
85
+ window.history.replaceState({}, '', window.location.pathname + (newSearch ? `?${newSearch}` : ''));
86
+
87
+ loading = true;
88
+ error = null;
89
+ try {
90
+ await getBridgeAuth().authenticateWithMagicLinkToken(magicToken);
91
+ // Auth state drives what the host app renders next, as with LoginForm.
92
+ } catch (err: any) {
93
+ error = authErrorMessage(err, t, 'magicLink.error.auth');
94
+ onError?.(err);
95
+ } finally {
96
+ loading = false;
97
+ }
98
+ });
99
+
68
100
  function formatExpiry(seconds: number): string {
69
101
  if (seconds >= 60) {
70
102
  const count = Math.floor(seconds / 60);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nebulr-group/bridge-svelte",
3
- "version": "0.8.0-beta.2",
3
+ "version": "0.8.1",
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",
@@ -58,7 +58,7 @@
58
58
  "svelte": "^5.0.0",
59
59
  "@sveltejs/kit": "^2.0.0",
60
60
  "@stripe/stripe-js": ">=4.0.0",
61
- "@nebulr-group/bridge-auth-core": ">=0.7.0-beta.0 <1.0.0"
61
+ "@nebulr-group/bridge-auth-core": ">=0.7.1 <1.0.0"
62
62
  },
63
63
  "peerDependenciesMeta": {
64
64
  "@stripe/stripe-js": {
@@ -79,7 +79,7 @@
79
79
  "typescript": "^6.0.0",
80
80
  "vite": "^6.2.6",
81
81
  "vitest": "^4.1.4",
82
- "@nebulr-group/bridge-auth-core": "0.7.0-beta.1"
82
+ "@nebulr-group/bridge-auth-core": "0.7.1"
83
83
  },
84
84
  "keywords": [
85
85
  "svelte",