Skip to content

Commit

Permalink
🔄 synced file(s) with circlefin/w3s-pw-web-sdk-internal (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
superandydong authored Jun 12, 2024
2 parents ebf4ada + a6a71b1 commit 0fe7f59
Show file tree
Hide file tree
Showing 4 changed files with 689 additions and 18 deletions.
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@circle-fin/w3s-pw-web-sdk",
"version": "1.0.18",
"version": "1.0.20",
"description": "Javascript/Typescript SDK for Circle Programmable Wallets",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -36,7 +36,12 @@
"engines": {
"node": ">=10.0.0"
},
"dependencies": {},
"dependencies": {
"dotenv": "^16.3.1",
"firebase": "^10.12.1",
"jsonwebtoken": "^9.0.2",
"uuid": "^9.0.1"
},
"devDependencies": {
"@types/jest": "^28.1.7",
"@types/node": "^14.14.14",
Expand Down
22 changes: 11 additions & 11 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,8 @@ export class W3SSdk {
configs?: Configs,
onLoginComplete?: LoginCompleteCallback
) {
if (configs?.socialLoginConfigs?.apple && getApps().length === 0) {
this.firebaseApp = initializeApp(configs.socialLoginConfigs.apple)
if (configs?.loginConfigs?.apple && getApps().length === 0) {
this.firebaseApp = initializeApp(configs.loginConfigs.apple)
} else if (getApps().length !== 0) {
this.firebaseApp = getApps()[0]
}
Expand Down Expand Up @@ -392,7 +392,7 @@ export class W3SSdk {
}

private performFacebookLogin() {
if (!this?.configs?.socialLoginConfigs?.facebook) {
if (!this?.configs?.loginConfigs?.facebook) {
void this.onLoginComplete?.(
{
code: 155140,
Expand All @@ -404,7 +404,7 @@ export class W3SSdk {
return
}

const { appId, redirectUri } = this.configs.socialLoginConfigs.facebook
const { appId, redirectUri } = this.configs.loginConfigs.facebook

const { url = '', state = '' } =
this.generateOauthUrlWithParams(
Expand All @@ -418,7 +418,7 @@ export class W3SSdk {
}

private performGoogleLogin() {
if (!this.configs?.socialLoginConfigs?.google) {
if (!this.configs?.loginConfigs?.google) {
void this.onLoginComplete?.(
{
code: 155140,
Expand All @@ -430,7 +430,7 @@ export class W3SSdk {
return
}

const { clientId, redirectUri } = this.configs.socialLoginConfigs.google
const { clientId, redirectUri } = this.configs.loginConfigs.google

const {
url = '',
Expand Down Expand Up @@ -732,16 +732,16 @@ export class W3SSdk {
deviceInfo: this.deviceInfo,
ssoVerification: {
token: this.socialLoginToken,
deviceToken: this.configs?.socialLoginConfigs?.deviceToken,
deviceToken: this.configs?.loginConfigs?.deviceToken,
deviceEncryptionKey:
this.configs?.socialLoginConfigs?.deviceEncryptionKey,
this.configs?.loginConfigs?.deviceEncryptionKey,
socialLoginProvider: this.socialLoginProvider,
},
emailVerification: {
deviceToken: this.configs?.socialLoginConfigs?.deviceToken,
deviceToken: this.configs?.loginConfigs?.deviceToken,
deviceEncryptionKey:
this.configs?.socialLoginConfigs?.deviceEncryptionKey,
otpToken: this.configs?.socialLoginConfigs?.otpToken,
this.configs?.loginConfigs?.deviceEncryptionKey,
otpToken: this.configs?.loginConfigs?.otpToken,
},
},
},
Expand Down
8 changes: 4 additions & 4 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,9 @@ export enum SocialLoginProvider {
}

/**
* Social Login configurations, including Google, Facebook, and Apple.
* Login configurations, including Google, Facebook, and Apple.
*/
export interface SocialLoginConfigs {
export interface LoginConfigs {
google?:
| {
/**
Expand Down Expand Up @@ -237,9 +237,9 @@ export interface Configs {
*/
authentication?: Authentication
/**
* Social login configurations.
* Login configurations.
*/
socialLoginConfigs?: SocialLoginConfigs
loginConfigs?: LoginConfigs
}

// Challenge Related
Expand Down
Loading

0 comments on commit 0fe7f59

Please sign in to comment.