diff --git a/package.json b/package.json index 9947026..8784ee8 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,6 @@ "tslib": "^2.6.0" }, "scripts": { - "deploy:payment:dev": "yarn workspace @qubic-connect/payment-form-web deploy:dev", "build": "lerna run build --scope={'@qubic-connect/redirect,@qubic-connect/detect-iab,@qubic-connect/core'}", "watch": "lerna run watch --scope={'@qubic-connect/redirect,@qubic-connect/detect-iab,@qubic-connect/core'}", "release": "npm run build && lerna publish --force-publish", @@ -49,4 +48,4 @@ "url": "https://github.com/getamis/qubic-creator-sdk/issues" }, "homepage": "https://github.com/getamis/qubic-creator-sdk#readme" -} \ No newline at end of file +} diff --git a/packages/core/src/QubicConnect.ts b/packages/core/src/QubicConnect.ts index 423be5c..141a5fe 100644 --- a/packages/core/src/QubicConnect.ts +++ b/packages/core/src/QubicConnect.ts @@ -75,9 +75,6 @@ export class QubicConnect { // user did not install metamask return; } - if (!providerOptions.metamask.provider.isMetaMask) { - throw Error('metamask only accept MetaMask provider'); - } } if (providerOptions.walletconnect) { @@ -194,11 +191,14 @@ export class QubicConnect { provider, ...restUser } = user; + + // do not saved sensitive user data + restUser.qubicUser = null; localStorage.setItem(USER_STORAGE_KEY, JSON.stringify(restUser)); } } - private hydrateUser() { + private async hydrateUser() { const saved = localStorage.getItem(USER_STORAGE_KEY); if (!saved) return; try { @@ -211,8 +211,14 @@ export class QubicConnect { if (QubicConnect.ifTokenExpired(user.expiredAt)) { this.handleLogout(null); } else { + // login again to get qubicUser data if exists + const { + me: { qubicUser }, + } = await getMe(this.marketRequestGraphql); + this.handleLogin(null, { ...user, + qubicUser, provider, }); } diff --git a/packages/core/src/api/me.ts b/packages/core/src/api/me.ts index 0bcba17..b911abc 100644 --- a/packages/core/src/api/me.ts +++ b/packages/core/src/api/me.ts @@ -16,6 +16,7 @@ export const GET_ME = gql` qubicUser { provider email + phone } } } diff --git a/packages/core/src/types/QubicUser.ts b/packages/core/src/types/QubicUser.ts index c8096a4..933b1de 100644 --- a/packages/core/src/types/QubicUser.ts +++ b/packages/core/src/types/QubicUser.ts @@ -9,4 +9,5 @@ export enum QubicUserProvider { export interface QubicUser { provider: QubicUserProvider; email: string; + phone: string | null; }