@leisuresaas/react-native 0.6.3-dev.2 → 0.6.3-dev.3
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/package.json +1 -1
- package/src/index.ts +2 -0
- package/src/public-app-config.ts +13 -0
- package/src/public-auth.ts +30 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leisuresaas/react-native",
|
|
3
|
-
"version": "0.6.3-dev.
|
|
3
|
+
"version": "0.6.3-dev.3",
|
|
4
4
|
"description": "React Native SDK for LeisureSaas: OAuth, Public Ads/App Config, Drive User Plane (publishable keys). Frontend-only — no Integration Key.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
package/src/index.ts
CHANGED
package/src/public-app-config.ts
CHANGED
|
@@ -40,6 +40,19 @@ export type AppConfigResponse = {
|
|
|
40
40
|
recommended: boolean;
|
|
41
41
|
reason: string;
|
|
42
42
|
};
|
|
43
|
+
social_login?: {
|
|
44
|
+
google?: {
|
|
45
|
+
enabled?: boolean;
|
|
46
|
+
web_client_id?: string;
|
|
47
|
+
ios_client_id?: string;
|
|
48
|
+
android_client_ids?: string[];
|
|
49
|
+
};
|
|
50
|
+
apple?: {
|
|
51
|
+
enabled?: boolean;
|
|
52
|
+
services_id?: string;
|
|
53
|
+
bundle_ids?: string[];
|
|
54
|
+
};
|
|
55
|
+
};
|
|
43
56
|
};
|
|
44
57
|
|
|
45
58
|
function trimSlash(url: string): string {
|
package/src/public-auth.ts
CHANGED
|
@@ -119,6 +119,36 @@ export async function login(
|
|
|
119
119
|
return tokensFromJSON(resp);
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
+
export async function loginWithGoogle(
|
|
123
|
+
ctx: PublicAuthContext,
|
|
124
|
+
input: { idToken: string; password?: string; locale?: string },
|
|
125
|
+
): Promise<AuthTokens> {
|
|
126
|
+
const resp = await publicAuthRequest<TokenJSON>(ctx, "/login/google", {
|
|
127
|
+
id_token: input.idToken, password: input.password ?? "", locale: input.locale ?? "",
|
|
128
|
+
});
|
|
129
|
+
return tokensFromJSON(resp);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export async function loginWithApple(
|
|
133
|
+
ctx: PublicAuthContext,
|
|
134
|
+
input: {
|
|
135
|
+
identityToken: string;
|
|
136
|
+
authorizationCode?: string;
|
|
137
|
+
fullName?: string;
|
|
138
|
+
password?: string;
|
|
139
|
+
locale?: string;
|
|
140
|
+
},
|
|
141
|
+
): Promise<AuthTokens> {
|
|
142
|
+
const resp = await publicAuthRequest<TokenJSON>(ctx, "/login/apple", {
|
|
143
|
+
identity_token: input.identityToken,
|
|
144
|
+
authorization_code: input.authorizationCode ?? "",
|
|
145
|
+
full_name: input.fullName ?? "",
|
|
146
|
+
password: input.password ?? "",
|
|
147
|
+
locale: input.locale ?? "",
|
|
148
|
+
});
|
|
149
|
+
return tokensFromJSON(resp);
|
|
150
|
+
}
|
|
151
|
+
|
|
122
152
|
export async function refreshSession(ctx: PublicAuthContext, refreshToken: string): Promise<AuthTokens> {
|
|
123
153
|
const resp = await publicAuthRequest<TokenJSON>(ctx, "/refresh", { refresh_token: refreshToken });
|
|
124
154
|
return tokensFromJSON(resp);
|