@block-auth.io/angular 0.7.7 → 0.9.0
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.
|
@@ -172,10 +172,7 @@ class BlockAuthRuntimeDirective {
|
|
|
172
172
|
onError: () => this.errored.emit(),
|
|
173
173
|
onLogout: () => this.loggedOut.emit(),
|
|
174
174
|
});
|
|
175
|
-
this.client.registerRuntime({
|
|
176
|
-
switchAccount: this.runtime.switchAccount,
|
|
177
|
-
resumeSession: this.runtime.resumeSession,
|
|
178
|
-
});
|
|
175
|
+
this.client.registerRuntime({ switchAccount: this.runtime.switchAccount });
|
|
179
176
|
void this.runtime.start();
|
|
180
177
|
}
|
|
181
178
|
ngOnDestroy() {
|
|
@@ -10154,22 +10151,11 @@ class FlowBlockAuthComponent {
|
|
|
10154
10151
|
effect((onCleanup) => {
|
|
10155
10152
|
if (!this.isReconnectingRemembered() || !this.ui().isServiceConnected)
|
|
10156
10153
|
return;
|
|
10157
|
-
|
|
10158
|
-
const timer = setTimeout(async () => {
|
|
10159
|
-
const resumed = await this.client.resumeSession();
|
|
10160
|
-
if (cancelled)
|
|
10161
|
-
return;
|
|
10154
|
+
const timer = setTimeout(() => {
|
|
10162
10155
|
this.isReconnectingRemembered.set(false);
|
|
10163
|
-
if (resumed) {
|
|
10164
|
-
this.isRequestingSignin.set(false);
|
|
10165
|
-
return;
|
|
10166
|
-
}
|
|
10167
10156
|
untracked(() => this.requestReturningSignin());
|
|
10168
10157
|
}, REMEMBERED_SIGNIN_SETTLE_MS);
|
|
10169
|
-
onCleanup(() =>
|
|
10170
|
-
cancelled = true;
|
|
10171
|
-
clearTimeout(timer);
|
|
10172
|
-
});
|
|
10158
|
+
onCleanup(() => clearTimeout(timer));
|
|
10173
10159
|
});
|
|
10174
10160
|
effect(() => {
|
|
10175
10161
|
if (!this.ui().isSigning)
|
|
@@ -10177,9 +10163,25 @@ class FlowBlockAuthComponent {
|
|
|
10177
10163
|
});
|
|
10178
10164
|
}
|
|
10179
10165
|
ngOnInit() {
|
|
10180
|
-
if (!this.isHosted
|
|
10166
|
+
if (!this.isHosted)
|
|
10181
10167
|
return;
|
|
10182
|
-
|
|
10168
|
+
const authCode = this.onAuthCode();
|
|
10169
|
+
const ownsAuthCode = Boolean(authCode);
|
|
10170
|
+
const restoresSession = this.user() === undefined &&
|
|
10171
|
+
(this.client.hasAuthEndpoint ? this.client.usesAuthEndpoint(ownsAuthCode) : !ownsAuthCode);
|
|
10172
|
+
const redirectLogin = authCode
|
|
10173
|
+
? this.client.completeRedirectAuthCode(authCode)
|
|
10174
|
+
: this.client.handleRedirectCallback();
|
|
10175
|
+
redirectLogin
|
|
10176
|
+
.then(async (redirectUser) => {
|
|
10177
|
+
if (redirectUser) {
|
|
10178
|
+
this.success.emit(redirectUser.address);
|
|
10179
|
+
return;
|
|
10180
|
+
}
|
|
10181
|
+
if (restoresSession)
|
|
10182
|
+
await this.client.restoreHostedLogin();
|
|
10183
|
+
})
|
|
10184
|
+
.catch(() => this.errored.emit());
|
|
10183
10185
|
}
|
|
10184
10186
|
onHostedLoginClicked() {
|
|
10185
10187
|
if (this.isPopupOpen())
|
|
@@ -10528,7 +10530,17 @@ class LinkBlockAuthComponent {
|
|
|
10528
10530
|
this.linkLabel = computed(() => this.linkDefault[this.locale()] ?? this.linkDefault['en'], ...(ngDevMode ? [{ debugName: "linkLabel" }] : []));
|
|
10529
10531
|
}
|
|
10530
10532
|
ngOnInit() {
|
|
10531
|
-
|
|
10533
|
+
this.client
|
|
10534
|
+
.completeRedirectLink()
|
|
10535
|
+
.then((linked) => {
|
|
10536
|
+
if (linked)
|
|
10537
|
+
this.linked.emit();
|
|
10538
|
+
return this.refreshStatus();
|
|
10539
|
+
})
|
|
10540
|
+
.catch((error) => {
|
|
10541
|
+
this.errored.emit(error instanceof AccountLinkError ? error.reason : 'failed');
|
|
10542
|
+
return this.refreshStatus();
|
|
10543
|
+
});
|
|
10532
10544
|
}
|
|
10533
10545
|
onLinkClicked() {
|
|
10534
10546
|
if (this.isPopupOpen())
|