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

[TAS-345] ⚗️ Test recommended connection method #1315

Merged
merged 1 commit into from
Sep 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions functions/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion functions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@likecoin/iscn-js": "^0.6.2",
"@likecoin/nuxt-google-optimize": "^0.5.3-like.11",
"@likecoin/ui-vue": "^0.7.1",
"@likecoin/wallet-connector": "^0.22.0-beta.1",
"@likecoin/wallet-connector": "^0.23.0-beta.1",
"@nuxt/postcss8": "^1.1.3",
"@nuxt/typescript-build": "^2.1.0",
"@nuxtjs/axios": "^5.12.2",
Expand Down
4 changes: 3 additions & 1 deletion src/experiments/index.js
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export default [];
import exp from './recommend-connection-method';

export default [exp];
6 changes: 6 additions & 0 deletions src/experiments/recommend-connection-method.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default {
name: 'recommend-connection-method',
experimentID: 'O45U7CF8TSqn97ASkFalgg',
isEligible: ({ route }) => !process.server && !!route.name,
variants: [{ name: 'origin', weight: 1 }, { name: 'variant', weight: 1 }],
};
39 changes: 39 additions & 0 deletions src/mixins/wallet-login.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
import { mapActions } from 'vuex';

import experimentMixin from '~/mixins/experiment';

import { logTrackerEvent } from '~/util/EventLogger';

export default {
mixins: [
experimentMixin(
'shouldRecommendConnectionMethod',
'recommend-connection-method',
'variant'
),
],
methods: {
...mapActions([
'openConnectWalletModal',
Expand All @@ -19,6 +28,8 @@ export default {
language: this.$i18n.locale.split('-')[0],
connectWalletTitle: this.$t('connect_wallet_title'),
connectWalletMobileWarning: this.$t('connect_wallet_mobile_warning'),
shouldRecommendConnectionMethod: this.shouldRecommendConnectionMethod,
onEvent: this.handleConnectWalletEvent,
});
if (!connection) return false;
const { method } = connection;
Expand All @@ -38,5 +49,33 @@ export default {
return false;
}
},
handleConnectWalletEvent({ type, ...payload }) {
switch (type) {
case 'toggle_collapsible_connection_method_list':
logTrackerEvent(
this,
'user',
`ConnectWalletMethodList${
payload.isCollapsed ? 'Collapsed' : 'Expanded'
}`,
`ConnectWalletMethodListToggle`,
1
);
break;

case 'select_connection_method':
logTrackerEvent(
this,
'user',
`ConnectWalletSelected_${payload.method}`,
`ConnectWalletSelected`,
1
);
break;

default:
break;
}
},
},
};
20 changes: 10 additions & 10 deletions src/nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,12 +274,12 @@ const nuxtConfig = {
'@nuxtjs/sitemap',
['@nuxtjs/pwa', { icon: false }],
'portal-vue/nuxt',
// [
// '@likecoin/nuxt-google-optimize',
// {
// plugins: [{ src: '~/plugins/experiment.client.js', mode: 'client' }],
// },
// ],
[
'@likecoin/nuxt-google-optimize',
{
plugins: [{ src: '~/plugins/experiment.client.js', mode: 'client' }],
},
],
],

// Auto import components: https://go.nuxtjs.dev/config-components
Expand Down Expand Up @@ -389,10 +389,10 @@ const nuxtConfig = {
hostname: EXTERNAL_URL,
routes: getSitemapRoutes,
},
// googleOptimize: {
// useFetch: false,
// maxAge: 86400, // 1 day
// },
googleOptimize: {
useFetch: false,
maxAge: 86400, // 1 day
},
router: {
extendRoutes(routes, resolve) {
const route = routes.find(r => r.name === 'id');
Expand Down
8 changes: 4 additions & 4 deletions src/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"@likecoin/iscn-js": "^0.6.2",
"@likecoin/nuxt-google-optimize": "^0.5.3-like.11",
"@likecoin/ui-vue": "^0.7.1",
"@likecoin/wallet-connector": "^0.22.0-beta.1",
"@likecoin/wallet-connector": "^0.23.0-beta.1",
"@nuxtjs/axios": "^5.12.2",
"@nuxtjs/i18n": "^7.3.1",
"@nuxtjs/pwa": "^3.3.4",
Expand Down
20 changes: 19 additions & 1 deletion src/store/modules/wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -378,14 +378,32 @@

async openConnectWalletModal(
{ commit, dispatch },
{ language, connectWalletTitle, connectWalletMobileWarning } = {}
{
language,
connectWalletTitle,
connectWalletMobileWarning,
shouldRecommendConnectionMethod = false,
onEvent,
} = {}
) {
commit(WALLET_SET_IS_CONNECTING_WALLET, true);
const connector = await dispatch('getConnector');
if (shouldRecommendConnectionMethod) {
connector.options.availableMethods = [
'keplr',
['keplr-mobile', { tier: 1, isRecommended: true }],
'cosmostation',
'cosmostation-mobile',
'liker-id',
'leap',
'walletconnect-v2',
];
}
const connection = await connector.openConnectionMethodSelectionDialog({
language,
connectWalletTitle,
connectWalletMobileWarning,
onEvent,
});
commit(WALLET_SET_IS_CONNECTING_WALLET, false);
return connection;
Expand Down Expand Up @@ -463,7 +481,7 @@
})
)
.catch(error => {
console.error(error);

Check warning on line 484 in src/store/modules/wallet.js

View workflow job for this annotation

GitHub Actions / CI

Unexpected console statement
});

// Get followees events
Expand Down
Loading