From b5ef953967c33f7ad7e0ba5860311d194aadd219 Mon Sep 17 00:00:00 2001 From: Mihir Raj Date: Mon, 30 Sep 2024 19:26:31 +0530 Subject: [PATCH 01/26] feat(core): :sparkles: added a linkedinAuthComponent added a component which will allow users to login with likedin in our website ref: #382 --- .../inputs/custom/LinkedInAuthComponent.js | 77 +++++++++++++++++++ package/index.js | 4 +- 2 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 package/components/inputs/custom/LinkedInAuthComponent.js diff --git a/package/components/inputs/custom/LinkedInAuthComponent.js b/package/components/inputs/custom/LinkedInAuthComponent.js new file mode 100644 index 00000000..ceb6cf0d --- /dev/null +++ b/package/components/inputs/custom/LinkedInAuthComponent.js @@ -0,0 +1,77 @@ +/* eslint-disable no-console */ +// eslint-disable-next-line unused-imports/no-unused-imports, no-unused-vars +import React, { useState, useEffect } from "react"; + +// eslint-disable-next-line import/no-unresolved +import { NativeLinkedInAuthComponent } from "@wrappid/native"; +// eslint-disable-next-line import/no-unresolved +import { WrappidDataContext } from "@wrappid/styles"; + +import CoreButton from "./../CoreButton"; +import CoreBox from "../../layouts/CoreBox"; + +const fetchUserData = async (authCode) => { + try { + // Send access token to backend to exchange for long-lived token + console.log("Currently in fetchUserData"); + const response = await fetch("http://localhost:8080/accesscode", { + body : JSON.stringify({ authCode }), + headers: { "Content-Type": "application/json" }, + method : "POST", + }); + + const data = await response.json(); + + console.log("FrontEnd Response:-->", data); + + } catch (error) { + console.error("Error fetching user data:", error); + } +}; + +export default function LinkedInAuthComponent(props){ + const { config } = React.useContext(WrappidDataContext); + + const clientId = config?.wrappid?.socialLogin?.linkedin?.apiKey; + + const redirectUri = config?.wrappid?.socialLogin?.linkedin?.callbackURL; + const scopes = "profile w_member_social email openid"; + const state = "4b1a92d8c1e7a9"; + + const authUrl = `https://www.linkedin.com/oauth/v2/authorization?response_type=code&client_id=${clientId}&redirect_uri=${encodeURIComponent( + redirectUri + )}&state=${state}&scope=${encodeURIComponent(scopes)}`; + + const handleClick = () => { + // Redirect user to LinkedIn auth URL + window.location.href = authUrl; + }; + const [authCode, setAuthCode] = useState(null); + + useEffect(() => { + // Extract the authorization code from the URL + const queryParams = new URLSearchParams(window.location.search); + const code = queryParams.get("code"); + + console.log("AuthCode from url", code); + + if (code) { + setAuthCode(code); + } + + console.log("AuthCode from useState", authCode); + if(authCode){ + // eslint-disable-next-line no-unused-vars + + fetchUserData(authCode); + } + }, [authCode]); + + return ( + + + + ); +} + +LinkedInAuthComponent.validProps = [...CoreButton.validProps]; \ No newline at end of file diff --git a/package/index.js b/package/index.js index 6072c360..efed2392 100644 --- a/package/index.js +++ b/package/index.js @@ -111,6 +111,7 @@ import CoreTextButton from "./components/inputs/CoreTextButton"; import CoreTextField from "./components/inputs/CoreTextField"; import CoreTimePicker from "./components/inputs/CoreTimePicker"; import CoreTimeRangePicker from "./components/inputs/CoreTimeRangePicker"; +import LinkedInAuthComponent from "./components/inputs/custom/LinkedInAuthComponent"; import CoreForm from "./components/inputs/forms/CoreForm"; import { FORM_EDIT_MODE, @@ -337,6 +338,7 @@ export { ThemeSelector, ThreeColumnLayout, toggleMenuItemState, toggleRightMenuState, TwoColumnLayout, urls, useDynamicRefs, // Network status custom hook useNetworkStatus, UserChip, VCenteredBlankLayout, viewFormattedDate, WEB_PLATFORM, XLargeCoreStyles, - XXLargeCoreStyles + XXLargeCoreStyles, + LinkedInAuthComponent }; From 5ac126f7158db442c339521bcf11450c07fdee3a Mon Sep 17 00:00:00 2001 From: Rajat Pal Date: Tue, 1 Oct 2024 18:48:21 +0530 Subject: [PATCH 02/26] feat(core): :sparkles: facebook auth component implementation implement a login flow using facebook ref: #383 --- .../inputs/custom/FacebookAuthComponent.js | 71 +++++++++++++++++++ package/index.js | 3 +- 2 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 package/components/inputs/custom/FacebookAuthComponent.js diff --git a/package/components/inputs/custom/FacebookAuthComponent.js b/package/components/inputs/custom/FacebookAuthComponent.js new file mode 100644 index 00000000..efacfa1e --- /dev/null +++ b/package/components/inputs/custom/FacebookAuthComponent.js @@ -0,0 +1,71 @@ +// eslint-disable-next-line unused-imports/no-unused-imports, no-unused-vars +import React, { useEffect } from "react"; + +// eslint-disable-next-line import/no-unresolved +import { NativeFacebookAuthComponent } from "@wrappid/native"; +// eslint-disable-next-line import/no-unresolved +import { WrappidDataContext } from "@wrappid/styles"; + +import CoreButton from "../CoreButton"; + +const FacebookAuthComponent = (props) => { + const { config } = React.useContext(WrappidDataContext); + + useEffect(() => { + // Load the Facebook SDK + window.fbAsyncInit = function () { + window.FB.init({ + appId : config?.wrappid?.socialLogin?.facebook?.apiKey, // Replace with your Facebook App ID + cookie : true, + version: "v20.0", + xfbml : true, + }); + }; + + (function (document, elementType, scriptId) { + let facebookScript, + fjs = document.getElementsByTagName(elementType)[0]; + + if (document.getElementById(scriptId)) return; + facebookScript = document.createElement(elementType); + facebookScript.id = scriptId; + facebookScript.src = "https://connect.facebook.net/en_US/sdk.js"; + fjs.parentNode.insertBefore(facebookScript, fjs); + })(document, "script", "facebook-jssdk"); + }, []); + + const handleFacebookLogin = () => { + window.FB.login( + function (response) { + if (response.authResponse) { + fetchUserData(response.authResponse.accessToken); + } + }, + { + scope: + "pages_manage_posts,pages_read_engagement,pages_manage_engagement", + } + ); + }; + + const fetchUserData = (accessToken) => { + // Send access token to backend to exchange for long-lived token + fetch("http://localhost:8080/social/login/facebook", { + body : JSON.stringify({ accessToken }), + headers: { "Content-Type": "application/json" }, + method : "POST", + }) + .then((res) => res.json()); + }; + + return ( + handleFacebookLogin()} + {...props} + /> + ); +}; + +FacebookAuthComponent.ValidProps = [...CoreButton.validProps]; + +export default FacebookAuthComponent; diff --git a/package/index.js b/package/index.js index 6072c360..5b227fe8 100644 --- a/package/index.js +++ b/package/index.js @@ -111,6 +111,7 @@ import CoreTextButton from "./components/inputs/CoreTextButton"; import CoreTextField from "./components/inputs/CoreTextField"; import CoreTimePicker from "./components/inputs/CoreTimePicker"; import CoreTimeRangePicker from "./components/inputs/CoreTimeRangePicker"; +import FacebookAuthComponent from "./components/inputs/custom/FacebookAuthComponent"; import CoreForm from "./components/inputs/forms/CoreForm"; import { FORM_EDIT_MODE, @@ -337,6 +338,6 @@ export { ThemeSelector, ThreeColumnLayout, toggleMenuItemState, toggleRightMenuState, TwoColumnLayout, urls, useDynamicRefs, // Network status custom hook useNetworkStatus, UserChip, VCenteredBlankLayout, viewFormattedDate, WEB_PLATFORM, XLargeCoreStyles, - XXLargeCoreStyles + XXLargeCoreStyles, FacebookAuthComponent }; From 582fec15063ca4370b7007093ad84fe7ab2260e3 Mon Sep 17 00:00:00 2001 From: Mihir Raj Date: Tue, 1 Oct 2024 21:06:15 +0530 Subject: [PATCH 03/26] feat(core): :sparkles: added linkedin auth component Added linkedin auth component ref: #97 --- package/components/inputs/custom/LinkedInAuthComponent.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package/components/inputs/custom/LinkedInAuthComponent.js b/package/components/inputs/custom/LinkedInAuthComponent.js index ceb6cf0d..730d077f 100644 --- a/package/components/inputs/custom/LinkedInAuthComponent.js +++ b/package/components/inputs/custom/LinkedInAuthComponent.js @@ -14,7 +14,7 @@ const fetchUserData = async (authCode) => { try { // Send access token to backend to exchange for long-lived token console.log("Currently in fetchUserData"); - const response = await fetch("http://localhost:8080/accesscode", { + const response = await fetch("http://localhost:8080/social/login/linkedin", { body : JSON.stringify({ authCode }), headers: { "Content-Type": "application/json" }, method : "POST", @@ -33,7 +33,6 @@ export default function LinkedInAuthComponent(props){ const { config } = React.useContext(WrappidDataContext); const clientId = config?.wrappid?.socialLogin?.linkedin?.apiKey; - const redirectUri = config?.wrappid?.socialLogin?.linkedin?.callbackURL; const scopes = "profile w_member_social email openid"; const state = "4b1a92d8c1e7a9"; From d92959b8429ee7f5a62b080d74b0ad83c3829a79 Mon Sep 17 00:00:00 2001 From: Mihir Raj Date: Tue, 1 Oct 2024 22:52:22 +0530 Subject: [PATCH 04/26] feat(core): :sparkles: added linkedin auth component Added linkedin auth component ref: #97 --- package/components/inputs/custom/LinkedInAuthComponent.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/components/inputs/custom/LinkedInAuthComponent.js b/package/components/inputs/custom/LinkedInAuthComponent.js index 730d077f..199db892 100644 --- a/package/components/inputs/custom/LinkedInAuthComponent.js +++ b/package/components/inputs/custom/LinkedInAuthComponent.js @@ -13,7 +13,7 @@ import CoreBox from "../../layouts/CoreBox"; const fetchUserData = async (authCode) => { try { // Send access token to backend to exchange for long-lived token - console.log("Currently in fetchUserData"); + // console.log("Currently in fetchUserData"); const response = await fetch("http://localhost:8080/social/login/linkedin", { body : JSON.stringify({ authCode }), headers: { "Content-Type": "application/json" }, From ba7c929652e4c00680aa1407216e12e868075809 Mon Sep 17 00:00:00 2001 From: Mihir Raj Date: Tue, 1 Oct 2024 23:01:36 +0530 Subject: [PATCH 05/26] feat(core): :sparkles: added a login with linkedIn flow made a component which will allow the users to login with linkedin ref: #382 --- .../inputs/custom/LinkedInAuthComponent.js | 24 +++++++------------ 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/package/components/inputs/custom/LinkedInAuthComponent.js b/package/components/inputs/custom/LinkedInAuthComponent.js index 199db892..55bffe6d 100644 --- a/package/components/inputs/custom/LinkedInAuthComponent.js +++ b/package/components/inputs/custom/LinkedInAuthComponent.js @@ -11,22 +11,16 @@ import CoreButton from "./../CoreButton"; import CoreBox from "../../layouts/CoreBox"; const fetchUserData = async (authCode) => { - try { - // Send access token to backend to exchange for long-lived token - // console.log("Currently in fetchUserData"); - const response = await fetch("http://localhost:8080/social/login/linkedin", { - body : JSON.stringify({ authCode }), - headers: { "Content-Type": "application/json" }, - method : "POST", - }); + // Send access token to backend to exchange for long-lived token + const response = await fetch("http://localhost:8080/social/login/linkedin", { + body : JSON.stringify({ authCode }), + headers: { "Content-Type": "application/json" }, + method : "POST", + }); - const data = await response.json(); - - console.log("FrontEnd Response:-->", data); + // eslint-disable-next-line no-unused-vars + const data = await response.json(); - } catch (error) { - console.error("Error fetching user data:", error); - } }; export default function LinkedInAuthComponent(props){ @@ -52,8 +46,6 @@ export default function LinkedInAuthComponent(props){ const queryParams = new URLSearchParams(window.location.search); const code = queryParams.get("code"); - console.log("AuthCode from url", code); - if (code) { setAuthCode(code); } From 3b6f9086ab2ca0959fbd14ee3488b025eb107061 Mon Sep 17 00:00:00 2001 From: PritamIT2023 Date: Thu, 3 Oct 2024 16:58:03 +0530 Subject: [PATCH 06/26] refactor(core): :sparkles: facebook login implementation facebook login implementation and code cleanup Ref: #383 --- .../inputs/custom/FacebookAuthComponent.js | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/package/components/inputs/custom/FacebookAuthComponent.js b/package/components/inputs/custom/FacebookAuthComponent.js index efacfa1e..a46a7ff4 100644 --- a/package/components/inputs/custom/FacebookAuthComponent.js +++ b/package/components/inputs/custom/FacebookAuthComponent.js @@ -5,10 +5,14 @@ import React, { useEffect } from "react"; import { NativeFacebookAuthComponent } from "@wrappid/native"; // eslint-disable-next-line import/no-unresolved import { WrappidDataContext } from "@wrappid/styles"; +import { useDispatch } from "react-redux"; +import { HTTP } from "../../../config/constants"; +import { apiRequestAction } from "../../../store/action/appActions"; import CoreButton from "../CoreButton"; const FacebookAuthComponent = (props) => { + const dispatch = useDispatch(); const { config } = React.useContext(WrappidDataContext); useEffect(() => { @@ -49,18 +53,24 @@ const FacebookAuthComponent = (props) => { }; const fetchUserData = (accessToken) => { - // Send access token to backend to exchange for long-lived token - fetch("http://localhost:8080/social/login/facebook", { - body : JSON.stringify({ accessToken }), - headers: { "Content-Type": "application/json" }, - method : "POST", - }) - .then((res) => res.json()); + const data = { platformToken: accessToken }; + + dispatch( + apiRequestAction( + HTTP.POST, + "/login/social/facebook", + false, + data, + "LOGIN_SUCCESS", + "LOGIN_ERROR" + ) + ); }; return ( handleFacebookLogin()} + label="Facebook" {...props} /> ); From 94e15cd3a496673ccafe89039cbc8bccfd6a9e03 Mon Sep 17 00:00:00 2001 From: wrappidcare Date: Thu, 3 Oct 2024 12:53:39 +0000 Subject: [PATCH 07/26] chore(release): 0.0.551 --- CHANGELOG.md | 7 +++++++ package-lock.json | 4 ++-- package.json | 2 +- package/package-lock.json | 4 ++-- package/package.json | 2 +- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5eb83c4b..bdb430bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [0.0.551](https://github.com/wrappid/core/compare/v0.0.550...v0.0.551) (2024-10-03) + + +### Features + +* **core:** :sparkles: facebook auth component implementation ([5ac126f](https://github.com/wrappid/core/commit/5ac126f7158db442c339521bcf11450c07fdee3a)), closes [#383](https://github.com/wrappid/core/issues/383) + ### [0.0.550](https://github.com/wrappid/core/compare/v0.0.549...v0.0.550) (2024-09-26) ### [0.0.549](https://github.com/wrappid/core/compare/v0.0.548...v0.0.549) (2024-09-25) diff --git a/package-lock.json b/package-lock.json index 7cd0744b..d165f567 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@wrappid/core", - "version": "0.0.550", + "version": "0.0.551", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@wrappid/core", - "version": "0.0.550", + "version": "0.0.551", "license": "MIT", "devDependencies": { "@babel/cli": "7.21.0", diff --git a/package.json b/package.json index b81c107d..f71a46bc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@wrappid/core", - "version": "0.0.550", + "version": "0.0.551", "description": "Multi platform app builder core package.", "main": "index.js", "scripts": { diff --git a/package/package-lock.json b/package/package-lock.json index 38856a39..8cbf901c 100644 --- a/package/package-lock.json +++ b/package/package-lock.json @@ -1,12 +1,12 @@ { "name": "@wrappid/core", - "version": "0.0.550", + "version": "0.0.551", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@wrappid/core", - "version": "0.0.550", + "version": "0.0.551", "license": "MIT", "peerDependencies": { "@reduxjs/toolkit": "1.9.1", diff --git a/package/package.json b/package/package.json index e65ac4d1..f4b6bc73 100644 --- a/package/package.json +++ b/package/package.json @@ -1,6 +1,6 @@ { "name": "@wrappid/core", - "version": "0.0.550", + "version": "0.0.551", "description": "Multi platform app builder core package.", "main": "index.js", "scripts": {}, From 78d5cca5cb179b9dbe3ae7688a1efcf7e7daaf36 Mon Sep 17 00:00:00 2001 From: wrappidcare Date: Thu, 3 Oct 2024 16:45:55 +0000 Subject: [PATCH 08/26] chore(release): 0.0.552 --- CHANGELOG.md | 2 ++ package-lock.json | 4 ++-- package.json | 2 +- package/package-lock.json | 4 ++-- package/package.json | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bdb430bb..7493aa9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [0.0.552](https://github.com/wrappid/core/compare/v0.0.551...v0.0.552) (2024-10-03) + ### [0.0.551](https://github.com/wrappid/core/compare/v0.0.550...v0.0.551) (2024-10-03) diff --git a/package-lock.json b/package-lock.json index d165f567..8b65c178 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@wrappid/core", - "version": "0.0.551", + "version": "0.0.552", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@wrappid/core", - "version": "0.0.551", + "version": "0.0.552", "license": "MIT", "devDependencies": { "@babel/cli": "7.21.0", diff --git a/package.json b/package.json index f71a46bc..74f1e523 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@wrappid/core", - "version": "0.0.551", + "version": "0.0.552", "description": "Multi platform app builder core package.", "main": "index.js", "scripts": { diff --git a/package/package-lock.json b/package/package-lock.json index 8cbf901c..b11f68e6 100644 --- a/package/package-lock.json +++ b/package/package-lock.json @@ -1,12 +1,12 @@ { "name": "@wrappid/core", - "version": "0.0.551", + "version": "0.0.552", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@wrappid/core", - "version": "0.0.551", + "version": "0.0.552", "license": "MIT", "peerDependencies": { "@reduxjs/toolkit": "1.9.1", diff --git a/package/package.json b/package/package.json index f4b6bc73..a1a70cc4 100644 --- a/package/package.json +++ b/package/package.json @@ -1,6 +1,6 @@ { "name": "@wrappid/core", - "version": "0.0.551", + "version": "0.0.552", "description": "Multi platform app builder core package.", "main": "index.js", "scripts": {}, From 2c85db2f9c0199825de9ec9e76a04c46c2ebb20a Mon Sep 17 00:00:00 2001 From: PritamIT2023 Date: Fri, 4 Oct 2024 01:01:56 +0530 Subject: [PATCH 09/26] fix(core): :bug: facebook login fix facebook login fix Ref: #383 --- package/components/inputs/custom/FacebookAuthComponent.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/components/inputs/custom/FacebookAuthComponent.js b/package/components/inputs/custom/FacebookAuthComponent.js index a46a7ff4..9cce7784 100644 --- a/package/components/inputs/custom/FacebookAuthComponent.js +++ b/package/components/inputs/custom/FacebookAuthComponent.js @@ -19,7 +19,7 @@ const FacebookAuthComponent = (props) => { // Load the Facebook SDK window.fbAsyncInit = function () { window.FB.init({ - appId : config?.wrappid?.socialLogin?.facebook?.apiKey, // Replace with your Facebook App ID + appId : config?.wrappid?.socialLogin?.facebook?.appId, // Replace with your Facebook App ID cookie : true, version: "v20.0", xfbml : true, @@ -46,8 +46,8 @@ const FacebookAuthComponent = (props) => { } }, { - scope: - "pages_manage_posts,pages_read_engagement,pages_manage_engagement", + config_id: config?.wrappid?.socialLogin?.facebook?.configId, + scope : "public_profile,email", } ); }; From ffa30a67e346fcf538da807f9f5fd67aab595e3e Mon Sep 17 00:00:00 2001 From: wrappidcare Date: Thu, 3 Oct 2024 19:35:03 +0000 Subject: [PATCH 10/26] chore(release): 0.0.553 --- CHANGELOG.md | 7 +++++++ package-lock.json | 4 ++-- package.json | 2 +- package/package-lock.json | 4 ++-- package/package.json | 2 +- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7493aa9d..d7ae4099 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [0.0.553](https://github.com/wrappid/core/compare/v0.0.552...v0.0.553) (2024-10-03) + + +### Bug Fixes + +* **core:** :bug: facebook login fix ([2c85db2](https://github.com/wrappid/core/commit/2c85db2f9c0199825de9ec9e76a04c46c2ebb20a)), closes [#383](https://github.com/wrappid/core/issues/383) + ### [0.0.552](https://github.com/wrappid/core/compare/v0.0.551...v0.0.552) (2024-10-03) ### [0.0.551](https://github.com/wrappid/core/compare/v0.0.550...v0.0.551) (2024-10-03) diff --git a/package-lock.json b/package-lock.json index 8b65c178..34ce9aa5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@wrappid/core", - "version": "0.0.552", + "version": "0.0.553", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@wrappid/core", - "version": "0.0.552", + "version": "0.0.553", "license": "MIT", "devDependencies": { "@babel/cli": "7.21.0", diff --git a/package.json b/package.json index 74f1e523..1b0c3cc8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@wrappid/core", - "version": "0.0.552", + "version": "0.0.553", "description": "Multi platform app builder core package.", "main": "index.js", "scripts": { diff --git a/package/package-lock.json b/package/package-lock.json index b11f68e6..960963aa 100644 --- a/package/package-lock.json +++ b/package/package-lock.json @@ -1,12 +1,12 @@ { "name": "@wrappid/core", - "version": "0.0.552", + "version": "0.0.553", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@wrappid/core", - "version": "0.0.552", + "version": "0.0.553", "license": "MIT", "peerDependencies": { "@reduxjs/toolkit": "1.9.1", diff --git a/package/package.json b/package/package.json index a1a70cc4..c5d4142d 100644 --- a/package/package.json +++ b/package/package.json @@ -1,6 +1,6 @@ { "name": "@wrappid/core", - "version": "0.0.552", + "version": "0.0.553", "description": "Multi platform app builder core package.", "main": "index.js", "scripts": {}, From 714416f5f10cf92482e1a152818de3b2a0275545 Mon Sep 17 00:00:00 2001 From: wrappidcare Date: Thu, 3 Oct 2024 19:37:32 +0000 Subject: [PATCH 11/26] chore(release): 0.0.554 --- CHANGELOG.md | 2 ++ package-lock.json | 4 ++-- package.json | 2 +- package/package-lock.json | 4 ++-- package/package.json | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d7ae4099..985e8546 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [0.0.554](https://github.com/wrappid/core/compare/v0.0.553...v0.0.554) (2024-10-03) + ### [0.0.553](https://github.com/wrappid/core/compare/v0.0.552...v0.0.553) (2024-10-03) diff --git a/package-lock.json b/package-lock.json index 34ce9aa5..391e6058 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@wrappid/core", - "version": "0.0.553", + "version": "0.0.554", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@wrappid/core", - "version": "0.0.553", + "version": "0.0.554", "license": "MIT", "devDependencies": { "@babel/cli": "7.21.0", diff --git a/package.json b/package.json index 1b0c3cc8..10b11a15 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@wrappid/core", - "version": "0.0.553", + "version": "0.0.554", "description": "Multi platform app builder core package.", "main": "index.js", "scripts": { diff --git a/package/package-lock.json b/package/package-lock.json index 960963aa..a62fb695 100644 --- a/package/package-lock.json +++ b/package/package-lock.json @@ -1,12 +1,12 @@ { "name": "@wrappid/core", - "version": "0.0.553", + "version": "0.0.554", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@wrappid/core", - "version": "0.0.553", + "version": "0.0.554", "license": "MIT", "peerDependencies": { "@reduxjs/toolkit": "1.9.1", diff --git a/package/package.json b/package/package.json index c5d4142d..d0eb256b 100644 --- a/package/package.json +++ b/package/package.json @@ -1,6 +1,6 @@ { "name": "@wrappid/core", - "version": "0.0.553", + "version": "0.0.554", "description": "Multi platform app builder core package.", "main": "index.js", "scripts": {}, From fe0a4a0f468cc91c19998920db4224d4703eb639 Mon Sep 17 00:00:00 2001 From: PritamIT2023 Date: Fri, 4 Oct 2024 01:58:35 +0530 Subject: [PATCH 12/26] fix(global): :bug: facbooklogin fix facbooklogin fix Ref: #383 --- .../inputs/custom/FacebookAuthComponent.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/package/components/inputs/custom/FacebookAuthComponent.js b/package/components/inputs/custom/FacebookAuthComponent.js index 9cce7784..17f79fe2 100644 --- a/package/components/inputs/custom/FacebookAuthComponent.js +++ b/package/components/inputs/custom/FacebookAuthComponent.js @@ -19,10 +19,12 @@ const FacebookAuthComponent = (props) => { // Load the Facebook SDK window.fbAsyncInit = function () { window.FB.init({ - appId : config?.wrappid?.socialLogin?.facebook?.appId, // Replace with your Facebook App ID - cookie : true, - version: "v20.0", - xfbml : true, + appId : config?.wrappid?.socialLogin?.facebook?.appId, + config_id: config?.wrappid?.socialLogin?.facebook?.configId, + cookie : true, + version : "v20.0", + xfbml : true, + }); }; @@ -45,9 +47,10 @@ const FacebookAuthComponent = (props) => { fetchUserData(response.authResponse.accessToken); } }, - { - config_id: config?.wrappid?.socialLogin?.facebook?.configId, - scope : "public_profile,email", + { + config_id : config?.wrappid?.socialLogin?.facebook?.configId, + response_type: "code", + scope : "public_profile,email", } ); }; From e37bdcff63287c92416ad885b82545657aaaade1 Mon Sep 17 00:00:00 2001 From: wrappidcare Date: Thu, 3 Oct 2024 20:35:33 +0000 Subject: [PATCH 13/26] chore(release): 0.0.555 --- CHANGELOG.md | 2 ++ package-lock.json | 4 ++-- package.json | 2 +- package/package-lock.json | 4 ++-- package/package.json | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 985e8546..016fb046 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [0.0.555](https://github.com/wrappid/core/compare/v0.0.554...v0.0.555) (2024-10-03) + ### [0.0.554](https://github.com/wrappid/core/compare/v0.0.553...v0.0.554) (2024-10-03) ### [0.0.553](https://github.com/wrappid/core/compare/v0.0.552...v0.0.553) (2024-10-03) diff --git a/package-lock.json b/package-lock.json index 391e6058..ec2d49a9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@wrappid/core", - "version": "0.0.554", + "version": "0.0.555", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@wrappid/core", - "version": "0.0.554", + "version": "0.0.555", "license": "MIT", "devDependencies": { "@babel/cli": "7.21.0", diff --git a/package.json b/package.json index 10b11a15..caefe653 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@wrappid/core", - "version": "0.0.554", + "version": "0.0.555", "description": "Multi platform app builder core package.", "main": "index.js", "scripts": { diff --git a/package/package-lock.json b/package/package-lock.json index a62fb695..c5944926 100644 --- a/package/package-lock.json +++ b/package/package-lock.json @@ -1,12 +1,12 @@ { "name": "@wrappid/core", - "version": "0.0.554", + "version": "0.0.555", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@wrappid/core", - "version": "0.0.554", + "version": "0.0.555", "license": "MIT", "peerDependencies": { "@reduxjs/toolkit": "1.9.1", diff --git a/package/package.json b/package/package.json index d0eb256b..c6669180 100644 --- a/package/package.json +++ b/package/package.json @@ -1,6 +1,6 @@ { "name": "@wrappid/core", - "version": "0.0.554", + "version": "0.0.555", "description": "Multi platform app builder core package.", "main": "index.js", "scripts": {}, From 9461e3bad00e58b42eb87ec4a060d522eabb5435 Mon Sep 17 00:00:00 2001 From: Mihir Raj Date: Mon, 7 Oct 2024 14:07:01 +0530 Subject: [PATCH 14/26] feat(core): :sparkles: implemented a feature which will allow users to login with linkedIn implemented a feature which will allow users to login with linkedIn ref: #382 --- .../inputs/custom/LinkedInAuthComponent.js | 39 ++++++++++--------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/package/components/inputs/custom/LinkedInAuthComponent.js b/package/components/inputs/custom/LinkedInAuthComponent.js index 55bffe6d..da163652 100644 --- a/package/components/inputs/custom/LinkedInAuthComponent.js +++ b/package/components/inputs/custom/LinkedInAuthComponent.js @@ -6,25 +6,16 @@ import React, { useState, useEffect } from "react"; import { NativeLinkedInAuthComponent } from "@wrappid/native"; // eslint-disable-next-line import/no-unresolved import { WrappidDataContext } from "@wrappid/styles"; +import { useDispatch } from "react-redux"; import CoreButton from "./../CoreButton"; +import { HTTP } from "../../../config/constants"; +import { apiRequestAction } from "../../../store/action/appActions"; import CoreBox from "../../layouts/CoreBox"; -const fetchUserData = async (authCode) => { - // Send access token to backend to exchange for long-lived token - const response = await fetch("http://localhost:8080/social/login/linkedin", { - body : JSON.stringify({ authCode }), - headers: { "Content-Type": "application/json" }, - method : "POST", - }); - - // eslint-disable-next-line no-unused-vars - const data = await response.json(); - -}; - export default function LinkedInAuthComponent(props){ const { config } = React.useContext(WrappidDataContext); + const dispatch = useDispatch(); const clientId = config?.wrappid?.socialLogin?.linkedin?.apiKey; const redirectUri = config?.wrappid?.socialLogin?.linkedin?.callbackURL; @@ -39,6 +30,20 @@ export default function LinkedInAuthComponent(props){ // Redirect user to LinkedIn auth URL window.location.href = authUrl; }; + const fetchUserData = (authCode) => { + const data = { platformToken: authCode }; + + dispatch( + apiRequestAction( + HTTP.POST, + "/login/social/linkedin", + false, + data, + "LOGIN_SUCCESS", + "LOGIN_ERROR" + ) + ); + }; const [authCode, setAuthCode] = useState(null); useEffect(() => { @@ -46,21 +51,19 @@ export default function LinkedInAuthComponent(props){ const queryParams = new URLSearchParams(window.location.search); const code = queryParams.get("code"); - if (code) { + if (code != null) { setAuthCode(code); } - console.log("AuthCode from useState", authCode); - if(authCode){ + if(authCode !== null){ // eslint-disable-next-line no-unused-vars - fetchUserData(authCode); } }, [authCode]); return ( - + ); } From a3e934ef1560b68a98b048832b5abe46813f23a4 Mon Sep 17 00:00:00 2001 From: priyanshu2k3 Date: Mon, 7 Oct 2024 17:51:53 +0530 Subject: [PATCH 15/26] feat(core): :sparkles: github auth component added adds the github auth component which allows the user to signin smoothly if they have email public on the github Ref: #381 --- .../inputs/custom/GithubAuthComponent.js | 61 +++++++++++++++++++ package/index.js | 3 +- 2 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 package/components/inputs/custom/GithubAuthComponent.js diff --git a/package/components/inputs/custom/GithubAuthComponent.js b/package/components/inputs/custom/GithubAuthComponent.js new file mode 100644 index 00000000..8fe6f7b7 --- /dev/null +++ b/package/components/inputs/custom/GithubAuthComponent.js @@ -0,0 +1,61 @@ +/* eslint-disable etc/no-commented-out-code */ +/* eslint-disable import/no-unresolved */ +import React, { useEffect } from "react"; + +import { apiRequestAction, HTTP } from "@wrappid/core"; +import { NativeGithubAuthComponent } from "@wrappid/native"; +import { WrappidDataContext } from "@wrappid/styles"; +import { useDispatch, useSelector } from "react-redux"; + +export default function GithubAuthComponent(props) { + const { config } = React.useContext(WrappidDataContext); + const dispatch = useDispatch(); + const github_code = useSelector(state => state.auth.github_code); + + useEffect(() => { + // console.log("trying to find the github code from url"); + const currentUrl = window.location.href; + + // console.log(currentUrl, "currentUrl"); + if (currentUrl.includes("checkuserexist?code=")) { + // Extract the code from the URL + const urlParams = new URLSearchParams(window.location.search); + const extractedCode = urlParams.get("code"); + + // console.log(extractedCode, "extractedCode"); + // console.log(github_code, "GITHUB_code from the redux store before the calling"); + dispatch({ "github_code": extractedCode, "type": "GITHUB_CODE" }); + } + }, []); + + useEffect(() => { + const backend_Endpoint = "/login/social/github"; + + // console.log("github_code in the useeffect", github_code); + if(github_code === ""){return;} + // console.log("called the backend"); + dispatch( + apiRequestAction(HTTP.POST, backend_Endpoint, false, { "platformToken": github_code }, "LOGIN_SUCCESS", + "LOGIN_ERROR")); + dispatch({ "github_code": "", "type": "GITHUB_CODE" }); + }, [github_code]); + + useEffect(() => { + const backend_Endpoint = "/login/social/github"; + + // console.log("github_code in the useeffect", github_code); + if(github_code === ""){return;} + // console.log("called the backend"); + dispatch(apiRequestAction(HTTP.POST, backend_Endpoint, false, { "platformToken": github_code }, "GET_GITHUB_PERSISTANT_ACCESSTOKEN")); + dispatch({ "github_code": "", "type": "GITHUB_CODE" }); + }, [github_code]); + const handleAuthoriseGithub = () => { + //change to config dynamic client id + const github_client_id = config.wrappid.socialLogin.github.github_client_id; + + window.location.href = `https://github.com/login/oauth/authorize?client_id=${github_client_id}&scope=read:user user:email`; + return; + }; + + return (); +} \ No newline at end of file diff --git a/package/index.js b/package/index.js index 5b227fe8..8c995d6c 100644 --- a/package/index.js +++ b/package/index.js @@ -112,6 +112,7 @@ import CoreTextField from "./components/inputs/CoreTextField"; import CoreTimePicker from "./components/inputs/CoreTimePicker"; import CoreTimeRangePicker from "./components/inputs/CoreTimeRangePicker"; import FacebookAuthComponent from "./components/inputs/custom/FacebookAuthComponent"; +import GithubAuthComponent from "./components/inputs/custom/GithubAuthComponent"; import CoreForm from "./components/inputs/forms/CoreForm"; import { FORM_EDIT_MODE, @@ -338,6 +339,6 @@ export { ThemeSelector, ThreeColumnLayout, toggleMenuItemState, toggleRightMenuState, TwoColumnLayout, urls, useDynamicRefs, // Network status custom hook useNetworkStatus, UserChip, VCenteredBlankLayout, viewFormattedDate, WEB_PLATFORM, XLargeCoreStyles, - XXLargeCoreStyles, FacebookAuthComponent + XXLargeCoreStyles, FacebookAuthComponent, GithubAuthComponent }; From ee2708e381788c613227e1aa951d1fb8563ec234 Mon Sep 17 00:00:00 2001 From: Mihir Raj Date: Mon, 7 Oct 2024 18:38:26 +0530 Subject: [PATCH 16/26] feat(core): :sparkles: implemented a login with linkedin feature implemented a login with linkedin feature for website ref: #382 --- package/components/inputs/custom/LinkedInAuthComponent.js | 1 + package/index.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/package/components/inputs/custom/LinkedInAuthComponent.js b/package/components/inputs/custom/LinkedInAuthComponent.js index da163652..71ccab23 100644 --- a/package/components/inputs/custom/LinkedInAuthComponent.js +++ b/package/components/inputs/custom/LinkedInAuthComponent.js @@ -28,6 +28,7 @@ export default function LinkedInAuthComponent(props){ const handleClick = () => { // Redirect user to LinkedIn auth URL + console.log(authUrl); window.location.href = authUrl; }; const fetchUserData = (authCode) => { diff --git a/package/index.js b/package/index.js index 5b227fe8..751beb99 100644 --- a/package/index.js +++ b/package/index.js @@ -112,6 +112,7 @@ import CoreTextField from "./components/inputs/CoreTextField"; import CoreTimePicker from "./components/inputs/CoreTimePicker"; import CoreTimeRangePicker from "./components/inputs/CoreTimeRangePicker"; import FacebookAuthComponent from "./components/inputs/custom/FacebookAuthComponent"; +import LinkedInAuthComponent from "./components/inputs/custom/LinkedInAuthComponent"; import CoreForm from "./components/inputs/forms/CoreForm"; import { FORM_EDIT_MODE, @@ -338,6 +339,6 @@ export { ThemeSelector, ThreeColumnLayout, toggleMenuItemState, toggleRightMenuState, TwoColumnLayout, urls, useDynamicRefs, // Network status custom hook useNetworkStatus, UserChip, VCenteredBlankLayout, viewFormattedDate, WEB_PLATFORM, XLargeCoreStyles, - XXLargeCoreStyles, FacebookAuthComponent + XXLargeCoreStyles, FacebookAuthComponent, LinkedInAuthComponent }; From e2d65e60a05f783712856e19e452f31375748256 Mon Sep 17 00:00:00 2001 From: priyanshu2k3 Date: Tue, 8 Oct 2024 13:11:16 +0530 Subject: [PATCH 17/26] feat(core): :sparkles: adds the github auth component adds the github auth component ref : #381 --- .../inputs/custom/GithubAuthComponent.js | 29 +++++-------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/package/components/inputs/custom/GithubAuthComponent.js b/package/components/inputs/custom/GithubAuthComponent.js index 8fe6f7b7..2728d134 100644 --- a/package/components/inputs/custom/GithubAuthComponent.js +++ b/package/components/inputs/custom/GithubAuthComponent.js @@ -1,56 +1,41 @@ /* eslint-disable etc/no-commented-out-code */ /* eslint-disable import/no-unresolved */ -import React, { useEffect } from "react"; +import React, { useEffect, useState } from "react"; import { apiRequestAction, HTTP } from "@wrappid/core"; import { NativeGithubAuthComponent } from "@wrappid/native"; import { WrappidDataContext } from "@wrappid/styles"; -import { useDispatch, useSelector } from "react-redux"; +import { useDispatch } from "react-redux"; export default function GithubAuthComponent(props) { const { config } = React.useContext(WrappidDataContext); const dispatch = useDispatch(); - const github_code = useSelector(state => state.auth.github_code); + const [github_code, setGithub_code] = useState(""); useEffect(() => { - // console.log("trying to find the github code from url"); const currentUrl = window.location.href; - - // console.log(currentUrl, "currentUrl"); + if (currentUrl.includes("checkuserexist?code=")) { - // Extract the code from the URL const urlParams = new URLSearchParams(window.location.search); const extractedCode = urlParams.get("code"); - // console.log(extractedCode, "extractedCode"); - // console.log(github_code, "GITHUB_code from the redux store before the calling"); - dispatch({ "github_code": extractedCode, "type": "GITHUB_CODE" }); + setGithub_code(extractedCode); } }, []); useEffect(() => { const backend_Endpoint = "/login/social/github"; - // console.log("github_code in the useeffect", github_code); if(github_code === ""){return;} - // console.log("called the backend"); dispatch( apiRequestAction(HTTP.POST, backend_Endpoint, false, { "platformToken": github_code }, "LOGIN_SUCCESS", "LOGIN_ERROR")); dispatch({ "github_code": "", "type": "GITHUB_CODE" }); + }, [github_code]); - useEffect(() => { - const backend_Endpoint = "/login/social/github"; - - // console.log("github_code in the useeffect", github_code); - if(github_code === ""){return;} - // console.log("called the backend"); - dispatch(apiRequestAction(HTTP.POST, backend_Endpoint, false, { "platformToken": github_code }, "GET_GITHUB_PERSISTANT_ACCESSTOKEN")); - dispatch({ "github_code": "", "type": "GITHUB_CODE" }); - }, [github_code]); const handleAuthoriseGithub = () => { - //change to config dynamic client id + const github_client_id = config.wrappid.socialLogin.github.github_client_id; window.location.href = `https://github.com/login/oauth/authorize?client_id=${github_client_id}&scope=read:user user:email`; From 8b4e883b265555d7250d75528a805a18d99d50bf Mon Sep 17 00:00:00 2001 From: priyanshu2k3 Date: Thu, 10 Oct 2024 10:11:29 +0530 Subject: [PATCH 18/26] feat(core): :sparkles: add the github auth add the github auth ref: #381 --- package/components/inputs/custom/GithubAuthComponent.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/package/components/inputs/custom/GithubAuthComponent.js b/package/components/inputs/custom/GithubAuthComponent.js index 2728d134..8c3c40a2 100644 --- a/package/components/inputs/custom/GithubAuthComponent.js +++ b/package/components/inputs/custom/GithubAuthComponent.js @@ -30,15 +30,13 @@ export default function GithubAuthComponent(props) { dispatch( apiRequestAction(HTTP.POST, backend_Endpoint, false, { "platformToken": github_code }, "LOGIN_SUCCESS", "LOGIN_ERROR")); - dispatch({ "github_code": "", "type": "GITHUB_CODE" }); - }, [github_code]); const handleAuthoriseGithub = () => { const github_client_id = config.wrappid.socialLogin.github.github_client_id; - window.location.href = `https://github.com/login/oauth/authorize?client_id=${github_client_id}&scope=read:user user:email`; + window.location.href = `https://github.com/login/oauth/authorize?client_id=${github_client_id}&scope=repo,discussions,read:user user:email `; return; }; From d76206a8d8bcc67cec63ac77b9625837c381fc91 Mon Sep 17 00:00:00 2001 From: wrappidcare Date: Thu, 10 Oct 2024 04:56:08 +0000 Subject: [PATCH 19/26] chore(release): 0.0.556 --- CHANGELOG.md | 17 +++++++++++++++++ package-lock.json | 4 ++-- package.json | 2 +- package/package-lock.json | 4 ++-- package/package.json | 2 +- 5 files changed, 23 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 016fb046..bed0885a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,23 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [0.0.556](https://github.com/wrappid/core/compare/v0.0.555...v0.0.556) (2024-10-10) + + +### Features + +* **core:** :sparkles: added a linkedinAuthComponent ([b5ef953](https://github.com/wrappid/core/commit/b5ef953967c33f7ad7e0ba5860311d194aadd219)), closes [#382](https://github.com/wrappid/core/issues/382) +* **core:** :sparkles: added a login with linkedIn flow ([ba7c929](https://github.com/wrappid/core/commit/ba7c929652e4c00680aa1407216e12e868075809)), closes [#382](https://github.com/wrappid/core/issues/382) +* **core:** :sparkles: added linkedin auth component ([d92959b](https://github.com/wrappid/core/commit/d92959b8429ee7f5a62b080d74b0ad83c3829a79)), closes [#97](https://github.com/wrappid/core/issues/97) +* **core:** :sparkles: added linkedin auth component ([582fec1](https://github.com/wrappid/core/commit/582fec15063ca4370b7007093ad84fe7ab2260e3)), closes [#97](https://github.com/wrappid/core/issues/97) +* **core:** :sparkles: implemented a feature which will allow users to login with linkedIn ([9461e3b](https://github.com/wrappid/core/commit/9461e3bad00e58b42eb87ec4a060d522eabb5435)), closes [#382](https://github.com/wrappid/core/issues/382) +* **core:** :sparkles: implemented a login with linkedin feature ([ee2708e](https://github.com/wrappid/core/commit/ee2708e381788c613227e1aa951d1fb8563ec234)), closes [#382](https://github.com/wrappid/core/issues/382) + + +### Bug Fixes + +* **global:** :bug: facbooklogin fix ([fe0a4a0](https://github.com/wrappid/core/commit/fe0a4a0f468cc91c19998920db4224d4703eb639)), closes [#383](https://github.com/wrappid/core/issues/383) + ### [0.0.555](https://github.com/wrappid/core/compare/v0.0.554...v0.0.555) (2024-10-03) ### [0.0.554](https://github.com/wrappid/core/compare/v0.0.553...v0.0.554) (2024-10-03) diff --git a/package-lock.json b/package-lock.json index ec2d49a9..6430d4d7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@wrappid/core", - "version": "0.0.555", + "version": "0.0.556", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@wrappid/core", - "version": "0.0.555", + "version": "0.0.556", "license": "MIT", "devDependencies": { "@babel/cli": "7.21.0", diff --git a/package.json b/package.json index caefe653..7d37be67 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@wrappid/core", - "version": "0.0.555", + "version": "0.0.556", "description": "Multi platform app builder core package.", "main": "index.js", "scripts": { diff --git a/package/package-lock.json b/package/package-lock.json index c5944926..2847500a 100644 --- a/package/package-lock.json +++ b/package/package-lock.json @@ -1,12 +1,12 @@ { "name": "@wrappid/core", - "version": "0.0.555", + "version": "0.0.556", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@wrappid/core", - "version": "0.0.555", + "version": "0.0.556", "license": "MIT", "peerDependencies": { "@reduxjs/toolkit": "1.9.1", diff --git a/package/package.json b/package/package.json index c6669180..f650d970 100644 --- a/package/package.json +++ b/package/package.json @@ -1,6 +1,6 @@ { "name": "@wrappid/core", - "version": "0.0.555", + "version": "0.0.556", "description": "Multi platform app builder core package.", "main": "index.js", "scripts": {}, From 137fe4eaae80b027216b1c3e1e538b77d9b52f1d Mon Sep 17 00:00:00 2001 From: PritamIT2023 Date: Thu, 10 Oct 2024 18:27:14 +0530 Subject: [PATCH 20/26] fix(core): :bug: fix GitHub and LinkedIn call automatically fix GitHub and LinkedIn call automatically Ref: #394 --- package/components/inputs/custom/GithubAuthComponent.js | 9 ++++++--- .../components/inputs/custom/LinkedInAuthComponent.js | 4 +++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/package/components/inputs/custom/GithubAuthComponent.js b/package/components/inputs/custom/GithubAuthComponent.js index 8c3c40a2..086b81cf 100644 --- a/package/components/inputs/custom/GithubAuthComponent.js +++ b/package/components/inputs/custom/GithubAuthComponent.js @@ -15,7 +15,9 @@ export default function GithubAuthComponent(props) { useEffect(() => { const currentUrl = window.location.href; - if (currentUrl.includes("checkuserexist?code=")) { + const state = new URLSearchParams(window.location.search).get("state"); + + if (currentUrl.includes("checkuserexist?code=") && state === null) { const urlParams = new URLSearchParams(window.location.search); const extractedCode = urlParams.get("code"); @@ -30,13 +32,14 @@ export default function GithubAuthComponent(props) { dispatch( apiRequestAction(HTTP.POST, backend_Endpoint, false, { "platformToken": github_code }, "LOGIN_SUCCESS", "LOGIN_ERROR")); + setGithub_code(""); }, [github_code]); const handleAuthoriseGithub = () => { - const github_client_id = config.wrappid.socialLogin.github.github_client_id; + const clientId = config.wrappid.socialLogin.github.clientId; - window.location.href = `https://github.com/login/oauth/authorize?client_id=${github_client_id}&scope=repo,discussions,read:user user:email `; + window.location.href = `https://github.com/login/oauth/authorize?client_id=${clientId}&scope=repo,discussions,read:user,user:email `; return; }; diff --git a/package/components/inputs/custom/LinkedInAuthComponent.js b/package/components/inputs/custom/LinkedInAuthComponent.js index 71ccab23..7ec22985 100644 --- a/package/components/inputs/custom/LinkedInAuthComponent.js +++ b/package/components/inputs/custom/LinkedInAuthComponent.js @@ -50,9 +50,11 @@ export default function LinkedInAuthComponent(props){ useEffect(() => { // Extract the authorization code from the URL const queryParams = new URLSearchParams(window.location.search); + const state = new URLSearchParams(window.location.search).get("state"); + const code = queryParams.get("code"); - if (code != null) { + if ((code != null) && (state != null)) { setAuthCode(code); } From 3b250d5babd4a02385621883f31b1830b5d060b3 Mon Sep 17 00:00:00 2001 From: wrappidcare Date: Thu, 10 Oct 2024 13:03:22 +0000 Subject: [PATCH 21/26] chore(release): 0.0.557 --- CHANGELOG.md | 14 ++++++++++++++ package-lock.json | 4 ++-- package.json | 2 +- package/package-lock.json | 4 ++-- package/package.json | 2 +- 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bed0885a..66b0d9d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,20 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [0.0.557](https://github.com/wrappid/core/compare/v0.0.556...v0.0.557) (2024-10-10) + + +### Features + +* **core:** :sparkles: add the github auth ([8b4e883](https://github.com/wrappid/core/commit/8b4e883b265555d7250d75528a805a18d99d50bf)), closes [#381](https://github.com/wrappid/core/issues/381) +* **core:** :sparkles: adds the github auth component ([e2d65e6](https://github.com/wrappid/core/commit/e2d65e60a05f783712856e19e452f31375748256)), closes [#381](https://github.com/wrappid/core/issues/381) +* **core:** :sparkles: github auth component added ([a3e934e](https://github.com/wrappid/core/commit/a3e934ef1560b68a98b048832b5abe46813f23a4)), closes [#381](https://github.com/wrappid/core/issues/381) + + +### Bug Fixes + +* **core:** :bug: fix GitHub and LinkedIn call automatically ([137fe4e](https://github.com/wrappid/core/commit/137fe4eaae80b027216b1c3e1e538b77d9b52f1d)), closes [#394](https://github.com/wrappid/core/issues/394) + ### [0.0.556](https://github.com/wrappid/core/compare/v0.0.555...v0.0.556) (2024-10-10) diff --git a/package-lock.json b/package-lock.json index 6430d4d7..9ca88793 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@wrappid/core", - "version": "0.0.556", + "version": "0.0.557", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@wrappid/core", - "version": "0.0.556", + "version": "0.0.557", "license": "MIT", "devDependencies": { "@babel/cli": "7.21.0", diff --git a/package.json b/package.json index 7d37be67..02446ab4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@wrappid/core", - "version": "0.0.556", + "version": "0.0.557", "description": "Multi platform app builder core package.", "main": "index.js", "scripts": { diff --git a/package/package-lock.json b/package/package-lock.json index 2847500a..729f4a42 100644 --- a/package/package-lock.json +++ b/package/package-lock.json @@ -1,12 +1,12 @@ { "name": "@wrappid/core", - "version": "0.0.556", + "version": "0.0.557", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@wrappid/core", - "version": "0.0.556", + "version": "0.0.557", "license": "MIT", "peerDependencies": { "@reduxjs/toolkit": "1.9.1", diff --git a/package/package.json b/package/package.json index f650d970..be9427ce 100644 --- a/package/package.json +++ b/package/package.json @@ -1,6 +1,6 @@ { "name": "@wrappid/core", - "version": "0.0.556", + "version": "0.0.557", "description": "Multi platform app builder core package.", "main": "index.js", "scripts": {}, From fb4682a543418d215a318dd9bdc096cc5808a25d Mon Sep 17 00:00:00 2001 From: wrappidcare Date: Thu, 10 Oct 2024 13:44:41 +0000 Subject: [PATCH 22/26] chore(release): 0.0.558 --- CHANGELOG.md | 2 ++ package-lock.json | 4 ++-- package.json | 2 +- package/package-lock.json | 4 ++-- package/package.json | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 66b0d9d1..98d13922 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [0.0.558](https://github.com/wrappid/core/compare/v0.0.557...v0.0.558) (2024-10-10) + ### [0.0.557](https://github.com/wrappid/core/compare/v0.0.556...v0.0.557) (2024-10-10) diff --git a/package-lock.json b/package-lock.json index 9ca88793..043dc790 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@wrappid/core", - "version": "0.0.557", + "version": "0.0.558", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@wrappid/core", - "version": "0.0.557", + "version": "0.0.558", "license": "MIT", "devDependencies": { "@babel/cli": "7.21.0", diff --git a/package.json b/package.json index 02446ab4..9f5a4c91 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@wrappid/core", - "version": "0.0.557", + "version": "0.0.558", "description": "Multi platform app builder core package.", "main": "index.js", "scripts": { diff --git a/package/package-lock.json b/package/package-lock.json index 729f4a42..762e0052 100644 --- a/package/package-lock.json +++ b/package/package-lock.json @@ -1,12 +1,12 @@ { "name": "@wrappid/core", - "version": "0.0.557", + "version": "0.0.558", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@wrappid/core", - "version": "0.0.557", + "version": "0.0.558", "license": "MIT", "peerDependencies": { "@reduxjs/toolkit": "1.9.1", diff --git a/package/package.json b/package/package.json index be9427ce..fc8130a7 100644 --- a/package/package.json +++ b/package/package.json @@ -1,6 +1,6 @@ { "name": "@wrappid/core", - "version": "0.0.557", + "version": "0.0.558", "description": "Multi platform app builder core package.", "main": "index.js", "scripts": {}, From a777c19856e20ff11a62f775d31ea0217a0ee315 Mon Sep 17 00:00:00 2001 From: PritamIT2023 Date: Fri, 11 Oct 2024 12:33:16 +0530 Subject: [PATCH 23/26] fix(core): :bug: fix github login fix github login Ref: #394 --- package/components/inputs/custom/GithubAuthComponent.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/components/inputs/custom/GithubAuthComponent.js b/package/components/inputs/custom/GithubAuthComponent.js index 086b81cf..8531ecc3 100644 --- a/package/components/inputs/custom/GithubAuthComponent.js +++ b/package/components/inputs/custom/GithubAuthComponent.js @@ -17,7 +17,7 @@ export default function GithubAuthComponent(props) { const state = new URLSearchParams(window.location.search).get("state"); - if (currentUrl.includes("checkuserexist?code=") && state === null) { + if (currentUrl.includes("checkUserExist?code=") && state === null) { const urlParams = new URLSearchParams(window.location.search); const extractedCode = urlParams.get("code"); From fb38ffdaf8902e51c2985b879e3e9bb0b1978922 Mon Sep 17 00:00:00 2001 From: wrappidcare Date: Fri, 11 Oct 2024 07:06:05 +0000 Subject: [PATCH 24/26] chore(release): 0.0.559 --- CHANGELOG.md | 7 +++++++ package-lock.json | 4 ++-- package.json | 2 +- package/package-lock.json | 4 ++-- package/package.json | 2 +- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 98d13922..a1980421 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [0.0.559](https://github.com/wrappid/core/compare/v0.0.558...v0.0.559) (2024-10-11) + + +### Bug Fixes + +* **core:** :bug: fix github login ([a777c19](https://github.com/wrappid/core/commit/a777c19856e20ff11a62f775d31ea0217a0ee315)), closes [#394](https://github.com/wrappid/core/issues/394) + ### [0.0.558](https://github.com/wrappid/core/compare/v0.0.557...v0.0.558) (2024-10-10) ### [0.0.557](https://github.com/wrappid/core/compare/v0.0.556...v0.0.557) (2024-10-10) diff --git a/package-lock.json b/package-lock.json index 043dc790..81f4ff4e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@wrappid/core", - "version": "0.0.558", + "version": "0.0.559", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@wrappid/core", - "version": "0.0.558", + "version": "0.0.559", "license": "MIT", "devDependencies": { "@babel/cli": "7.21.0", diff --git a/package.json b/package.json index 9f5a4c91..850b5838 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@wrappid/core", - "version": "0.0.558", + "version": "0.0.559", "description": "Multi platform app builder core package.", "main": "index.js", "scripts": { diff --git a/package/package-lock.json b/package/package-lock.json index 762e0052..8b691a7e 100644 --- a/package/package-lock.json +++ b/package/package-lock.json @@ -1,12 +1,12 @@ { "name": "@wrappid/core", - "version": "0.0.558", + "version": "0.0.559", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@wrappid/core", - "version": "0.0.558", + "version": "0.0.559", "license": "MIT", "peerDependencies": { "@reduxjs/toolkit": "1.9.1", diff --git a/package/package.json b/package/package.json index fc8130a7..86d7173d 100644 --- a/package/package.json +++ b/package/package.json @@ -1,6 +1,6 @@ { "name": "@wrappid/core", - "version": "0.0.558", + "version": "0.0.559", "description": "Multi platform app builder core package.", "main": "index.js", "scripts": {}, From 53dc5a2e102825c1c9666539b24c26b1a3ed08c8 Mon Sep 17 00:00:00 2001 From: PritamIT2023 Date: Sat, 12 Oct 2024 11:55:00 +0530 Subject: [PATCH 25/26] feat(core): :sparkles: google sign-in implementaion google sign-in implementaion Ref: #397 --- .../inputs/custom/GoogleAuthComponent.js | 71 +++++++++++++++++++ package/index.js | 3 +- 2 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 package/components/inputs/custom/GoogleAuthComponent.js diff --git a/package/components/inputs/custom/GoogleAuthComponent.js b/package/components/inputs/custom/GoogleAuthComponent.js new file mode 100644 index 00000000..58f6f37e --- /dev/null +++ b/package/components/inputs/custom/GoogleAuthComponent.js @@ -0,0 +1,71 @@ +// eslint-disable-next-line no-unused-vars, unused-imports/no-unused-imports +import React, { useEffect, useRef } from "react"; + +// eslint-disable-next-line import/no-unresolved +import { WrappidDataContext } from "@wrappid/styles"; +import { useDispatch } from "react-redux"; + +import { HTTP } from "../../../config/constants"; +import { apiRequestAction } from "../../../store/action/appActions"; +import CoreBox from "../../layouts/CoreBox"; + +const GoogleAuthComponent = () => { + const { config } = React.useContext(WrappidDataContext); + const dispatch = useDispatch(); + + const buttonRef = useRef(null); + + useEffect(() => { + const script = document.createElement("script"); + + script.src = "https://accounts.google.com/gsi/client"; + script.async = true; + script.defer = true; + script.onload = initializeGoogleSignIn; + document.body.appendChild(script); + + return () => { + document.body.removeChild(script); + }; + }, []); + + const handleCredentialResponse = (response) => { + // You can send this token to your server or handle it as needed + const data = { platformToken: response.credential }; + + dispatch( + apiRequestAction( + HTTP.POST, + "/login/social/google", + false, + data, + "LOGIN_SUCCESS", + "LOGIN_ERROR" + ) + ); + }; + + const initializeGoogleSignIn = () => { + if (window.google) { + window.google.accounts.id.initialize({ + + auto_select: true, + // Replace with your actual client ID + callback : handleCredentialResponse, + client_id : config.wrappid.socialLogin.google.clientId + }); + + window.google.accounts.id.renderButton( + buttonRef.current, + { size: "large", theme: "outline" } // customization attributes + ); + window.google.accounts.id.prompt(); // also display the One Tap dialog + } + }; + + return ( + + ); +}; + +export default GoogleAuthComponent; \ No newline at end of file diff --git a/package/index.js b/package/index.js index 297dd4dd..1d65ae65 100644 --- a/package/index.js +++ b/package/index.js @@ -113,6 +113,7 @@ import CoreTimePicker from "./components/inputs/CoreTimePicker"; import CoreTimeRangePicker from "./components/inputs/CoreTimeRangePicker"; import FacebookAuthComponent from "./components/inputs/custom/FacebookAuthComponent"; import GithubAuthComponent from "./components/inputs/custom/GithubAuthComponent"; +import GoogleAuthComponent from "./components/inputs/custom/GoogleAuthComponent"; import LinkedInAuthComponent from "./components/inputs/custom/LinkedInAuthComponent"; import CoreForm from "./components/inputs/forms/CoreForm"; import { @@ -340,6 +341,6 @@ export { ThemeSelector, ThreeColumnLayout, toggleMenuItemState, toggleRightMenuState, TwoColumnLayout, urls, useDynamicRefs, // Network status custom hook useNetworkStatus, UserChip, VCenteredBlankLayout, viewFormattedDate, WEB_PLATFORM, XLargeCoreStyles, - XXLargeCoreStyles, FacebookAuthComponent, GithubAuthComponent, LinkedInAuthComponent + XXLargeCoreStyles, FacebookAuthComponent, GithubAuthComponent, LinkedInAuthComponent, GoogleAuthComponent }; From a75bac6ee10b90894e1a6db62ef384408ee3ca90 Mon Sep 17 00:00:00 2001 From: wrappidcare Date: Sat, 12 Oct 2024 06:54:04 +0000 Subject: [PATCH 26/26] chore(release): 0.0.560 --- CHANGELOG.md | 7 +++++++ package-lock.json | 4 ++-- package.json | 2 +- package/package-lock.json | 4 ++-- package/package.json | 2 +- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a1980421..5d8dc955 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [0.0.560](https://github.com/wrappid/core/compare/v0.0.559...v0.0.560) (2024-10-12) + + +### Features + +* **core:** :sparkles: google sign-in implementaion ([53dc5a2](https://github.com/wrappid/core/commit/53dc5a2e102825c1c9666539b24c26b1a3ed08c8)), closes [#397](https://github.com/wrappid/core/issues/397) + ### [0.0.559](https://github.com/wrappid/core/compare/v0.0.558...v0.0.559) (2024-10-11) diff --git a/package-lock.json b/package-lock.json index 81f4ff4e..30619142 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@wrappid/core", - "version": "0.0.559", + "version": "0.0.560", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@wrappid/core", - "version": "0.0.559", + "version": "0.0.560", "license": "MIT", "devDependencies": { "@babel/cli": "7.21.0", diff --git a/package.json b/package.json index 850b5838..87d32035 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@wrappid/core", - "version": "0.0.559", + "version": "0.0.560", "description": "Multi platform app builder core package.", "main": "index.js", "scripts": { diff --git a/package/package-lock.json b/package/package-lock.json index 8b691a7e..2b90aaab 100644 --- a/package/package-lock.json +++ b/package/package-lock.json @@ -1,12 +1,12 @@ { "name": "@wrappid/core", - "version": "0.0.559", + "version": "0.0.560", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@wrappid/core", - "version": "0.0.559", + "version": "0.0.560", "license": "MIT", "peerDependencies": { "@reduxjs/toolkit": "1.9.1", diff --git a/package/package.json b/package/package.json index 86d7173d..3d89d42e 100644 --- a/package/package.json +++ b/package/package.json @@ -1,6 +1,6 @@ { "name": "@wrappid/core", - "version": "0.0.559", + "version": "0.0.560", "description": "Multi platform app builder core package.", "main": "index.js", "scripts": {},