Skip to content

Commit 3df53ac

Browse files
committed
convert registration parameters to extension types
1 parent 5e7ed7c commit 3df53ac

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

lib/src/web/static_interop/parameters/registration.dart

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,52 @@
1-
import 'package:js/js.dart';
1+
import 'dart:js_interop';
22

33
import '../models/profile.dart';
44
import '../response/login_response.dart';
55
import '../response/registration_response.dart';
66

7-
// TODO: convert registration params to extension types
8-
9-
/*
10-
11-
/// This class represents the parameters for the `Accounts.finalizeRegistration` method.
7+
/// The extension type for the parameters for the `Accounts.finalizeRegistration` method.
128
@JS()
139
@anonymous
1410
@staticInterop
15-
class FinalizeRegistrationParameters {
11+
extension type FinalizeRegistrationParameters._(JSObject _) implements JSObject {
1612
/// Create a new [FinalizeRegistrationParameters] instance.
13+
///
14+
/// The [callback] function receives a [LoginResponse] as argument
15+
/// and has [JSVoid] as return type.
1716
external factory FinalizeRegistrationParameters({
18-
void Function(LoginResponse response) callback,
17+
JSFunction callback,
1918
bool allowAccountsLinking,
2019
String? include,
2120
String regToken,
2221
});
2322
}
2423

25-
/// This class represents the parameters for the `Accounts.initRegistration` method.
24+
/// The extension type for the parameters for the `Accounts.initRegistration` method.
2625
@JS()
2726
@anonymous
2827
@staticInterop
29-
class InitRegistrationParameters {
28+
extension type InitRegistrationParameters._(JSObject _) implements JSObject {
3029
/// Create a new [InitRegistrationParameters] instance.
30+
///
31+
/// The [callback] function receives a [InitRegistrationResponse] as argument
32+
/// and has [JSVoid] as return type.
3133
external factory InitRegistrationParameters({
32-
void Function(InitRegistrationResponse response) callback,
34+
JSFunction callback,
3335
bool? isLite,
3436
});
3537
}
3638

37-
/// This class represents the parameters for the `Accounts.registration` method.
39+
/// The extension type for the parameters for the `Accounts.registration` method.
3840
@JS()
3941
@anonymous
4042
@staticInterop
41-
class RegistrationParameters {
43+
extension type RegistrationParameters._(JSObject _) implements JSObject {
4244
/// Create a new [RegistrationParameters] instance.
45+
///
46+
/// The [callback] function receives a [LoginResponse] as argument
47+
/// and has [JSVoid] as return type.
4348
external factory RegistrationParameters({
44-
void Function(LoginResponse response) callback,
49+
JSFunction callback,
4550
String? captchaToken,
4651
String email,
4752
bool finalizeRegistration,
@@ -57,4 +62,3 @@ class RegistrationParameters {
5762
String? siteUID,
5863
});
5964
}
60-
*/

0 commit comments

Comments
 (0)