@capgo/capacitor-social-login 0.0.51 → 0.0.52
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/esm/web.d.ts +4 -0
- package/dist/esm/web.js +90 -12
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +90 -12
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +90 -12
- package/dist/plugin.js.map +1 -1
- package/package.json +1 -1
package/dist/esm/web.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ export declare class SocialLoginWeb extends WebPlugin implements SocialLoginPlug
|
|
|
6
6
|
private googleScriptLoaded;
|
|
7
7
|
private appleScriptLoaded;
|
|
8
8
|
private appleScriptUrl;
|
|
9
|
+
private facebookAppId;
|
|
10
|
+
private facebookScriptLoaded;
|
|
9
11
|
initialize(options: InitializeOptions): Promise<void>;
|
|
10
12
|
login(options: LoginOptions): Promise<LoginResult>;
|
|
11
13
|
logout(options: {
|
|
@@ -22,4 +24,6 @@ export declare class SocialLoginWeb extends WebPlugin implements SocialLoginPlug
|
|
|
22
24
|
private loginWithApple;
|
|
23
25
|
private loadAppleScript;
|
|
24
26
|
private getGoogleUser;
|
|
27
|
+
private loadFacebookScript;
|
|
28
|
+
private loginWithFacebook;
|
|
25
29
|
}
|
package/dist/esm/web.js
CHANGED
|
@@ -7,9 +7,11 @@ export class SocialLoginWeb extends WebPlugin {
|
|
|
7
7
|
this.googleScriptLoaded = false;
|
|
8
8
|
this.appleScriptLoaded = false;
|
|
9
9
|
this.appleScriptUrl = "https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js";
|
|
10
|
+
this.facebookAppId = null;
|
|
11
|
+
this.facebookScriptLoaded = false;
|
|
10
12
|
}
|
|
11
13
|
async initialize(options) {
|
|
12
|
-
var _a, _b;
|
|
14
|
+
var _a, _b, _c;
|
|
13
15
|
if ((_a = options.google) === null || _a === void 0 ? void 0 : _a.webClientId) {
|
|
14
16
|
this.googleClientId = options.google.webClientId;
|
|
15
17
|
await this.loadGoogleScript();
|
|
@@ -18,6 +20,16 @@ export class SocialLoginWeb extends WebPlugin {
|
|
|
18
20
|
this.appleClientId = options.apple.clientId;
|
|
19
21
|
await this.loadAppleScript();
|
|
20
22
|
}
|
|
23
|
+
if ((_c = options.facebook) === null || _c === void 0 ? void 0 : _c.appId) {
|
|
24
|
+
this.facebookAppId = options.facebook.appId;
|
|
25
|
+
await this.loadFacebookScript();
|
|
26
|
+
FB.init({
|
|
27
|
+
appId: this.facebookAppId,
|
|
28
|
+
version: 'v17.0',
|
|
29
|
+
xfbml: true,
|
|
30
|
+
cookie: true,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
21
33
|
// Implement initialization for other providers if needed
|
|
22
34
|
}
|
|
23
35
|
async login(options) {
|
|
@@ -27,6 +39,9 @@ export class SocialLoginWeb extends WebPlugin {
|
|
|
27
39
|
else if (options.provider === "apple") {
|
|
28
40
|
return this.loginWithApple(options.options);
|
|
29
41
|
}
|
|
42
|
+
else if (options.provider === "facebook") {
|
|
43
|
+
return this.loginWithFacebook(options.options);
|
|
44
|
+
}
|
|
30
45
|
// Implement login for other providers
|
|
31
46
|
throw new Error(`Login for ${options.provider} is not implemented on web`);
|
|
32
47
|
}
|
|
@@ -42,9 +57,9 @@ export class SocialLoginWeb extends WebPlugin {
|
|
|
42
57
|
console.log("Apple logout: Session should be managed on the client side");
|
|
43
58
|
break;
|
|
44
59
|
case "facebook":
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
60
|
+
return new Promise((resolve) => {
|
|
61
|
+
FB.logout(() => resolve());
|
|
62
|
+
});
|
|
48
63
|
default:
|
|
49
64
|
throw new Error(`Logout for ${options.provider} is not implemented`);
|
|
50
65
|
}
|
|
@@ -60,9 +75,11 @@ export class SocialLoginWeb extends WebPlugin {
|
|
|
60
75
|
console.log("Apple login status should be managed on the client side");
|
|
61
76
|
return { isLoggedIn: false };
|
|
62
77
|
case "facebook":
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
78
|
+
return new Promise((resolve) => {
|
|
79
|
+
FB.getLoginStatus((response) => {
|
|
80
|
+
resolve({ isLoggedIn: response.status === 'connected' });
|
|
81
|
+
});
|
|
82
|
+
});
|
|
66
83
|
default:
|
|
67
84
|
throw new Error(`isLoggedIn for ${options.provider} is not implemented`);
|
|
68
85
|
}
|
|
@@ -81,9 +98,17 @@ export class SocialLoginWeb extends WebPlugin {
|
|
|
81
98
|
console.log("Apple authorization code should be stored during login");
|
|
82
99
|
throw new Error("Apple authorization code not available");
|
|
83
100
|
case "facebook":
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
101
|
+
return new Promise((resolve, reject) => {
|
|
102
|
+
FB.getLoginStatus((response) => {
|
|
103
|
+
var _a;
|
|
104
|
+
if (response.status === 'connected') {
|
|
105
|
+
resolve({ jwt: ((_a = response.authResponse) === null || _a === void 0 ? void 0 : _a.accessToken) || "" });
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
reject(new Error("No Facebook authorization code available"));
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
});
|
|
87
112
|
default:
|
|
88
113
|
throw new Error(`getAuthorizationCode for ${options.provider} is not implemented`);
|
|
89
114
|
}
|
|
@@ -99,8 +124,7 @@ export class SocialLoginWeb extends WebPlugin {
|
|
|
99
124
|
console.log("Apple refresh not available on web");
|
|
100
125
|
break;
|
|
101
126
|
case "facebook":
|
|
102
|
-
|
|
103
|
-
console.log("Facebook refresh not implemented");
|
|
127
|
+
await this.loginWithFacebook(options.options);
|
|
104
128
|
break;
|
|
105
129
|
default:
|
|
106
130
|
throw new Error(`Refresh for ${options.provider} is not implemented`);
|
|
@@ -239,5 +263,59 @@ export class SocialLoginWeb extends WebPlugin {
|
|
|
239
263
|
});
|
|
240
264
|
});
|
|
241
265
|
}
|
|
266
|
+
async loadFacebookScript() {
|
|
267
|
+
if (this.facebookScriptLoaded)
|
|
268
|
+
return;
|
|
269
|
+
return new Promise((resolve, reject) => {
|
|
270
|
+
const script = document.createElement('script');
|
|
271
|
+
script.src = 'https://connect.facebook.net/en_US/sdk.js';
|
|
272
|
+
script.async = true;
|
|
273
|
+
script.defer = true;
|
|
274
|
+
script.onload = () => {
|
|
275
|
+
this.facebookScriptLoaded = true;
|
|
276
|
+
resolve();
|
|
277
|
+
};
|
|
278
|
+
script.onerror = reject;
|
|
279
|
+
document.body.appendChild(script);
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
async loginWithFacebook(options) {
|
|
283
|
+
if (!this.facebookAppId) {
|
|
284
|
+
throw new Error("Facebook App ID not set. Call initialize() first.");
|
|
285
|
+
}
|
|
286
|
+
return new Promise((resolve, reject) => {
|
|
287
|
+
FB.login((response) => {
|
|
288
|
+
if (response.status === 'connected') {
|
|
289
|
+
FB.api('/me', { fields: 'id,name,email,picture' }, (userInfo) => {
|
|
290
|
+
var _a, _b;
|
|
291
|
+
const result = {
|
|
292
|
+
accessToken: {
|
|
293
|
+
token: response.authResponse.accessToken,
|
|
294
|
+
userId: response.authResponse.userID,
|
|
295
|
+
},
|
|
296
|
+
profile: {
|
|
297
|
+
userID: userInfo.id,
|
|
298
|
+
name: userInfo.name,
|
|
299
|
+
email: userInfo.email || null,
|
|
300
|
+
imageURL: ((_b = (_a = userInfo.picture) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.url) || null,
|
|
301
|
+
friendIDs: [],
|
|
302
|
+
birthday: null,
|
|
303
|
+
ageRange: null,
|
|
304
|
+
gender: null,
|
|
305
|
+
location: null,
|
|
306
|
+
hometown: null,
|
|
307
|
+
profileURL: null,
|
|
308
|
+
},
|
|
309
|
+
authenticationToken: null,
|
|
310
|
+
};
|
|
311
|
+
resolve({ provider: "facebook", result });
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
else {
|
|
315
|
+
reject(new Error("Facebook login failed"));
|
|
316
|
+
}
|
|
317
|
+
}, { scope: options.permissions.join(',') });
|
|
318
|
+
});
|
|
319
|
+
}
|
|
242
320
|
}
|
|
243
321
|
//# sourceMappingURL=web.js.map
|
package/dist/esm/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AA6B5C,MAAM,OAAO,cAAe,SAAQ,SAAS;IAA7C;;QACU,mBAAc,GAAkB,IAAI,CAAC;QACrC,kBAAa,GAAkB,IAAI,CAAC;QACpC,uBAAkB,GAAG,KAAK,CAAC;QAC3B,sBAAiB,GAAG,KAAK,CAAC;QAC1B,mBAAc,GACpB,sFAAsF,CAAC;IAoQ3F,CAAC;IAlQC,KAAK,CAAC,UAAU,CAAC,OAA0B;;QACzC,IAAI,MAAA,OAAO,CAAC,MAAM,0CAAE,WAAW,EAAE,CAAC;YAChC,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC;YACjD,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAChC,CAAC;QACD,IAAI,MAAA,OAAO,CAAC,KAAK,0CAAE,QAAQ,EAAE,CAAC;YAC5B,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC;YAC5C,MAAM,IAAI,CAAC,eAAe,EAAE,CAAC;QAC/B,CAAC;QACD,yDAAyD;IAC3D,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,OAAqB;QAC/B,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;YAClC,OAAO,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC/C,CAAC;aAAM,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;YACxC,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC9C,CAAC;QAC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,CAAC,MAAM,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,KAAK,CAAC,aAAa;QACzB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC7B,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,UAAU,CAAC;gBAC5B,SAAS,EAAE,IAAI,CAAC,cAAe;gBAC/B,QAAQ,EAAE,CAAC,QAAQ,EAAE,EAAE;oBACrB,OAAO,CAAC,QAAQ,CAAC,CAAC;gBACpB,CAAC;aACF,CAAC,CAAC;YACH,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,YAAY,EAAE,EAAE;gBACzC,IAAI,YAAY,CAAC,cAAc,EAAE,IAAI,YAAY,CAAC,eAAe,EAAE,EAAE,CAAC;oBACpE,OAAO,CAAC,IAAI,CAAC,CAAC;gBAChB,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { WebPlugin } from \"@capacitor/core\";\n\nimport type {\n SocialLoginPlugin,\n InitializeOptions,\n LoginOptions,\n LoginResult,\n AuthorizationCode,\n GoogleLoginResponse,\n AppleProviderResponse,\n isLoggedInOptions,\n AuthorizationCodeOptions,\n} from \"./definitions\";\n\n// Add this declaration at the top of the file\ndeclare const google: {\n accounts: {\n id: {\n initialize(config: {\n client_id: string;\n callback: (response: any) => void;\n }): void;\n prompt(callback: (notification: any) => void): void;\n };\n };\n};\n\ndeclare const AppleID: any;\n\nexport class SocialLoginWeb extends WebPlugin implements SocialLoginPlugin {\n private googleClientId: string | null = null;\n private appleClientId: string | null = null;\n private googleScriptLoaded = false;\n private appleScriptLoaded = false;\n private appleScriptUrl =\n \"https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js\";\n\n async initialize(options: InitializeOptions): Promise<void> {\n if (options.google?.webClientId) {\n this.googleClientId = options.google.webClientId;\n await this.loadGoogleScript();\n }\n if (options.apple?.clientId) {\n this.appleClientId = options.apple.clientId;\n await this.loadAppleScript();\n }\n // Implement initialization for other providers if needed\n }\n\n async login(options: LoginOptions): Promise<LoginResult> {\n if (options.provider === \"google\") {\n return this.loginWithGoogle(options.options);\n } else if (options.provider === \"apple\") {\n return this.loginWithApple(options.options);\n }\n // Implement login for other providers\n throw new Error(`Login for ${options.provider} is not implemented on web`);\n }\n\n async logout(options: {\n provider: \"apple\" | \"google\" | \"facebook\";\n }): Promise<void> {\n switch (options.provider) {\n case \"google\":\n // Google doesn't have a specific logout method for web\n // We can revoke the token if we have it stored\n console.log(\n \"Google logout: Token should be revoked on the client side if stored\",\n );\n break;\n case \"apple\":\n // Apple doesn't provide a logout method for web\n console.log(\n \"Apple logout: Session should be managed on the client side\",\n );\n break;\n case \"facebook\":\n // Implement Facebook logout when Facebook login is added\n console.log(\"Facebook logout not implemented\");\n break;\n default:\n throw new Error(`Logout for ${options.provider} is not implemented`);\n }\n }\n\n async isLoggedIn(\n options: isLoggedInOptions,\n ): Promise<{ isLoggedIn: boolean }> {\n switch (options.provider) {\n case \"google\":\n // For Google, we can check if there's a valid token\n const googleUser = await this.getGoogleUser();\n return { isLoggedIn: !!googleUser };\n case \"apple\":\n // Apple doesn't provide a method to check login status on web\n console.log(\"Apple login status should be managed on the client side\");\n return { isLoggedIn: false };\n case \"facebook\":\n // Implement Facebook isLoggedIn when Facebook login is added\n console.log(\"Facebook isLoggedIn not implemented\");\n return { isLoggedIn: false };\n default:\n throw new Error(\n `isLoggedIn for ${options.provider} is not implemented`,\n );\n }\n }\n\n async getAuthorizationCode(\n options: AuthorizationCodeOptions,\n ): Promise<AuthorizationCode> {\n switch (options.provider) {\n case \"google\":\n // For Google, we can use the id_token as the authorization code\n const googleUser = await this.getGoogleUser();\n if (googleUser && googleUser.credential) {\n return { jwt: googleUser.credential };\n }\n throw new Error(\"No Google authorization code available\");\n case \"apple\":\n // Apple authorization code should be obtained during login\n console.log(\"Apple authorization code should be stored during login\");\n throw new Error(\"Apple authorization code not available\");\n case \"facebook\":\n // Implement Facebook getAuthorizationCode when Facebook login is added\n console.log(\"Facebook getAuthorizationCode not implemented\");\n throw new Error(\"Facebook authorization code not available\");\n default:\n throw new Error(\n `getAuthorizationCode for ${options.provider} is not implemented`,\n );\n }\n }\n\n async refresh(options: LoginOptions): Promise<void> {\n switch (options.provider) {\n case \"google\":\n // For Google, we can prompt for re-authentication\n await this.loginWithGoogle(options.options);\n break;\n case \"apple\":\n // Apple doesn't provide a refresh method for web\n console.log(\"Apple refresh not available on web\");\n break;\n case \"facebook\":\n // Implement Facebook refresh when Facebook login is added\n console.log(\"Facebook refresh not implemented\");\n break;\n default:\n throw new Error(`Refresh for ${options.provider} is not implemented`);\n }\n }\n\n private async loginWithGoogle(options: any): Promise<LoginResult> {\n console.log(\"isLoggedIn\", options);\n if (!this.googleClientId) {\n throw new Error(\"Google Client ID not set. Call initialize() first.\");\n }\n\n return new Promise((resolve, reject) => {\n google.accounts.id.initialize({\n client_id: this.googleClientId!,\n callback: (response) => {\n console.log(\"google.accounts.id.initialize callback\", response);\n if (response.error) {\n reject(response.error);\n } else {\n const payload = this.parseJwt(response.credential);\n const result: GoogleLoginResponse = {\n accessToken: null,\n idToken: response.credential,\n profile: {\n email: payload.email || null,\n familyName: payload.family_name || null,\n givenName: payload.given_name || null,\n id: payload.sub || null,\n name: payload.name || null,\n imageUrl: payload.picture || null,\n },\n };\n resolve({ provider: \"google\", result });\n }\n },\n });\n\n google.accounts.id.prompt((notification) => {\n if (notification.isNotDisplayed() || notification.isSkippedMoment()) {\n console.log(\"OneTap is not displayed or skipped\");\n }\n console.log(\"OneTap is displayed\");\n });\n });\n }\n\n private parseJwt(token: string) {\n const base64Url = token.split(\".\")[1];\n const base64 = base64Url.replace(/-/g, \"+\").replace(/_/g, \"/\");\n const jsonPayload = decodeURIComponent(\n atob(base64)\n .split(\"\")\n .map((c) => {\n return \"%\" + (\"00\" + c.charCodeAt(0).toString(16)).slice(-2);\n })\n .join(\"\"),\n );\n return JSON.parse(jsonPayload);\n }\n\n private async loadGoogleScript(): Promise<void> {\n if (this.googleScriptLoaded) return;\n\n return new Promise((resolve, reject) => {\n const script = document.createElement(\"script\");\n script.src = \"https://accounts.google.com/gsi/client\";\n script.async = true;\n script.onload = () => {\n this.googleScriptLoaded = true;\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n\n private async loginWithApple(options: any): Promise<LoginResult> {\n if (!this.appleClientId) {\n throw new Error(\"Apple Client ID not set. Call initialize() first.\");\n }\n\n if (!this.appleScriptLoaded) {\n throw new Error(\"Apple Sign-In script not loaded.\");\n }\n\n return new Promise((resolve, reject) => {\n AppleID.auth.init({\n clientId: this.appleClientId!,\n scope: options.scopes?.join(\" \") || \"name email\",\n redirectURI: options.redirectUrl || window.location.href,\n state: options.state,\n nonce: options.nonce,\n usePopup: true,\n });\n\n AppleID.auth\n .signIn()\n .then((res: any) => {\n const result: AppleProviderResponse = {\n user: res.user?.name?.firstName\n ? `${res.user.name.firstName} ${res.user.name.lastName}`\n : null,\n email: res.user?.email || null,\n givenName: res.user?.name?.firstName || null,\n familyName: res.user?.name?.lastName || null,\n identityToken: res.authorization.id_token || null,\n authorizationCode: res.authorization.code || null,\n };\n resolve({ provider: \"apple\", result });\n })\n .catch((error: any) => {\n reject(error);\n });\n });\n }\n\n private async loadAppleScript(): Promise<void> {\n if (this.appleScriptLoaded) return;\n\n return new Promise((resolve, reject) => {\n const script = document.createElement(\"script\");\n script.src = this.appleScriptUrl;\n script.async = true;\n script.onload = () => {\n this.appleScriptLoaded = true;\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n\n private async getGoogleUser(): Promise<any> {\n return new Promise((resolve) => {\n google.accounts.id.initialize({\n client_id: this.googleClientId!,\n callback: (response) => {\n resolve(response);\n },\n });\n google.accounts.id.prompt((notification) => {\n if (notification.isNotDisplayed() || notification.isSkippedMoment()) {\n resolve(null);\n }\n });\n });\n }\n}\n"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AM,KAAK,WAAW,EAAE,CAAC;oBACpC,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,uBAAuB,EAAE,EAAE,CAAC,QAAa,EAAE,EAAE;;wBACnE,MAAM,MAAM,GAA0B;4BACpC,WAAW,EAAE;gCACX,KAAK,EAAE,QAAQ,CAAC,YAAY,CAAC,WAAW;gCACxC,MAAM,EAAE,QAAQ,CAAC,YAAY,CAAC,MAAM;6BACrC;4BACD,OAAO,EAAE;gCACP,MAAM,EAAE,QAAQ,CAAC,EAAE;gCACnB,IAAI,EAAE,QAAQ,CAAC,IAAI;gCACnB,KAAK,EAAE,QAAQ,CAAC,KAAK,IAAI,IAAI;gCAC7B,QAAQ,EAAE,CAAA,MAAA,MAAA,QAAQ,CAAC,OAAO,0CAAE,IAAI,0CAAE,GAAG,KAAI,IAAI;gCAC7C,SAAS,EAAE,EAAE;gCACb,QAAQ,EAAE,IAAI;gCACd,QAAQ,EAAE,IAAI;gCACd,MAAM,EAAE,IAAI;gCACZ,QAAQ,EAAE,IAAI;gCACd,QAAQ,EAAE,IAAI;gCACd,UAAU,EAAE,IAAI;6BACjB;4BACD,mBAAmB,EAAE,IAAI;yBAC1B,CAAC;wBACF,OAAO,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CAAC;oBAC5C,CAAC,CAAC,CAAC;gBACL,CAAC;qBAAM,CAAC;oBACN,MAAM,CAAC,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC,CAAC;gBAC7C,CAAC;YACH,CAAC,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { WebPlugin } from \"@capacitor/core\";\n\nimport type {\n SocialLoginPlugin,\n InitializeOptions,\n LoginOptions,\n LoginResult,\n AuthorizationCode,\n GoogleLoginResponse,\n AppleProviderResponse,\n isLoggedInOptions,\n AuthorizationCodeOptions,\n FacebookLoginOptions,\n FacebookLoginResponse,\n} from \"./definitions\";\n\n// Add this declaration at the top of the file\ndeclare const google: {\n accounts: {\n id: {\n initialize(config: {\n client_id: string;\n callback: (response: any) => void;\n }): void;\n prompt(callback: (notification: any) => void): void;\n };\n };\n};\n\ndeclare const AppleID: any;\n\ndeclare const FB: {\n init(options: any): void;\n login(\n callback: (response: { status: string; authResponse: { accessToken: string; userID: string } }) => void,\n options?: { scope: string }\n ): void;\n logout(callback: () => void): void;\n api(\n path: string,\n params: { fields: string },\n callback: (response: any) => void\n ): void;\n getLoginStatus(\n callback: (response: { status: string; authResponse?: { accessToken: string } }) => void\n ): void;\n};\n\nexport class SocialLoginWeb extends WebPlugin implements SocialLoginPlugin {\n private googleClientId: string | null = null;\n private appleClientId: string | null = null;\n private googleScriptLoaded = false;\n private appleScriptLoaded = false;\n private appleScriptUrl =\n \"https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js\";\n private facebookAppId: string | null = null;\n private facebookScriptLoaded = false;\n\n async initialize(options: InitializeOptions): Promise<void> {\n if (options.google?.webClientId) {\n this.googleClientId = options.google.webClientId;\n await this.loadGoogleScript();\n }\n if (options.apple?.clientId) {\n this.appleClientId = options.apple.clientId;\n await this.loadAppleScript();\n }\n if (options.facebook?.appId) {\n this.facebookAppId = options.facebook.appId;\n await this.loadFacebookScript();\n FB.init({\n appId: this.facebookAppId,\n version: 'v17.0',\n xfbml: true,\n cookie: true,\n });\n }\n // Implement initialization for other providers if needed\n }\n\n async login(options: LoginOptions): Promise<LoginResult> {\n if (options.provider === \"google\") {\n return this.loginWithGoogle(options.options);\n } else if (options.provider === \"apple\") {\n return this.loginWithApple(options.options);\n } else if (options.provider === \"facebook\") {\n return this.loginWithFacebook(options.options as FacebookLoginOptions);\n }\n // Implement login for other providers\n throw new Error(`Login for ${options.provider} is not implemented on web`);\n }\n\n async logout(options: {\n provider: \"apple\" | \"google\" | \"facebook\";\n }): Promise<void> {\n switch (options.provider) {\n case \"google\":\n // Google doesn't have a specific logout method for web\n // We can revoke the token if we have it stored\n console.log(\n \"Google logout: Token should be revoked on the client side if stored\",\n );\n break;\n case \"apple\":\n // Apple doesn't provide a logout method for web\n console.log(\n \"Apple logout: Session should be managed on the client side\",\n );\n break;\n case \"facebook\":\n return new Promise<void>((resolve) => {\n FB.logout(() => resolve());\n });\n default:\n throw new Error(`Logout for ${options.provider} is not implemented`);\n }\n }\n\n async isLoggedIn(\n options: isLoggedInOptions,\n ): Promise<{ isLoggedIn: boolean }> {\n switch (options.provider) {\n case \"google\":\n // For Google, we can check if there's a valid token\n const googleUser = await this.getGoogleUser();\n return { isLoggedIn: !!googleUser };\n case \"apple\":\n // Apple doesn't provide a method to check login status on web\n console.log(\"Apple login status should be managed on the client side\");\n return { isLoggedIn: false };\n case \"facebook\":\n return new Promise((resolve) => {\n FB.getLoginStatus((response) => {\n resolve({ isLoggedIn: response.status === 'connected' });\n });\n });\n default:\n throw new Error(\n `isLoggedIn for ${options.provider} is not implemented`,\n );\n }\n }\n\n async getAuthorizationCode(\n options: AuthorizationCodeOptions,\n ): Promise<AuthorizationCode> {\n switch (options.provider) {\n case \"google\":\n // For Google, we can use the id_token as the authorization code\n const googleUser = await this.getGoogleUser();\n if (googleUser && googleUser.credential) {\n return { jwt: googleUser.credential };\n }\n throw new Error(\"No Google authorization code available\");\n case \"apple\":\n // Apple authorization code should be obtained during login\n console.log(\"Apple authorization code should be stored during login\");\n throw new Error(\"Apple authorization code not available\");\n case \"facebook\":\n return new Promise((resolve, reject) => {\n FB.getLoginStatus((response) => {\n if (response.status === 'connected') {\n resolve({ jwt: response.authResponse?.accessToken || \"\" });\n } else {\n reject(new Error(\"No Facebook authorization code available\"));\n }\n });\n });\n default:\n throw new Error(\n `getAuthorizationCode for ${options.provider} is not implemented`,\n );\n }\n }\n\n async refresh(options: LoginOptions): Promise<void> {\n switch (options.provider) {\n case \"google\":\n // For Google, we can prompt for re-authentication\n await this.loginWithGoogle(options.options);\n break;\n case \"apple\":\n // Apple doesn't provide a refresh method for web\n console.log(\"Apple refresh not available on web\");\n break;\n case \"facebook\":\n await this.loginWithFacebook(options.options as FacebookLoginOptions);\n break;\n default:\n throw new Error(`Refresh for ${options.provider} is not implemented`);\n }\n }\n\n private async loginWithGoogle(options: any): Promise<LoginResult> {\n console.log(\"isLoggedIn\", options);\n if (!this.googleClientId) {\n throw new Error(\"Google Client ID not set. Call initialize() first.\");\n }\n\n return new Promise((resolve, reject) => {\n google.accounts.id.initialize({\n client_id: this.googleClientId!,\n callback: (response) => {\n console.log(\"google.accounts.id.initialize callback\", response);\n if (response.error) {\n reject(response.error);\n } else {\n const payload = this.parseJwt(response.credential);\n const result: GoogleLoginResponse = {\n accessToken: null,\n idToken: response.credential,\n profile: {\n email: payload.email || null,\n familyName: payload.family_name || null,\n givenName: payload.given_name || null,\n id: payload.sub || null,\n name: payload.name || null,\n imageUrl: payload.picture || null,\n },\n };\n resolve({ provider: \"google\", result });\n }\n },\n });\n\n google.accounts.id.prompt((notification) => {\n if (notification.isNotDisplayed() || notification.isSkippedMoment()) {\n console.log(\"OneTap is not displayed or skipped\");\n }\n console.log(\"OneTap is displayed\");\n });\n });\n }\n\n private parseJwt(token: string) {\n const base64Url = token.split(\".\")[1];\n const base64 = base64Url.replace(/-/g, \"+\").replace(/_/g, \"/\");\n const jsonPayload = decodeURIComponent(\n atob(base64)\n .split(\"\")\n .map((c) => {\n return \"%\" + (\"00\" + c.charCodeAt(0).toString(16)).slice(-2);\n })\n .join(\"\"),\n );\n return JSON.parse(jsonPayload);\n }\n\n private async loadGoogleScript(): Promise<void> {\n if (this.googleScriptLoaded) return;\n\n return new Promise((resolve, reject) => {\n const script = document.createElement(\"script\");\n script.src = \"https://accounts.google.com/gsi/client\";\n script.async = true;\n script.onload = () => {\n this.googleScriptLoaded = true;\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n\n private async loginWithApple(options: any): Promise<LoginResult> {\n if (!this.appleClientId) {\n throw new Error(\"Apple Client ID not set. Call initialize() first.\");\n }\n\n if (!this.appleScriptLoaded) {\n throw new Error(\"Apple Sign-In script not loaded.\");\n }\n\n return new Promise((resolve, reject) => {\n AppleID.auth.init({\n clientId: this.appleClientId!,\n scope: options.scopes?.join(\" \") || \"name email\",\n redirectURI: options.redirectUrl || window.location.href,\n state: options.state,\n nonce: options.nonce,\n usePopup: true,\n });\n\n AppleID.auth\n .signIn()\n .then((res: any) => {\n const result: AppleProviderResponse = {\n user: res.user?.name?.firstName\n ? `${res.user.name.firstName} ${res.user.name.lastName}`\n : null,\n email: res.user?.email || null,\n givenName: res.user?.name?.firstName || null,\n familyName: res.user?.name?.lastName || null,\n identityToken: res.authorization.id_token || null,\n authorizationCode: res.authorization.code || null,\n };\n resolve({ provider: \"apple\", result });\n })\n .catch((error: any) => {\n reject(error);\n });\n });\n }\n\n private async loadAppleScript(): Promise<void> {\n if (this.appleScriptLoaded) return;\n\n return new Promise((resolve, reject) => {\n const script = document.createElement(\"script\");\n script.src = this.appleScriptUrl;\n script.async = true;\n script.onload = () => {\n this.appleScriptLoaded = true;\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n\n private async getGoogleUser(): Promise<any> {\n return new Promise((resolve) => {\n google.accounts.id.initialize({\n client_id: this.googleClientId!,\n callback: (response) => {\n resolve(response);\n },\n });\n google.accounts.id.prompt((notification) => {\n if (notification.isNotDisplayed() || notification.isSkippedMoment()) {\n resolve(null);\n }\n });\n });\n }\n\n private async loadFacebookScript(): Promise<void> {\n if (this.facebookScriptLoaded) return;\n\n return new Promise((resolve, reject) => {\n const script = document.createElement('script');\n script.src = 'https://connect.facebook.net/en_US/sdk.js';\n script.async = true;\n script.defer = true;\n script.onload = () => {\n this.facebookScriptLoaded = true;\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n\n private async loginWithFacebook(options: FacebookLoginOptions): Promise<LoginResult> {\n if (!this.facebookAppId) {\n throw new Error(\"Facebook App ID not set. Call initialize() first.\");\n }\n\n return new Promise((resolve, reject) => {\n FB.login((response) => {\n if (response.status === 'connected') {\n FB.api('/me', { fields: 'id,name,email,picture' }, (userInfo: any) => {\n const result: FacebookLoginResponse = {\n accessToken: {\n token: response.authResponse.accessToken,\n userId: response.authResponse.userID,\n },\n profile: {\n userID: userInfo.id,\n name: userInfo.name,\n email: userInfo.email || null,\n imageURL: userInfo.picture?.data?.url || null,\n friendIDs: [],\n birthday: null,\n ageRange: null,\n gender: null,\n location: null,\n hometown: null,\n profileURL: null,\n },\n authenticationToken: null,\n };\n resolve({ provider: \"facebook\", result });\n });\n } else {\n reject(new Error(\"Facebook login failed\"));\n }\n }, { scope: options.permissions.join(',') });\n });\n }\n}\n"]}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -14,9 +14,11 @@ class SocialLoginWeb extends core.WebPlugin {
|
|
|
14
14
|
this.googleScriptLoaded = false;
|
|
15
15
|
this.appleScriptLoaded = false;
|
|
16
16
|
this.appleScriptUrl = "https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js";
|
|
17
|
+
this.facebookAppId = null;
|
|
18
|
+
this.facebookScriptLoaded = false;
|
|
17
19
|
}
|
|
18
20
|
async initialize(options) {
|
|
19
|
-
var _a, _b;
|
|
21
|
+
var _a, _b, _c;
|
|
20
22
|
if ((_a = options.google) === null || _a === void 0 ? void 0 : _a.webClientId) {
|
|
21
23
|
this.googleClientId = options.google.webClientId;
|
|
22
24
|
await this.loadGoogleScript();
|
|
@@ -25,6 +27,16 @@ class SocialLoginWeb extends core.WebPlugin {
|
|
|
25
27
|
this.appleClientId = options.apple.clientId;
|
|
26
28
|
await this.loadAppleScript();
|
|
27
29
|
}
|
|
30
|
+
if ((_c = options.facebook) === null || _c === void 0 ? void 0 : _c.appId) {
|
|
31
|
+
this.facebookAppId = options.facebook.appId;
|
|
32
|
+
await this.loadFacebookScript();
|
|
33
|
+
FB.init({
|
|
34
|
+
appId: this.facebookAppId,
|
|
35
|
+
version: 'v17.0',
|
|
36
|
+
xfbml: true,
|
|
37
|
+
cookie: true,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
28
40
|
// Implement initialization for other providers if needed
|
|
29
41
|
}
|
|
30
42
|
async login(options) {
|
|
@@ -34,6 +46,9 @@ class SocialLoginWeb extends core.WebPlugin {
|
|
|
34
46
|
else if (options.provider === "apple") {
|
|
35
47
|
return this.loginWithApple(options.options);
|
|
36
48
|
}
|
|
49
|
+
else if (options.provider === "facebook") {
|
|
50
|
+
return this.loginWithFacebook(options.options);
|
|
51
|
+
}
|
|
37
52
|
// Implement login for other providers
|
|
38
53
|
throw new Error(`Login for ${options.provider} is not implemented on web`);
|
|
39
54
|
}
|
|
@@ -49,9 +64,9 @@ class SocialLoginWeb extends core.WebPlugin {
|
|
|
49
64
|
console.log("Apple logout: Session should be managed on the client side");
|
|
50
65
|
break;
|
|
51
66
|
case "facebook":
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
67
|
+
return new Promise((resolve) => {
|
|
68
|
+
FB.logout(() => resolve());
|
|
69
|
+
});
|
|
55
70
|
default:
|
|
56
71
|
throw new Error(`Logout for ${options.provider} is not implemented`);
|
|
57
72
|
}
|
|
@@ -67,9 +82,11 @@ class SocialLoginWeb extends core.WebPlugin {
|
|
|
67
82
|
console.log("Apple login status should be managed on the client side");
|
|
68
83
|
return { isLoggedIn: false };
|
|
69
84
|
case "facebook":
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
85
|
+
return new Promise((resolve) => {
|
|
86
|
+
FB.getLoginStatus((response) => {
|
|
87
|
+
resolve({ isLoggedIn: response.status === 'connected' });
|
|
88
|
+
});
|
|
89
|
+
});
|
|
73
90
|
default:
|
|
74
91
|
throw new Error(`isLoggedIn for ${options.provider} is not implemented`);
|
|
75
92
|
}
|
|
@@ -88,9 +105,17 @@ class SocialLoginWeb extends core.WebPlugin {
|
|
|
88
105
|
console.log("Apple authorization code should be stored during login");
|
|
89
106
|
throw new Error("Apple authorization code not available");
|
|
90
107
|
case "facebook":
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
108
|
+
return new Promise((resolve, reject) => {
|
|
109
|
+
FB.getLoginStatus((response) => {
|
|
110
|
+
var _a;
|
|
111
|
+
if (response.status === 'connected') {
|
|
112
|
+
resolve({ jwt: ((_a = response.authResponse) === null || _a === void 0 ? void 0 : _a.accessToken) || "" });
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
reject(new Error("No Facebook authorization code available"));
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
});
|
|
94
119
|
default:
|
|
95
120
|
throw new Error(`getAuthorizationCode for ${options.provider} is not implemented`);
|
|
96
121
|
}
|
|
@@ -106,8 +131,7 @@ class SocialLoginWeb extends core.WebPlugin {
|
|
|
106
131
|
console.log("Apple refresh not available on web");
|
|
107
132
|
break;
|
|
108
133
|
case "facebook":
|
|
109
|
-
|
|
110
|
-
console.log("Facebook refresh not implemented");
|
|
134
|
+
await this.loginWithFacebook(options.options);
|
|
111
135
|
break;
|
|
112
136
|
default:
|
|
113
137
|
throw new Error(`Refresh for ${options.provider} is not implemented`);
|
|
@@ -246,6 +270,60 @@ class SocialLoginWeb extends core.WebPlugin {
|
|
|
246
270
|
});
|
|
247
271
|
});
|
|
248
272
|
}
|
|
273
|
+
async loadFacebookScript() {
|
|
274
|
+
if (this.facebookScriptLoaded)
|
|
275
|
+
return;
|
|
276
|
+
return new Promise((resolve, reject) => {
|
|
277
|
+
const script = document.createElement('script');
|
|
278
|
+
script.src = 'https://connect.facebook.net/en_US/sdk.js';
|
|
279
|
+
script.async = true;
|
|
280
|
+
script.defer = true;
|
|
281
|
+
script.onload = () => {
|
|
282
|
+
this.facebookScriptLoaded = true;
|
|
283
|
+
resolve();
|
|
284
|
+
};
|
|
285
|
+
script.onerror = reject;
|
|
286
|
+
document.body.appendChild(script);
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
async loginWithFacebook(options) {
|
|
290
|
+
if (!this.facebookAppId) {
|
|
291
|
+
throw new Error("Facebook App ID not set. Call initialize() first.");
|
|
292
|
+
}
|
|
293
|
+
return new Promise((resolve, reject) => {
|
|
294
|
+
FB.login((response) => {
|
|
295
|
+
if (response.status === 'connected') {
|
|
296
|
+
FB.api('/me', { fields: 'id,name,email,picture' }, (userInfo) => {
|
|
297
|
+
var _a, _b;
|
|
298
|
+
const result = {
|
|
299
|
+
accessToken: {
|
|
300
|
+
token: response.authResponse.accessToken,
|
|
301
|
+
userId: response.authResponse.userID,
|
|
302
|
+
},
|
|
303
|
+
profile: {
|
|
304
|
+
userID: userInfo.id,
|
|
305
|
+
name: userInfo.name,
|
|
306
|
+
email: userInfo.email || null,
|
|
307
|
+
imageURL: ((_b = (_a = userInfo.picture) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.url) || null,
|
|
308
|
+
friendIDs: [],
|
|
309
|
+
birthday: null,
|
|
310
|
+
ageRange: null,
|
|
311
|
+
gender: null,
|
|
312
|
+
location: null,
|
|
313
|
+
hometown: null,
|
|
314
|
+
profileURL: null,
|
|
315
|
+
},
|
|
316
|
+
authenticationToken: null,
|
|
317
|
+
};
|
|
318
|
+
resolve({ provider: "facebook", result });
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
reject(new Error("Facebook login failed"));
|
|
323
|
+
}
|
|
324
|
+
}, { scope: options.permissions.join(',') });
|
|
325
|
+
});
|
|
326
|
+
}
|
|
249
327
|
}
|
|
250
328
|
|
|
251
329
|
var web = /*#__PURE__*/Object.freeze({
|
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nconst SocialLogin = registerPlugin(\"SocialLogin\", {\n web: () => import(\"./web\").then((m) => new m.SocialLoginWeb()),\n});\nexport * from \"./definitions\";\nexport { SocialLogin };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nexport class SocialLoginWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.googleClientId = null;\n this.appleClientId = null;\n this.googleScriptLoaded = false;\n this.appleScriptLoaded = false;\n this.appleScriptUrl = \"https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js\";\n }\n async initialize(options) {\n var _a, _b;\n if ((_a = options.google) === null || _a === void 0 ? void 0 : _a.webClientId) {\n this.googleClientId = options.google.webClientId;\n await this.loadGoogleScript();\n }\n if ((_b = options.apple) === null || _b === void 0 ? void 0 : _b.clientId) {\n this.appleClientId = options.apple.clientId;\n await this.loadAppleScript();\n }\n // Implement initialization for other providers if needed\n }\n async login(options) {\n if (options.provider === \"google\") {\n return this.loginWithGoogle(options.options);\n }\n else if (options.provider === \"apple\") {\n return this.loginWithApple(options.options);\n }\n // Implement login for other providers\n throw new Error(`Login for ${options.provider} is not implemented on web`);\n }\n async logout(options) {\n switch (options.provider) {\n case \"google\":\n // Google doesn't have a specific logout method for web\n // We can revoke the token if we have it stored\n console.log(\"Google logout: Token should be revoked on the client side if stored\");\n break;\n case \"apple\":\n // Apple doesn't provide a logout method for web\n console.log(\"Apple logout: Session should be managed on the client side\");\n break;\n case \"facebook\":\n // Implement Facebook logout when Facebook login is added\n console.log(\"Facebook logout not implemented\");\n break;\n default:\n throw new Error(`Logout for ${options.provider} is not implemented`);\n }\n }\n async isLoggedIn(options) {\n switch (options.provider) {\n case \"google\":\n // For Google, we can check if there's a valid token\n const googleUser = await this.getGoogleUser();\n return { isLoggedIn: !!googleUser };\n case \"apple\":\n // Apple doesn't provide a method to check login status on web\n console.log(\"Apple login status should be managed on the client side\");\n return { isLoggedIn: false };\n case \"facebook\":\n // Implement Facebook isLoggedIn when Facebook login is added\n console.log(\"Facebook isLoggedIn not implemented\");\n return { isLoggedIn: false };\n default:\n throw new Error(`isLoggedIn for ${options.provider} is not implemented`);\n }\n }\n async getAuthorizationCode(options) {\n switch (options.provider) {\n case \"google\":\n // For Google, we can use the id_token as the authorization code\n const googleUser = await this.getGoogleUser();\n if (googleUser && googleUser.credential) {\n return { jwt: googleUser.credential };\n }\n throw new Error(\"No Google authorization code available\");\n case \"apple\":\n // Apple authorization code should be obtained during login\n console.log(\"Apple authorization code should be stored during login\");\n throw new Error(\"Apple authorization code not available\");\n case \"facebook\":\n // Implement Facebook getAuthorizationCode when Facebook login is added\n console.log(\"Facebook getAuthorizationCode not implemented\");\n throw new Error(\"Facebook authorization code not available\");\n default:\n throw new Error(`getAuthorizationCode for ${options.provider} is not implemented`);\n }\n }\n async refresh(options) {\n switch (options.provider) {\n case \"google\":\n // For Google, we can prompt for re-authentication\n await this.loginWithGoogle(options.options);\n break;\n case \"apple\":\n // Apple doesn't provide a refresh method for web\n console.log(\"Apple refresh not available on web\");\n break;\n case \"facebook\":\n // Implement Facebook refresh when Facebook login is added\n console.log(\"Facebook refresh not implemented\");\n break;\n default:\n throw new Error(`Refresh for ${options.provider} is not implemented`);\n }\n }\n async loginWithGoogle(options) {\n console.log(\"isLoggedIn\", options);\n if (!this.googleClientId) {\n throw new Error(\"Google Client ID not set. Call initialize() first.\");\n }\n return new Promise((resolve, reject) => {\n google.accounts.id.initialize({\n client_id: this.googleClientId,\n callback: (response) => {\n console.log(\"google.accounts.id.initialize callback\", response);\n if (response.error) {\n reject(response.error);\n }\n else {\n const payload = this.parseJwt(response.credential);\n const result = {\n accessToken: null,\n idToken: response.credential,\n profile: {\n email: payload.email || null,\n familyName: payload.family_name || null,\n givenName: payload.given_name || null,\n id: payload.sub || null,\n name: payload.name || null,\n imageUrl: payload.picture || null,\n },\n };\n resolve({ provider: \"google\", result });\n }\n },\n });\n google.accounts.id.prompt((notification) => {\n if (notification.isNotDisplayed() || notification.isSkippedMoment()) {\n console.log(\"OneTap is not displayed or skipped\");\n }\n console.log(\"OneTap is displayed\");\n });\n });\n }\n parseJwt(token) {\n const base64Url = token.split(\".\")[1];\n const base64 = base64Url.replace(/-/g, \"+\").replace(/_/g, \"/\");\n const jsonPayload = decodeURIComponent(atob(base64)\n .split(\"\")\n .map((c) => {\n return \"%\" + (\"00\" + c.charCodeAt(0).toString(16)).slice(-2);\n })\n .join(\"\"));\n return JSON.parse(jsonPayload);\n }\n async loadGoogleScript() {\n if (this.googleScriptLoaded)\n return;\n return new Promise((resolve, reject) => {\n const script = document.createElement(\"script\");\n script.src = \"https://accounts.google.com/gsi/client\";\n script.async = true;\n script.onload = () => {\n this.googleScriptLoaded = true;\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n async loginWithApple(options) {\n if (!this.appleClientId) {\n throw new Error(\"Apple Client ID not set. Call initialize() first.\");\n }\n if (!this.appleScriptLoaded) {\n throw new Error(\"Apple Sign-In script not loaded.\");\n }\n return new Promise((resolve, reject) => {\n var _a;\n AppleID.auth.init({\n clientId: this.appleClientId,\n scope: ((_a = options.scopes) === null || _a === void 0 ? void 0 : _a.join(\" \")) || \"name email\",\n redirectURI: options.redirectUrl || window.location.href,\n state: options.state,\n nonce: options.nonce,\n usePopup: true,\n });\n AppleID.auth\n .signIn()\n .then((res) => {\n var _a, _b, _c, _d, _e, _f, _g;\n const result = {\n user: ((_b = (_a = res.user) === null || _a === void 0 ? void 0 : _a.name) === null || _b === void 0 ? void 0 : _b.firstName)\n ? `${res.user.name.firstName} ${res.user.name.lastName}`\n : null,\n email: ((_c = res.user) === null || _c === void 0 ? void 0 : _c.email) || null,\n givenName: ((_e = (_d = res.user) === null || _d === void 0 ? void 0 : _d.name) === null || _e === void 0 ? void 0 : _e.firstName) || null,\n familyName: ((_g = (_f = res.user) === null || _f === void 0 ? void 0 : _f.name) === null || _g === void 0 ? void 0 : _g.lastName) || null,\n identityToken: res.authorization.id_token || null,\n authorizationCode: res.authorization.code || null,\n };\n resolve({ provider: \"apple\", result });\n })\n .catch((error) => {\n reject(error);\n });\n });\n }\n async loadAppleScript() {\n if (this.appleScriptLoaded)\n return;\n return new Promise((resolve, reject) => {\n const script = document.createElement(\"script\");\n script.src = this.appleScriptUrl;\n script.async = true;\n script.onload = () => {\n this.appleScriptLoaded = true;\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n async getGoogleUser() {\n return new Promise((resolve) => {\n google.accounts.id.initialize({\n client_id: this.googleClientId,\n callback: (response) => {\n resolve(response);\n },\n });\n google.accounts.id.prompt((notification) => {\n if (notification.isNotDisplayed() || notification.isSkippedMoment()) {\n resolve(null);\n }\n });\n });\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,WAAW,GAAGA,mBAAc,CAAC,aAAa,EAAE;AAClD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,cAAc,EAAE,CAAC;AAClE,CAAC;;ACFM,MAAM,cAAc,SAASC,cAAS,CAAC;AAC9C,IAAI,WAAW,GAAG;AAClB,QAAQ,KAAK,CAAC,GAAG,SAAS,CAAC,CAAC;AAC5B,QAAQ,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;AACnC,QAAQ,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;AAClC,QAAQ,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;AACxC,QAAQ,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC;AACvC,QAAQ,IAAI,CAAC,cAAc,GAAG,sFAAsF,CAAC;AACrH,KAAK;AACL,IAAI,MAAM,UAAU,CAAC,OAAO,EAAE;AAC9B,QAAQ,IAAI,EAAE,EAAE,EAAE,CAAC;AACnB,QAAQ,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC,MAAM,MAAM,IAAI,IAAI,EAAE,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;AACvF,YAAY,IA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CAAC,CAAC;AACX,KAAK;AACL,IAAI,MAAM,aAAa,GAAG;AAC1B,QAAQ,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,KAAK;AACxC,YAAY,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,UAAU,CAAC;AAC1C,gBAAgB,SAAS,EAAE,IAAI,CAAC,cAAc;AAC9C,gBAAgB,QAAQ,EAAE,CAAC,QAAQ,KAAK;AACxC,oBAAoB,OAAO,CAAC,QAAQ,CAAC,CAAC;AACtC,iBAAiB;AACjB,aAAa,CAAC,CAAC;AACf,YAAY,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,YAAY,KAAK;AACxD,gBAAgB,IAAI,YAAY,CAAC,cAAc,EAAE,IAAI,YAAY,CAAC,eAAe,EAAE,EAAE;AACrF,oBAAoB,OAAO,CAAC,IAAI,CAAC,CAAC;AAClC,iBAAiB;AACjB,aAAa,CAAC,CAAC;AACf,SAAS,CAAC,CAAC;AACX,KAAK;AACL;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nconst SocialLogin = registerPlugin(\"SocialLogin\", {\n web: () => import(\"./web\").then((m) => new m.SocialLoginWeb()),\n});\nexport * from \"./definitions\";\nexport { SocialLogin };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nexport class SocialLoginWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.googleClientId = null;\n this.appleClientId = null;\n this.googleScriptLoaded = false;\n this.appleScriptLoaded = false;\n this.appleScriptUrl = \"https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js\";\n this.facebookAppId = null;\n this.facebookScriptLoaded = false;\n }\n async initialize(options) {\n var _a, _b, _c;\n if ((_a = options.google) === null || _a === void 0 ? void 0 : _a.webClientId) {\n this.googleClientId = options.google.webClientId;\n await this.loadGoogleScript();\n }\n if ((_b = options.apple) === null || _b === void 0 ? void 0 : _b.clientId) {\n this.appleClientId = options.apple.clientId;\n await this.loadAppleScript();\n }\n if ((_c = options.facebook) === null || _c === void 0 ? void 0 : _c.appId) {\n this.facebookAppId = options.facebook.appId;\n await this.loadFacebookScript();\n FB.init({\n appId: this.facebookAppId,\n version: 'v17.0',\n xfbml: true,\n cookie: true,\n });\n }\n // Implement initialization for other providers if needed\n }\n async login(options) {\n if (options.provider === \"google\") {\n return this.loginWithGoogle(options.options);\n }\n else if (options.provider === \"apple\") {\n return this.loginWithApple(options.options);\n }\n else if (options.provider === \"facebook\") {\n return this.loginWithFacebook(options.options);\n }\n // Implement login for other providers\n throw new Error(`Login for ${options.provider} is not implemented on web`);\n }\n async logout(options) {\n switch (options.provider) {\n case \"google\":\n // Google doesn't have a specific logout method for web\n // We can revoke the token if we have it stored\n console.log(\"Google logout: Token should be revoked on the client side if stored\");\n break;\n case \"apple\":\n // Apple doesn't provide a logout method for web\n console.log(\"Apple logout: Session should be managed on the client side\");\n break;\n case \"facebook\":\n return new Promise((resolve) => {\n FB.logout(() => resolve());\n });\n default:\n throw new Error(`Logout for ${options.provider} is not implemented`);\n }\n }\n async isLoggedIn(options) {\n switch (options.provider) {\n case \"google\":\n // For Google, we can check if there's a valid token\n const googleUser = await this.getGoogleUser();\n return { isLoggedIn: !!googleUser };\n case \"apple\":\n // Apple doesn't provide a method to check login status on web\n console.log(\"Apple login status should be managed on the client side\");\n return { isLoggedIn: false };\n case \"facebook\":\n return new Promise((resolve) => {\n FB.getLoginStatus((response) => {\n resolve({ isLoggedIn: response.status === 'connected' });\n });\n });\n default:\n throw new Error(`isLoggedIn for ${options.provider} is not implemented`);\n }\n }\n async getAuthorizationCode(options) {\n switch (options.provider) {\n case \"google\":\n // For Google, we can use the id_token as the authorization code\n const googleUser = await this.getGoogleUser();\n if (googleUser && googleUser.credential) {\n return { jwt: googleUser.credential };\n }\n throw new Error(\"No Google authorization code available\");\n case \"apple\":\n // Apple authorization code should be obtained during login\n console.log(\"Apple authorization code should be stored during login\");\n throw new Error(\"Apple authorization code not available\");\n case \"facebook\":\n return new Promise((resolve, reject) => {\n FB.getLoginStatus((response) => {\n var _a;\n if (response.status === 'connected') {\n resolve({ jwt: ((_a = response.authResponse) === null || _a === void 0 ? void 0 : _a.accessToken) || \"\" });\n }\n else {\n reject(new Error(\"No Facebook authorization code available\"));\n }\n });\n });\n default:\n throw new Error(`getAuthorizationCode for ${options.provider} is not implemented`);\n }\n }\n async refresh(options) {\n switch (options.provider) {\n case \"google\":\n // For Google, we can prompt for re-authentication\n await this.loginWithGoogle(options.options);\n break;\n case \"apple\":\n // Apple doesn't provide a refresh method for web\n console.log(\"Apple refresh not available on web\");\n break;\n case \"facebook\":\n await this.loginWithFacebook(options.options);\n break;\n default:\n throw new Error(`Refresh for ${options.provider} is not implemented`);\n }\n }\n async loginWithGoogle(options) {\n console.log(\"isLoggedIn\", options);\n if (!this.googleClientId) {\n throw new Error(\"Google Client ID not set. Call initialize() first.\");\n }\n return new Promise((resolve, reject) => {\n google.accounts.id.initialize({\n client_id: this.googleClientId,\n callback: (response) => {\n console.log(\"google.accounts.id.initialize callback\", response);\n if (response.error) {\n reject(response.error);\n }\n else {\n const payload = this.parseJwt(response.credential);\n const result = {\n accessToken: null,\n idToken: response.credential,\n profile: {\n email: payload.email || null,\n familyName: payload.family_name || null,\n givenName: payload.given_name || null,\n id: payload.sub || null,\n name: payload.name || null,\n imageUrl: payload.picture || null,\n },\n };\n resolve({ provider: \"google\", result });\n }\n },\n });\n google.accounts.id.prompt((notification) => {\n if (notification.isNotDisplayed() || notification.isSkippedMoment()) {\n console.log(\"OneTap is not displayed or skipped\");\n }\n console.log(\"OneTap is displayed\");\n });\n });\n }\n parseJwt(token) {\n const base64Url = token.split(\".\")[1];\n const base64 = base64Url.replace(/-/g, \"+\").replace(/_/g, \"/\");\n const jsonPayload = decodeURIComponent(atob(base64)\n .split(\"\")\n .map((c) => {\n return \"%\" + (\"00\" + c.charCodeAt(0).toString(16)).slice(-2);\n })\n .join(\"\"));\n return JSON.parse(jsonPayload);\n }\n async loadGoogleScript() {\n if (this.googleScriptLoaded)\n return;\n return new Promise((resolve, reject) => {\n const script = document.createElement(\"script\");\n script.src = \"https://accounts.google.com/gsi/client\";\n script.async = true;\n script.onload = () => {\n this.googleScriptLoaded = true;\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n async loginWithApple(options) {\n if (!this.appleClientId) {\n throw new Error(\"Apple Client ID not set. Call initialize() first.\");\n }\n if (!this.appleScriptLoaded) {\n throw new Error(\"Apple Sign-In script not loaded.\");\n }\n return new Promise((resolve, reject) => {\n var _a;\n AppleID.auth.init({\n clientId: this.appleClientId,\n scope: ((_a = options.scopes) === null || _a === void 0 ? void 0 : _a.join(\" \")) || \"name email\",\n redirectURI: options.redirectUrl || window.location.href,\n state: options.state,\n nonce: options.nonce,\n usePopup: true,\n });\n AppleID.auth\n .signIn()\n .then((res) => {\n var _a, _b, _c, _d, _e, _f, _g;\n const result = {\n user: ((_b = (_a = res.user) === null || _a === void 0 ? void 0 : _a.name) === null || _b === void 0 ? void 0 : _b.firstName)\n ? `${res.user.name.firstName} ${res.user.name.lastName}`\n : null,\n email: ((_c = res.user) === null || _c === void 0 ? void 0 : _c.email) || null,\n givenName: ((_e = (_d = res.user) === null || _d === void 0 ? void 0 : _d.name) === null || _e === void 0 ? void 0 : _e.firstName) || null,\n familyName: ((_g = (_f = res.user) === null || _f === void 0 ? void 0 : _f.name) === null || _g === void 0 ? void 0 : _g.lastName) || null,\n identityToken: res.authorization.id_token || null,\n authorizationCode: res.authorization.code || null,\n };\n resolve({ provider: \"apple\", result });\n })\n .catch((error) => {\n reject(error);\n });\n });\n }\n async loadAppleScript() {\n if (this.appleScriptLoaded)\n return;\n return new Promise((resolve, reject) => {\n const script = document.createElement(\"script\");\n script.src = this.appleScriptUrl;\n script.async = true;\n script.onload = () => {\n this.appleScriptLoaded = true;\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n async getGoogleUser() {\n return new Promise((resolve) => {\n google.accounts.id.initialize({\n client_id: this.googleClientId,\n callback: (response) => {\n resolve(response);\n },\n });\n google.accounts.id.prompt((notification) => {\n if (notification.isNotDisplayed() || notification.isSkippedMoment()) {\n resolve(null);\n }\n });\n });\n }\n async loadFacebookScript() {\n if (this.facebookScriptLoaded)\n return;\n return new Promise((resolve, reject) => {\n const script = document.createElement('script');\n script.src = 'https://connect.facebook.net/en_US/sdk.js';\n script.async = true;\n script.defer = true;\n script.onload = () => {\n this.facebookScriptLoaded = true;\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n async loginWithFacebook(options) {\n if (!this.facebookAppId) {\n throw new Error(\"Facebook App ID not set. Call initialize() first.\");\n }\n return new Promise((resolve, reject) => {\n FB.login((response) => {\n if (response.status === 'connected') {\n FB.api('/me', { fields: 'id,name,email,picture' }, (userInfo) => {\n var _a, _b;\n const result = {\n accessToken: {\n token: response.authResponse.accessToken,\n userId: response.authResponse.userID,\n },\n profile: {\n userID: userInfo.id,\n name: userInfo.name,\n email: userInfo.email || null,\n imageURL: ((_b = (_a = userInfo.picture) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.url) || null,\n friendIDs: [],\n birthday: null,\n ageRange: null,\n gender: null,\n location: null,\n hometown: null,\n profileURL: null,\n },\n authenticationToken: null,\n };\n resolve({ provider: \"facebook\", result });\n });\n }\n else {\n reject(new Error(\"Facebook login failed\"));\n }\n }, { scope: options.permissions.join(',') });\n });\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,WAAW,GAAGA,mBAAc,CAAC,aAAa,EAAE;AAClD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,cAAc,EAAE,CAAC;AAClE,CAAC;;ACFM,MAAM,cAA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oB,MAAM,CAAC,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC,CAAC;AAC/D,iBAAiB;AACjB,aAAa,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AACzD,SAAS,CAAC,CAAC;AACX,KAAK;AACL;;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
|
@@ -13,9 +13,11 @@ var capacitorCapacitorUpdater = (function (exports, core) {
|
|
|
13
13
|
this.googleScriptLoaded = false;
|
|
14
14
|
this.appleScriptLoaded = false;
|
|
15
15
|
this.appleScriptUrl = "https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js";
|
|
16
|
+
this.facebookAppId = null;
|
|
17
|
+
this.facebookScriptLoaded = false;
|
|
16
18
|
}
|
|
17
19
|
async initialize(options) {
|
|
18
|
-
var _a, _b;
|
|
20
|
+
var _a, _b, _c;
|
|
19
21
|
if ((_a = options.google) === null || _a === void 0 ? void 0 : _a.webClientId) {
|
|
20
22
|
this.googleClientId = options.google.webClientId;
|
|
21
23
|
await this.loadGoogleScript();
|
|
@@ -24,6 +26,16 @@ var capacitorCapacitorUpdater = (function (exports, core) {
|
|
|
24
26
|
this.appleClientId = options.apple.clientId;
|
|
25
27
|
await this.loadAppleScript();
|
|
26
28
|
}
|
|
29
|
+
if ((_c = options.facebook) === null || _c === void 0 ? void 0 : _c.appId) {
|
|
30
|
+
this.facebookAppId = options.facebook.appId;
|
|
31
|
+
await this.loadFacebookScript();
|
|
32
|
+
FB.init({
|
|
33
|
+
appId: this.facebookAppId,
|
|
34
|
+
version: 'v17.0',
|
|
35
|
+
xfbml: true,
|
|
36
|
+
cookie: true,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
27
39
|
// Implement initialization for other providers if needed
|
|
28
40
|
}
|
|
29
41
|
async login(options) {
|
|
@@ -33,6 +45,9 @@ var capacitorCapacitorUpdater = (function (exports, core) {
|
|
|
33
45
|
else if (options.provider === "apple") {
|
|
34
46
|
return this.loginWithApple(options.options);
|
|
35
47
|
}
|
|
48
|
+
else if (options.provider === "facebook") {
|
|
49
|
+
return this.loginWithFacebook(options.options);
|
|
50
|
+
}
|
|
36
51
|
// Implement login for other providers
|
|
37
52
|
throw new Error(`Login for ${options.provider} is not implemented on web`);
|
|
38
53
|
}
|
|
@@ -48,9 +63,9 @@ var capacitorCapacitorUpdater = (function (exports, core) {
|
|
|
48
63
|
console.log("Apple logout: Session should be managed on the client side");
|
|
49
64
|
break;
|
|
50
65
|
case "facebook":
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
66
|
+
return new Promise((resolve) => {
|
|
67
|
+
FB.logout(() => resolve());
|
|
68
|
+
});
|
|
54
69
|
default:
|
|
55
70
|
throw new Error(`Logout for ${options.provider} is not implemented`);
|
|
56
71
|
}
|
|
@@ -66,9 +81,11 @@ var capacitorCapacitorUpdater = (function (exports, core) {
|
|
|
66
81
|
console.log("Apple login status should be managed on the client side");
|
|
67
82
|
return { isLoggedIn: false };
|
|
68
83
|
case "facebook":
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
84
|
+
return new Promise((resolve) => {
|
|
85
|
+
FB.getLoginStatus((response) => {
|
|
86
|
+
resolve({ isLoggedIn: response.status === 'connected' });
|
|
87
|
+
});
|
|
88
|
+
});
|
|
72
89
|
default:
|
|
73
90
|
throw new Error(`isLoggedIn for ${options.provider} is not implemented`);
|
|
74
91
|
}
|
|
@@ -87,9 +104,17 @@ var capacitorCapacitorUpdater = (function (exports, core) {
|
|
|
87
104
|
console.log("Apple authorization code should be stored during login");
|
|
88
105
|
throw new Error("Apple authorization code not available");
|
|
89
106
|
case "facebook":
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
107
|
+
return new Promise((resolve, reject) => {
|
|
108
|
+
FB.getLoginStatus((response) => {
|
|
109
|
+
var _a;
|
|
110
|
+
if (response.status === 'connected') {
|
|
111
|
+
resolve({ jwt: ((_a = response.authResponse) === null || _a === void 0 ? void 0 : _a.accessToken) || "" });
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
reject(new Error("No Facebook authorization code available"));
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
});
|
|
93
118
|
default:
|
|
94
119
|
throw new Error(`getAuthorizationCode for ${options.provider} is not implemented`);
|
|
95
120
|
}
|
|
@@ -105,8 +130,7 @@ var capacitorCapacitorUpdater = (function (exports, core) {
|
|
|
105
130
|
console.log("Apple refresh not available on web");
|
|
106
131
|
break;
|
|
107
132
|
case "facebook":
|
|
108
|
-
|
|
109
|
-
console.log("Facebook refresh not implemented");
|
|
133
|
+
await this.loginWithFacebook(options.options);
|
|
110
134
|
break;
|
|
111
135
|
default:
|
|
112
136
|
throw new Error(`Refresh for ${options.provider} is not implemented`);
|
|
@@ -245,6 +269,60 @@ var capacitorCapacitorUpdater = (function (exports, core) {
|
|
|
245
269
|
});
|
|
246
270
|
});
|
|
247
271
|
}
|
|
272
|
+
async loadFacebookScript() {
|
|
273
|
+
if (this.facebookScriptLoaded)
|
|
274
|
+
return;
|
|
275
|
+
return new Promise((resolve, reject) => {
|
|
276
|
+
const script = document.createElement('script');
|
|
277
|
+
script.src = 'https://connect.facebook.net/en_US/sdk.js';
|
|
278
|
+
script.async = true;
|
|
279
|
+
script.defer = true;
|
|
280
|
+
script.onload = () => {
|
|
281
|
+
this.facebookScriptLoaded = true;
|
|
282
|
+
resolve();
|
|
283
|
+
};
|
|
284
|
+
script.onerror = reject;
|
|
285
|
+
document.body.appendChild(script);
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
async loginWithFacebook(options) {
|
|
289
|
+
if (!this.facebookAppId) {
|
|
290
|
+
throw new Error("Facebook App ID not set. Call initialize() first.");
|
|
291
|
+
}
|
|
292
|
+
return new Promise((resolve, reject) => {
|
|
293
|
+
FB.login((response) => {
|
|
294
|
+
if (response.status === 'connected') {
|
|
295
|
+
FB.api('/me', { fields: 'id,name,email,picture' }, (userInfo) => {
|
|
296
|
+
var _a, _b;
|
|
297
|
+
const result = {
|
|
298
|
+
accessToken: {
|
|
299
|
+
token: response.authResponse.accessToken,
|
|
300
|
+
userId: response.authResponse.userID,
|
|
301
|
+
},
|
|
302
|
+
profile: {
|
|
303
|
+
userID: userInfo.id,
|
|
304
|
+
name: userInfo.name,
|
|
305
|
+
email: userInfo.email || null,
|
|
306
|
+
imageURL: ((_b = (_a = userInfo.picture) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.url) || null,
|
|
307
|
+
friendIDs: [],
|
|
308
|
+
birthday: null,
|
|
309
|
+
ageRange: null,
|
|
310
|
+
gender: null,
|
|
311
|
+
location: null,
|
|
312
|
+
hometown: null,
|
|
313
|
+
profileURL: null,
|
|
314
|
+
},
|
|
315
|
+
authenticationToken: null,
|
|
316
|
+
};
|
|
317
|
+
resolve({ provider: "facebook", result });
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
else {
|
|
321
|
+
reject(new Error("Facebook login failed"));
|
|
322
|
+
}
|
|
323
|
+
}, { scope: options.permissions.join(',') });
|
|
324
|
+
});
|
|
325
|
+
}
|
|
248
326
|
}
|
|
249
327
|
|
|
250
328
|
var web = /*#__PURE__*/Object.freeze({
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nconst SocialLogin = registerPlugin(\"SocialLogin\", {\n web: () => import(\"./web\").then((m) => new m.SocialLoginWeb()),\n});\nexport * from \"./definitions\";\nexport { SocialLogin };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nexport class SocialLoginWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.googleClientId = null;\n this.appleClientId = null;\n this.googleScriptLoaded = false;\n this.appleScriptLoaded = false;\n this.appleScriptUrl = \"https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js\";\n }\n async initialize(options) {\n var _a, _b;\n if ((_a = options.google) === null || _a === void 0 ? void 0 : _a.webClientId) {\n this.googleClientId = options.google.webClientId;\n await this.loadGoogleScript();\n }\n if ((_b = options.apple) === null || _b === void 0 ? void 0 : _b.clientId) {\n this.appleClientId = options.apple.clientId;\n await this.loadAppleScript();\n }\n // Implement initialization for other providers if needed\n }\n async login(options) {\n if (options.provider === \"google\") {\n return this.loginWithGoogle(options.options);\n }\n else if (options.provider === \"apple\") {\n return this.loginWithApple(options.options);\n }\n // Implement login for other providers\n throw new Error(`Login for ${options.provider} is not implemented on web`);\n }\n async logout(options) {\n switch (options.provider) {\n case \"google\":\n // Google doesn't have a specific logout method for web\n // We can revoke the token if we have it stored\n console.log(\"Google logout: Token should be revoked on the client side if stored\");\n break;\n case \"apple\":\n // Apple doesn't provide a logout method for web\n console.log(\"Apple logout: Session should be managed on the client side\");\n break;\n case \"facebook\":\n // Implement Facebook logout when Facebook login is added\n console.log(\"Facebook logout not implemented\");\n break;\n default:\n throw new Error(`Logout for ${options.provider} is not implemented`);\n }\n }\n async isLoggedIn(options) {\n switch (options.provider) {\n case \"google\":\n // For Google, we can check if there's a valid token\n const googleUser = await this.getGoogleUser();\n return { isLoggedIn: !!googleUser };\n case \"apple\":\n // Apple doesn't provide a method to check login status on web\n console.log(\"Apple login status should be managed on the client side\");\n return { isLoggedIn: false };\n case \"facebook\":\n // Implement Facebook isLoggedIn when Facebook login is added\n console.log(\"Facebook isLoggedIn not implemented\");\n return { isLoggedIn: false };\n default:\n throw new Error(`isLoggedIn for ${options.provider} is not implemented`);\n }\n }\n async getAuthorizationCode(options) {\n switch (options.provider) {\n case \"google\":\n // For Google, we can use the id_token as the authorization code\n const googleUser = await this.getGoogleUser();\n if (googleUser && googleUser.credential) {\n return { jwt: googleUser.credential };\n }\n throw new Error(\"No Google authorization code available\");\n case \"apple\":\n // Apple authorization code should be obtained during login\n console.log(\"Apple authorization code should be stored during login\");\n throw new Error(\"Apple authorization code not available\");\n case \"facebook\":\n // Implement Facebook getAuthorizationCode when Facebook login is added\n console.log(\"Facebook getAuthorizationCode not implemented\");\n throw new Error(\"Facebook authorization code not available\");\n default:\n throw new Error(`getAuthorizationCode for ${options.provider} is not implemented`);\n }\n }\n async refresh(options) {\n switch (options.provider) {\n case \"google\":\n // For Google, we can prompt for re-authentication\n await this.loginWithGoogle(options.options);\n break;\n case \"apple\":\n // Apple doesn't provide a refresh method for web\n console.log(\"Apple refresh not available on web\");\n break;\n case \"facebook\":\n // Implement Facebook refresh when Facebook login is added\n console.log(\"Facebook refresh not implemented\");\n break;\n default:\n throw new Error(`Refresh for ${options.provider} is not implemented`);\n }\n }\n async loginWithGoogle(options) {\n console.log(\"isLoggedIn\", options);\n if (!this.googleClientId) {\n throw new Error(\"Google Client ID not set. Call initialize() first.\");\n }\n return new Promise((resolve, reject) => {\n google.accounts.id.initialize({\n client_id: this.googleClientId,\n callback: (response) => {\n console.log(\"google.accounts.id.initialize callback\", response);\n if (response.error) {\n reject(response.error);\n }\n else {\n const payload = this.parseJwt(response.credential);\n const result = {\n accessToken: null,\n idToken: response.credential,\n profile: {\n email: payload.email || null,\n familyName: payload.family_name || null,\n givenName: payload.given_name || null,\n id: payload.sub || null,\n name: payload.name || null,\n imageUrl: payload.picture || null,\n },\n };\n resolve({ provider: \"google\", result });\n }\n },\n });\n google.accounts.id.prompt((notification) => {\n if (notification.isNotDisplayed() || notification.isSkippedMoment()) {\n console.log(\"OneTap is not displayed or skipped\");\n }\n console.log(\"OneTap is displayed\");\n });\n });\n }\n parseJwt(token) {\n const base64Url = token.split(\".\")[1];\n const base64 = base64Url.replace(/-/g, \"+\").replace(/_/g, \"/\");\n const jsonPayload = decodeURIComponent(atob(base64)\n .split(\"\")\n .map((c) => {\n return \"%\" + (\"00\" + c.charCodeAt(0).toString(16)).slice(-2);\n })\n .join(\"\"));\n return JSON.parse(jsonPayload);\n }\n async loadGoogleScript() {\n if (this.googleScriptLoaded)\n return;\n return new Promise((resolve, reject) => {\n const script = document.createElement(\"script\");\n script.src = \"https://accounts.google.com/gsi/client\";\n script.async = true;\n script.onload = () => {\n this.googleScriptLoaded = true;\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n async loginWithApple(options) {\n if (!this.appleClientId) {\n throw new Error(\"Apple Client ID not set. Call initialize() first.\");\n }\n if (!this.appleScriptLoaded) {\n throw new Error(\"Apple Sign-In script not loaded.\");\n }\n return new Promise((resolve, reject) => {\n var _a;\n AppleID.auth.init({\n clientId: this.appleClientId,\n scope: ((_a = options.scopes) === null || _a === void 0 ? void 0 : _a.join(\" \")) || \"name email\",\n redirectURI: options.redirectUrl || window.location.href,\n state: options.state,\n nonce: options.nonce,\n usePopup: true,\n });\n AppleID.auth\n .signIn()\n .then((res) => {\n var _a, _b, _c, _d, _e, _f, _g;\n const result = {\n user: ((_b = (_a = res.user) === null || _a === void 0 ? void 0 : _a.name) === null || _b === void 0 ? void 0 : _b.firstName)\n ? `${res.user.name.firstName} ${res.user.name.lastName}`\n : null,\n email: ((_c = res.user) === null || _c === void 0 ? void 0 : _c.email) || null,\n givenName: ((_e = (_d = res.user) === null || _d === void 0 ? void 0 : _d.name) === null || _e === void 0 ? void 0 : _e.firstName) || null,\n familyName: ((_g = (_f = res.user) === null || _f === void 0 ? void 0 : _f.name) === null || _g === void 0 ? void 0 : _g.lastName) || null,\n identityToken: res.authorization.id_token || null,\n authorizationCode: res.authorization.code || null,\n };\n resolve({ provider: \"apple\", result });\n })\n .catch((error) => {\n reject(error);\n });\n });\n }\n async loadAppleScript() {\n if (this.appleScriptLoaded)\n return;\n return new Promise((resolve, reject) => {\n const script = document.createElement(\"script\");\n script.src = this.appleScriptUrl;\n script.async = true;\n script.onload = () => {\n this.appleScriptLoaded = true;\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n async getGoogleUser() {\n return new Promise((resolve) => {\n google.accounts.id.initialize({\n client_id: this.googleClientId,\n callback: (response) => {\n resolve(response);\n },\n });\n google.accounts.id.prompt((notification) => {\n if (notification.isNotDisplayed() || notification.isSkippedMoment()) {\n resolve(null);\n }\n });\n });\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,WAAW,GAAGA,mBAAc,CAAC,aAAa,EAAE;IAClD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,cAAc,EAAE,CAAC;IAClE,CAAC;;ICFM,MAAM,cAAc,SAASC,cAAS,CAAC;IAC9C,IAAI,WAAW,GAAG;IAClB,QAAQ,KAAK,CAAC,GAAG,SAAS,CAAC,CAAC;IAC5B,QAAQ,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;IACnC,QAAQ,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;IAClC,QAAQ,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;IACxC,QAAQ,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC;IACvC,QAAQ,IAAI,CAAC,cAAc,GAAG,sFAAsF,CAAC;IACrH,KAAK;IACL,IAAI,MAAM,UAAU,CAAC,OAAO,EAAE;IAC9B,QAAQ,IAAI,EAAE,EAAE,EAAE,CAAC;IACnB,QAAQ,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC,MAAM,MAAM,IAAI,IAAI,EAAE,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;IACvF,YAAY,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC;IAC7D,YAAY,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC1C,SAAS;IACT,QAAQ,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC,KAAK,MAAM,IAAI,IAAI,EAAE,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,CA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AAQ,KAAK;IACxC,oBAAoB,OAAO,CAAC,QAAQ,CAAC,CAAC;IACtC,iBAAiB;IACjB,aAAa,CAAC,CAAC;IACf,YAAY,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,YAAY,KAAK;IACxD,gBAAgB,IAAI,YAAY,CAAC,cAAc,EAAE,IAAI,YAAY,CAAC,eAAe,EAAE,EAAE;IACrF,oBAAoB,OAAO,CAAC,IAAI,CAAC,CAAC;IAClC,iBAAiB;IACjB,aAAa,CAAC,CAAC;IACf,SAAS,CAAC,CAAC;IACX,KAAK;IACL;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nconst SocialLogin = registerPlugin(\"SocialLogin\", {\n web: () => import(\"./web\").then((m) => new m.SocialLoginWeb()),\n});\nexport * from \"./definitions\";\nexport { SocialLogin };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nexport class SocialLoginWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.googleClientId = null;\n this.appleClientId = null;\n this.googleScriptLoaded = false;\n this.appleScriptLoaded = false;\n this.appleScriptUrl = \"https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js\";\n this.facebookAppId = null;\n this.facebookScriptLoaded = false;\n }\n async initialize(options) {\n var _a, _b, _c;\n if ((_a = options.google) === null || _a === void 0 ? void 0 : _a.webClientId) {\n this.googleClientId = options.google.webClientId;\n await this.loadGoogleScript();\n }\n if ((_b = options.apple) === null || _b === void 0 ? void 0 : _b.clientId) {\n this.appleClientId = options.apple.clientId;\n await this.loadAppleScript();\n }\n if ((_c = options.facebook) === null || _c === void 0 ? void 0 : _c.appId) {\n this.facebookAppId = options.facebook.appId;\n await this.loadFacebookScript();\n FB.init({\n appId: this.facebookAppId,\n version: 'v17.0',\n xfbml: true,\n cookie: true,\n });\n }\n // Implement initialization for other providers if needed\n }\n async login(options) {\n if (options.provider === \"google\") {\n return this.loginWithGoogle(options.options);\n }\n else if (options.provider === \"apple\") {\n return this.loginWithApple(options.options);\n }\n else if (options.provider === \"facebook\") {\n return this.loginWithFacebook(options.options);\n }\n // Implement login for other providers\n throw new Error(`Login for ${options.provider} is not implemented on web`);\n }\n async logout(options) {\n switch (options.provider) {\n case \"google\":\n // Google doesn't have a specific logout method for web\n // We can revoke the token if we have it stored\n console.log(\"Google logout: Token should be revoked on the client side if stored\");\n break;\n case \"apple\":\n // Apple doesn't provide a logout method for web\n console.log(\"Apple logout: Session should be managed on the client side\");\n break;\n case \"facebook\":\n return new Promise((resolve) => {\n FB.logout(() => resolve());\n });\n default:\n throw new Error(`Logout for ${options.provider} is not implemented`);\n }\n }\n async isLoggedIn(options) {\n switch (options.provider) {\n case \"google\":\n // For Google, we can check if there's a valid token\n const googleUser = await this.getGoogleUser();\n return { isLoggedIn: !!googleUser };\n case \"apple\":\n // Apple doesn't provide a method to check login status on web\n console.log(\"Apple login status should be managed on the client side\");\n return { isLoggedIn: false };\n case \"facebook\":\n return new Promise((resolve) => {\n FB.getLoginStatus((response) => {\n resolve({ isLoggedIn: response.status === 'connected' });\n });\n });\n default:\n throw new Error(`isLoggedIn for ${options.provider} is not implemented`);\n }\n }\n async getAuthorizationCode(options) {\n switch (options.provider) {\n case \"google\":\n // For Google, we can use the id_token as the authorization code\n const googleUser = await this.getGoogleUser();\n if (googleUser && googleUser.credential) {\n return { jwt: googleUser.credential };\n }\n throw new Error(\"No Google authorization code available\");\n case \"apple\":\n // Apple authorization code should be obtained during login\n console.log(\"Apple authorization code should be stored during login\");\n throw new Error(\"Apple authorization code not available\");\n case \"facebook\":\n return new Promise((resolve, reject) => {\n FB.getLoginStatus((response) => {\n var _a;\n if (response.status === 'connected') {\n resolve({ jwt: ((_a = response.authResponse) === null || _a === void 0 ? void 0 : _a.accessToken) || \"\" });\n }\n else {\n reject(new Error(\"No Facebook authorization code available\"));\n }\n });\n });\n default:\n throw new Error(`getAuthorizationCode for ${options.provider} is not implemented`);\n }\n }\n async refresh(options) {\n switch (options.provider) {\n case \"google\":\n // For Google, we can prompt for re-authentication\n await this.loginWithGoogle(options.options);\n break;\n case \"apple\":\n // Apple doesn't provide a refresh method for web\n console.log(\"Apple refresh not available on web\");\n break;\n case \"facebook\":\n await this.loginWithFacebook(options.options);\n break;\n default:\n throw new Error(`Refresh for ${options.provider} is not implemented`);\n }\n }\n async loginWithGoogle(options) {\n console.log(\"isLoggedIn\", options);\n if (!this.googleClientId) {\n throw new Error(\"Google Client ID not set. Call initialize() first.\");\n }\n return new Promise((resolve, reject) => {\n google.accounts.id.initialize({\n client_id: this.googleClientId,\n callback: (response) => {\n console.log(\"google.accounts.id.initialize callback\", response);\n if (response.error) {\n reject(response.error);\n }\n else {\n const payload = this.parseJwt(response.credential);\n const result = {\n accessToken: null,\n idToken: response.credential,\n profile: {\n email: payload.email || null,\n familyName: payload.family_name || null,\n givenName: payload.given_name || null,\n id: payload.sub || null,\n name: payload.name || null,\n imageUrl: payload.picture || null,\n },\n };\n resolve({ provider: \"google\", result });\n }\n },\n });\n google.accounts.id.prompt((notification) => {\n if (notification.isNotDisplayed() || notification.isSkippedMoment()) {\n console.log(\"OneTap is not displayed or skipped\");\n }\n console.log(\"OneTap is displayed\");\n });\n });\n }\n parseJwt(token) {\n const base64Url = token.split(\".\")[1];\n const base64 = base64Url.replace(/-/g, \"+\").replace(/_/g, \"/\");\n const jsonPayload = decodeURIComponent(atob(base64)\n .split(\"\")\n .map((c) => {\n return \"%\" + (\"00\" + c.charCodeAt(0).toString(16)).slice(-2);\n })\n .join(\"\"));\n return JSON.parse(jsonPayload);\n }\n async loadGoogleScript() {\n if (this.googleScriptLoaded)\n return;\n return new Promise((resolve, reject) => {\n const script = document.createElement(\"script\");\n script.src = \"https://accounts.google.com/gsi/client\";\n script.async = true;\n script.onload = () => {\n this.googleScriptLoaded = true;\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n async loginWithApple(options) {\n if (!this.appleClientId) {\n throw new Error(\"Apple Client ID not set. Call initialize() first.\");\n }\n if (!this.appleScriptLoaded) {\n throw new Error(\"Apple Sign-In script not loaded.\");\n }\n return new Promise((resolve, reject) => {\n var _a;\n AppleID.auth.init({\n clientId: this.appleClientId,\n scope: ((_a = options.scopes) === null || _a === void 0 ? void 0 : _a.join(\" \")) || \"name email\",\n redirectURI: options.redirectUrl || window.location.href,\n state: options.state,\n nonce: options.nonce,\n usePopup: true,\n });\n AppleID.auth\n .signIn()\n .then((res) => {\n var _a, _b, _c, _d, _e, _f, _g;\n const result = {\n user: ((_b = (_a = res.user) === null || _a === void 0 ? void 0 : _a.name) === null || _b === void 0 ? void 0 : _b.firstName)\n ? `${res.user.name.firstName} ${res.user.name.lastName}`\n : null,\n email: ((_c = res.user) === null || _c === void 0 ? void 0 : _c.email) || null,\n givenName: ((_e = (_d = res.user) === null || _d === void 0 ? void 0 : _d.name) === null || _e === void 0 ? void 0 : _e.firstName) || null,\n familyName: ((_g = (_f = res.user) === null || _f === void 0 ? void 0 : _f.name) === null || _g === void 0 ? void 0 : _g.lastName) || null,\n identityToken: res.authorization.id_token || null,\n authorizationCode: res.authorization.code || null,\n };\n resolve({ provider: \"apple\", result });\n })\n .catch((error) => {\n reject(error);\n });\n });\n }\n async loadAppleScript() {\n if (this.appleScriptLoaded)\n return;\n return new Promise((resolve, reject) => {\n const script = document.createElement(\"script\");\n script.src = this.appleScriptUrl;\n script.async = true;\n script.onload = () => {\n this.appleScriptLoaded = true;\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n async getGoogleUser() {\n return new Promise((resolve) => {\n google.accounts.id.initialize({\n client_id: this.googleClientId,\n callback: (response) => {\n resolve(response);\n },\n });\n google.accounts.id.prompt((notification) => {\n if (notification.isNotDisplayed() || notification.isSkippedMoment()) {\n resolve(null);\n }\n });\n });\n }\n async loadFacebookScript() {\n if (this.facebookScriptLoaded)\n return;\n return new Promise((resolve, reject) => {\n const script = document.createElement('script');\n script.src = 'https://connect.facebook.net/en_US/sdk.js';\n script.async = true;\n script.defer = true;\n script.onload = () => {\n this.facebookScriptLoaded = true;\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n async loginWithFacebook(options) {\n if (!this.facebookAppId) {\n throw new Error(\"Facebook App ID not set. Call initialize() first.\");\n }\n return new Promise((resolve, reject) => {\n FB.login((response) => {\n if (response.status === 'connected') {\n FB.api('/me', { fields: 'id,name,email,picture' }, (userInfo) => {\n var _a, _b;\n const result = {\n accessToken: {\n token: response.authResponse.accessToken,\n userId: response.authResponse.userID,\n },\n profile: {\n userID: userInfo.id,\n name: userInfo.name,\n email: userInfo.email || null,\n imageURL: ((_b = (_a = userInfo.picture) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.url) || null,\n friendIDs: [],\n birthday: null,\n ageRange: null,\n gender: null,\n location: null,\n hometown: null,\n profileURL: null,\n },\n authenticationToken: null,\n };\n resolve({ provider: \"facebook\", result });\n });\n }\n else {\n reject(new Error(\"Facebook login failed\"));\n }\n }, { scope: options.permissions.join(',') });\n });\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,WAAW,GAAGA,mBAAc,CAAC,aAAa,EAAE;IAClD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,cAAc,EAAE,CAAC;IAClE,CAAC;;ICFM,MAAM,cAAc,SAASC,cAAS,CAAC;IAC9C,IAAI,WAAW,GAAG;IAClB,QAAQ,KAAK,CAAC,GAAG,SAAS,CAAC,CAAC;IAC5B,QAAQ,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;IACnC,QAAQ,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;IAClC,QAAQ,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;IACx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