decane-connect-kit 2.6.1 → 2.7.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.
- package/dist/index.cjs +19 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -1
- package/dist/index.d.ts +20 -1
- package/dist/index.js +19 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2908,7 +2908,7 @@ function buildAuthUrl(clientId, scopes) {
|
|
|
2908
2908
|
return url.toString();
|
|
2909
2909
|
}
|
|
2910
2910
|
function loginWithKingsChatPopup(opts) {
|
|
2911
|
-
const scopes = opts.scopes ?? ["
|
|
2911
|
+
const scopes = opts.scopes ?? ["profile"];
|
|
2912
2912
|
const popup = window.open(
|
|
2913
2913
|
buildAuthUrl(opts.clientId, scopes),
|
|
2914
2914
|
"decane-kingschat",
|
|
@@ -3912,7 +3912,11 @@ async function createDecaneConnect(config) {
|
|
|
3912
3912
|
savePersisted(PERSIST_KEY, persisted);
|
|
3913
3913
|
events.emit("connected");
|
|
3914
3914
|
persistLiveSession();
|
|
3915
|
-
return {
|
|
3915
|
+
return {
|
|
3916
|
+
addresses,
|
|
3917
|
+
isNewUser: result.isNewUser,
|
|
3918
|
+
...result.profile ? { profile: result.profile } : {}
|
|
3919
|
+
};
|
|
3916
3920
|
}
|
|
3917
3921
|
const client = {
|
|
3918
3922
|
async connect() {
|
|
@@ -3947,11 +3951,23 @@ async function createDecaneConnect(config) {
|
|
|
3947
3951
|
throw new CallSequenceError(`Google sign-in failed: ${decaneError}`);
|
|
3948
3952
|
}
|
|
3949
3953
|
if (decaneJwt) {
|
|
3954
|
+
const name = params.get("decane_name");
|
|
3955
|
+
const email = params.get("decane_email");
|
|
3956
|
+
const picture = params.get("decane_picture");
|
|
3957
|
+
const profile = {
|
|
3958
|
+
...name ? { name } : {},
|
|
3959
|
+
...email ? { email } : {},
|
|
3960
|
+
...picture ? { picture } : {}
|
|
3961
|
+
};
|
|
3950
3962
|
const result = {
|
|
3951
3963
|
jwt: decaneJwt,
|
|
3952
3964
|
userId: params.get("decane_user_id") ?? "",
|
|
3953
3965
|
isNewUser: params.get("decane_is_new_user") === "true",
|
|
3954
|
-
hasShare: params.get("decane_has_share") === "true"
|
|
3966
|
+
hasShare: params.get("decane_has_share") === "true",
|
|
3967
|
+
// Omitted entirely when Google released nothing, so callers can test
|
|
3968
|
+
// `result.profile` rather than an object that is always present but
|
|
3969
|
+
// sometimes empty.
|
|
3970
|
+
...Object.keys(profile).length ? { profile } : {}
|
|
3955
3971
|
};
|
|
3956
3972
|
window.history.replaceState({}, "", window.location.pathname);
|
|
3957
3973
|
return handleAuthResult(result);
|