Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/tma socials #3025

Closed
wants to merge 34 commits into from
Closed

Feat/tma socials #3025

wants to merge 34 commits into from

Conversation

ganchoradkov
Copy link
Member

@ganchoradkov ganchoradkov commented Oct 7, 2024

Description

Implemented social login flow that works in telegram mini apps. It uses direct redirects instead of popup window for social login approval.

TODO: remove custom secure site urls before merge. This would also cause the test app linked here to stop working as its using latest vercel deployment of this PR

Type of change

  • Chore (non-breaking change that addresses non-functional tasks, maintenance, or code quality improvements)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Test app

https://t.me/appkit_test_ggr_bot/appkit

Checklist

  • Code in this PR is covered by automated tests (Unit tests, E2E tests)
  • My changes generate no new warnings
  • I have reviewed my own code
  • I have filled out all required sections
  • I have tested my changes on the preview link
  • Approver of this PR confirms that the changes are tested on the preview link

Copy link

changeset-bot bot commented Oct 7, 2024

⚠️ No Changeset found

Latest commit: 6623115

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Oct 7, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
appkit-laboratory ✅ Ready (Inspect) Visit Preview Nov 6, 2024 11:15am
appkit-vue-solana ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 6, 2024 11:15am
appkit-wagmi-cdn-example ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 6, 2024 11:15am
vue-wagmi-example ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 6, 2024 11:15am
web3modal-gallery ✅ Ready (Inspect) Visit Preview Nov 6, 2024 11:15am

Copy link
Contributor

github-actions bot commented Oct 7, 2024

Warnings
⚠️ Secure site URL has been changed

Generated by 🚫 dangerJS against 6623115

Copy link
Contributor

github-actions bot commented Oct 7, 2024

Coverage Report for Coverage

Status Category Percentage Covered / Total
🔵 Lines 340.05% 4514 / 18911
🔵 Statements 340.05% 4514 / 18911
🔵 Functions 375.59% 372 / 1092
🔵 Branches 464.4100000000001% 683 / 1395
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/appkit/src/client.ts 70.95% 74.03% 85.54% 70.95% 99-100, 119-120, 123-124, 139-142, 145-148, 151-152, 181-192, 195-202, 297, 305, 343-346, 352-359, 362, 457-469, 484-487, 494-495, 505-506, 521-522, 525-526, 529-530, 533-534, 543-545, 551-558, 575-578, 613, 622-634, 644-649, 651-662, 664-674, 676-690
packages/common/src/utils/SafeLocalStorage.ts 90.9% 100% 80% 90.9% 57-60
packages/core/src/controllers/OptionsController.ts 59.13% 72.72% 30.43% 59.13% 147-148, 151-152, 156-157, 161-162, 166-167, 180-181, 196-197, 200-201, 204-205, 208-209, 212-213, 216-217, 228-229, 232-233, 236-237, 240-241, 244-245, 248-249, 252-253
packages/core/src/utils/CoreHelperUtil.ts 37.01% 71.42% 32.43% 37.01% 15-23, 26-27, 30-33, 36-39, 42-45, 48-49, 52-53, 56-57, 60-61, 68-69, 83-95, 98-99, 102-124, 127-140, 143-153, 155-160, 162-167, 172-176, 180-196, 199-223, 226-235, 254-270, 285-295, 302-307, 326, 328, 330-331, 341-347, 350-354, 363, 368, 373, 383-384, 392-402
packages/core/src/utils/OptionsUtil.ts 40.74% 100% 50% 40.74% 18-35
packages/scaffold-ui/src/partials/w3m-connect-custom-widget/index.ts 0% 0% 0% 0% 1-95
packages/scaffold-ui/src/partials/w3m-connect-recent-widget/index.ts 0% 0% 0% 0% 1-68
packages/scaffold-ui/src/partials/w3m-connect-recommended-widget/index.ts 0% 0% 0% 0% 1-106
packages/scaffold-ui/src/partials/w3m-social-login-list/index.ts 0% 0% 0% 0% 1-134
packages/scaffold-ui/src/partials/w3m-social-login-widget/index.ts 0% 0% 0% 0% 1-231
packages/scaffold-ui/src/utils/ConstantsUtil.ts 0% 0% 0% 0% 1-13
packages/ui/src/composites/wui-list-wallet/index.ts 0% 0% 0% 0%
Generated in workflow #7216 for commit 6623115 by the Vitest Coverage Report Action

Copy link
Contributor

github-actions bot commented Oct 7, 2024

♻️ Vite-Size ♻️

Size Difference

Size (kb) Gzip (kb)
Total Diff. 0 0

Current Size

Name Size (kb) Gzip (kb)
assets/index-DmKbBjDP.js 1892.65 540.451
assets/index.js 9.642 3.15
assets/index2.js 11.588 3.211
assets/w3m-modal.js 7.504 2.655
assets/noble-curves.js 31.941 12.779
assets/2.21.4_bufferutil.js 2.789 1.328
assets/index3.js 102.251 29.116
assets/index4.js 304.393 87.286
assets/hooks.module.js 74.286 25.525
index.html 0.329 0.238
Total Size 2437.373 705.739

Base Size

Name Size (kb) Gzip (kb)
assets/index-DmKbBjDP.js 1892.65 540.451
assets/index.js 9.642 3.15
assets/index2.js 11.588 3.211
assets/w3m-modal.js 7.504 2.655
assets/noble-curves.js 31.941 12.779
assets/2.21.4_bufferutil.js 2.789 1.328
assets/index3.js 102.251 29.116
assets/index4.js 304.393 87.286
assets/hooks.module.js 74.286 25.525
index.html 0.329 0.238
Total Size 2437.373 705.739

const secureSiteDomain = process.env.NEXT_PUBLIC_SECURE_SITE_SDK_URL
? new URL(process.env.NEXT_PUBLIC_SECURE_SITE_SDK_URL).origin
: ''
const secureSiteDomain = 'https://b1a9fa46.secure-appkit-sdk.pages.dev'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remember to remove this later 🙏

Comment on lines +1177 to +1186

if (isLoginEmailUsed) {
const { isConnected } = await this.authProvider.isConnected()
if (isConnected) {
await this.setAuthProvider()
} else {
this.appKit?.setLoading(false)
}
this.appKit?.setLoading(isLoginEmailUsed)
}

const { isConnected } = await this.authProvider.isConnected()
if (isConnected) {
await this.setAuthProvider()
} else if (isLoginEmailUsed) {
this.appKit?.setLoading(false)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you sure about this? the sync function is triggered on re-connection so I think you do need to check if isLoginEmailUSed

Comment on lines +997 to +999
if (isLoginEmailUsed) {
this.appKit?.setLoading(isLoginEmailUsed)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this needed?? isLoginEmailUsed is already a bool

Comment on lines +650 to +652
if (typeof window === 'undefined' || typeof document === 'undefined') {
return
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have HelperUtil.isClient

@@ -629,4 +635,58 @@ export class AppKit {

return this.initPromise
}

private async checkExistingConnection() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we rename to something like checkExistingSocialConnection ?

Comment on lines +93 to +95
setTimeout(() => {
this.checkExistingConnection()
}, 0)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you need to trigger this here? shouldn't you do after / during authConnector initialization?

@@ -25,7 +26,8 @@ export const SafeLocalStorageKeys = {
CONNECTED_SOCIAL: '@appkit/connected_social',
CONNECTED_SOCIAL_USERNAME: '@appkit/connected_social_username',
RECENT_WALLETS: '@appkit/recent_wallets',
DEEPLINK_CHOICE: 'WALLETCONNECT_DEEPLINK_CHOICE'
DEEPLINK_CHOICE: 'WALLETCONNECT_DEEPLINK_CHOICE',
SOCIAL_PROVIDER: '@appkit/social_provider'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have CONNECTED_SOCIAL

Comment on lines +1 to +2
export const SECURE_SITE_SDK = 'https://b1a9fa46.secure-appkit-sdk.pages.dev/sdk'
// Process.env['NEXT_PUBLIC_SECURE_SITE_SDK_URL'] || 'https://secure.walletconnect.org/sdk'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remember to remove this 🙏

@ganchoradkov
Copy link
Member Author

closing as this is veeery out of date. will link the new PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants