Skip to content

Commit

Permalink
devop: ff pp changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kvhnuke committed May 23, 2024
1 parent b0bd524 commit b3e0281
Show file tree
Hide file tree
Showing 11 changed files with 173 additions and 72 deletions.
2 changes: 1 addition & 1 deletion packages/extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"watch-vue-firefox": "cross-env BROWSER='firefox' vue-cli-service build --watch --no-clean"
},
"dependencies": {
"@amplitude/analytics-browser": "2.5.3",
"@amplitude/analytics-browser": "^2.8.0",
"@babel/runtime": "^7.24.5",
"@enkryptcom/extension-bridge": "workspace:^",
"@enkryptcom/hw-wallets": "workspace:^",
Expand Down
46 changes: 24 additions & 22 deletions packages/extension/src/libs/metrics/amplitude.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,30 @@ class Metrics {
const settingsState = new SettingsState();
settingsState.getEnkryptSettings().then((set) => {
this.installedTime = set.installedTimestamp;
init("apikey", {
instanceName: process.env.IS_DEV
? "enkrypt-extension-dev"
: "enkrypt-extension",
optOut: !set.isMetricsEnabled,
serverUrl: process.env.IS_DEV
? "https://analytics-enkrypt-dev.mewwallet.dev/record"
: "https://analytics-enkrypt.mewwallet.dev/record",
appVersion: process.env.PACKAGE_VERSION as string,
trackingOptions: {
ipAddress: false,
},
userId: set.randomUserID,
useBatch: true,
identityStorage: "none",
logLevel: Types.LogLevel.None,
defaultTracking: {
formInteractions: false,
pageViews: false,
sessions: false,
},
});
if (typeof window !== "undefined") {
init("apikey", {
instanceName: process.env.IS_DEV
? "enkrypt-extension-dev"
: "enkrypt-extension",
optOut: !set.isMetricsEnabled,
serverUrl: process.env.IS_DEV
? "https://analytics-enkrypt-dev.mewwallet.dev/record"
: "https://analytics-enkrypt.mewwallet.dev/record",
appVersion: process.env.PACKAGE_VERSION as string,
trackingOptions: {
ipAddress: false,
},
userId: set.randomUserID,
useBatch: true,
identityStorage: "none",
sessionTimeout: 15 * 60 * 1000, // 15 mins
logLevel: Types.LogLevel.None,
defaultTracking: {
formInteractions: false,
pageViews: false,
},
});
}
});
}
track(event: string, options: Record<string, unknown>) {
Expand Down
3 changes: 2 additions & 1 deletion packages/extension/src/manifest/manifest-firefox.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,6 @@
"gecko": {
"strict_min_version": "100.0"
}
}
},
"content_security_policy": "script-src 'self' 'unsafe-eval' 'wasm-unsafe-eval'"
}
1 change: 1 addition & 0 deletions packages/extension/src/ui/onboard/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const isShowBackButton = () => {
return (
route.name &&
route.name != "new-wallet" &&
route.name != "user-analytics" &&
route.name != "create-wallet-wallet-ready" &&
route.name != "restore-wallet-wallet-ready" &&
!(route.name as string).includes("hardware-wallet")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ const nextAction = () => {
isInitializing.value = true;
onboardInitializeWallets(phrase, password).then(() => {
isInitializing.value = false;
router.push({ name: routes.walletReady.name });
if (process.env.IS_FIREFOX) {
router.push({ name: routes.userAnalytics.name });
} else {
router.push({ name: routes.walletReady.name });
}
});
};
</script>
Expand Down
6 changes: 6 additions & 0 deletions packages/extension/src/ui/onboard/create-wallet/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import TypePassword from "./type-password.vue";
import RecoveryPhrase from "./recovery-phrase.vue";
import CheckPhrase from "./double-check-phrase.vue";
import WalletReady from "./wallet-ready.vue";
import UserAnalytics from "../user-analytics.vue";
import { RouteRecordRaw } from "vue-router";
export const routes = {
pickPassword: {
Expand All @@ -25,6 +26,11 @@ export const routes = {
name: "check-phrase",
component: CheckPhrase,
},
userAnalytics: {
path: "user-analytics",
name: "user-analytics",
component: UserAnalytics,
},
walletReady: {
path: "wallet-ready",
name: "wallet-ready",
Expand Down
6 changes: 6 additions & 0 deletions packages/extension/src/ui/onboard/restore-wallet/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import EnterRecoveryPhrase from "./enter-recovery-phrase.vue";
import PickPassword from "./pick-password.vue";
import TypePassword from "./type-password.vue";
import WalletReady from "../create-wallet/wallet-ready.vue";
import UserAnalytics from "../user-analytics.vue";
import { RouteRecordRaw } from "vue-router";
export const routes = {
start: {
Expand Down Expand Up @@ -31,6 +32,11 @@ export const routes = {
name: "type-password",
component: TypePassword,
},
userAnalytics: {
path: "user-analytics",
name: "user-analytics",
component: UserAnalytics,
},
walletReady: {
path: "wallet-ready",
name: "wallet-ready",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,13 @@ const nextAction = () => {
isInitializing.value = true;
onboardInitializeWallets(store.mnemonic, store.password).then(() => {
isInitializing.value = false;
router.push({
name: routes.walletReady.name,
});
if (process.env.IS_FIREFOX) {
router.push({ name: routes.userAnalytics.name });
} else {
router.push({
name: routes.walletReady.name,
});
}
});
}
};
Expand Down
2 changes: 2 additions & 0 deletions packages/extension/src/ui/onboard/routes.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { RouteRecordRaw } from "vue-router";
import NewWallet from "./new-wallet.vue";
import UserAnalytics from "./user-analytics.vue";
import CreateWalletUI from "./create-wallet/routes";
import RestoreWalletUI from "./restore-wallet/routes";
import HardwareWalletUI from "./hardware-wallet/routes";
Expand All @@ -9,6 +10,7 @@ uiRoutes = uiRoutes.concat(RestoreWalletUI());
uiRoutes = uiRoutes.concat(HardwareWalletUI());
const routes = [
{ path: "/", component: NewWallet, name: "new-wallet" },
{ path: "/user-analytics", component: UserAnalytics, name: "user-analytics" },
...uiRoutes,
];
export default routes;
88 changes: 88 additions & 0 deletions packages/extension/src/ui/onboard/user-analytics.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<template>
<div class="new-wallet">
<logo-big class="new-wallet__logo" />
<h3>Privacy<br />Data collection.</h3>
<p>random text about data collection</p>
<p>
more text about data collection ore text about data collectionore text
about data collectionore text about data collectionore text about data
collectionore text about data collectionore text about data s
</p>

<div class="new-wallet__buttons">
<base-button title="Agree to anonymous data collection" :click="agree" />
<base-button
title="Deny anonymous data collection"
:no-background="true"
:click="deny"
/>
</div>
</div>
</template>
<script setup lang="ts">
import LogoBig from "@action/icons/common/logo-big.vue";
import BaseButton from "@action/components/base-button/index.vue";
import SettingsState from "@/libs/settings-state";
import { optOutofMetrics } from "@/libs/metrics";
import { routes as cwalletRoutes } from "./create-wallet/routes";
// import { routes as rwalletRoutes } from "./restore-wallet/routes";
import { useRouter } from "vue-router";
const router = useRouter();
const settingsState = new SettingsState();
const agree = async () => {
const enkryptSettings = await settingsState.getEnkryptSettings();
enkryptSettings.isMetricsEnabled = true;
await settingsState.setEnkryptSettings(enkryptSettings);
optOutofMetrics(false);
router.push({ name: cwalletRoutes.walletReady.name });
};
const deny = async () => {
const enkryptSettings = await settingsState.getEnkryptSettings();
enkryptSettings.isMetricsEnabled = false;
await settingsState.setEnkryptSettings(enkryptSettings);
optOutofMetrics(true);
router.push({ name: cwalletRoutes.walletReady.name });
};
</script>

<style lang="less">
@import "~@action/styles/theme.less";
.new-wallet {
&__logo {
margin-bottom: 24px;
}
h3 {
font-style: normal;
font-weight: 700;
font-size: 34px;
line-height: 40px;
letter-spacing: 0.25px;
color: @primaryLabel;
margin: 0 0 16px 0;
}
p {
font-style: normal;
font-weight: 400;
font-size: 14px;
line-height: 20px;
letter-spacing: 0.25px;
margin: 0 0 16px 0;
color: @primaryLabel;
}
&__buttons {
text-align: center;
a {
margin-top: 8px;
}
}
}
</style>
75 changes: 31 additions & 44 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -30,29 +30,28 @@ __metadata:
languageName: node
linkType: hard

"@amplitude/analytics-browser@npm:2.5.3":
version: 2.5.3
resolution: "@amplitude/analytics-browser@npm:2.5.3"
dependencies:
"@amplitude/analytics-client-common": ^2.1.1
"@amplitude/analytics-core": ^2.2.2
"@amplitude/analytics-types": ^2.5.0
"@amplitude/plugin-page-view-tracking-browser": ^2.2.3
"@amplitude/plugin-web-attribution-browser": ^2.1.4
"@amplitude/analytics-browser@npm:2.8.0":
version: 2.8.0
resolution: "@amplitude/analytics-browser@npm:2.8.0"
dependencies:
"@amplitude/analytics-client-common": ^2.2.0
"@amplitude/analytics-core": ^2.2.8
"@amplitude/analytics-types": ^2.5.1
"@amplitude/plugin-page-view-tracking-browser": ^2.2.12
tslib: ^2.4.1
checksum: 9d67fa579bbe06d7b1f4c5df152f9dd669716c4ef79f97f3ee9ed5c74b27b3092752434eca0beb5b557473d8cbfcc1c93cbf336e87039ae31197df8f73f1bbf4
checksum: 3f7cbec435ef7aa1393f608afff374d42543a64fe5019b3849c137c98918246ef4b905079d85893a2a88fba510749b5a0ac0685848551620187c21cbac7a4ea6
languageName: node
linkType: hard

"@amplitude/analytics-client-common@npm:^2.1.1, @amplitude/analytics-client-common@npm:^2.1.5":
version: 2.1.5
resolution: "@amplitude/analytics-client-common@npm:2.1.5"
"@amplitude/analytics-client-common@npm:^2.2.0":
version: 2.2.0
resolution: "@amplitude/analytics-client-common@npm:2.2.0"
dependencies:
"@amplitude/analytics-connector": ^1.4.8
"@amplitude/analytics-core": ^2.2.6
"@amplitude/analytics-types": ^2.5.0
"@amplitude/analytics-core": ^2.2.8
"@amplitude/analytics-types": ^2.5.1
tslib: ^2.4.1
checksum: 1443f3c5bed5c18ebe88c9e4583ed4f8f75625c4eb3726c1f55f3f45910bc36df70ccef6e8606395c1550e4e05c8f845f1904ec220652e31cbff06b38a098c57
checksum: eb9a7a122a6b02a16abcae6c9e112b04ed1e0c7430619334fea323e95ada9f894638dcd86c1e6cbcd7aeee6cdeb0f2e0ff13de1c10b7790774174b018a3d21ee
languageName: node
linkType: hard

Expand All @@ -63,43 +62,31 @@ __metadata:
languageName: node
linkType: hard

"@amplitude/analytics-core@npm:^2.2.2, @amplitude/analytics-core@npm:^2.2.6":
version: 2.2.6
resolution: "@amplitude/analytics-core@npm:2.2.6"
"@amplitude/analytics-core@npm:^2.2.8":
version: 2.2.8
resolution: "@amplitude/analytics-core@npm:2.2.8"
dependencies:
"@amplitude/analytics-types": ^2.5.0
"@amplitude/analytics-types": ^2.5.1
tslib: ^2.4.1
checksum: 6579044b7efdfb232320b5dd7ab1c43be7c29fba90a3978242ce8467e7437b6756a1298c7d8813bedabc55a00a1c1abeb2f952c56779f554544f6610ef5307b5
checksum: a7a70b1124bf25bfb4fee74ec2d9124fce05bd31147a61ecf6dcfa307ba150e4114cd68fba336ddeb8d6b53ee6c2f4ed561fdc329dd652955daea848887baafc
languageName: node
linkType: hard

"@amplitude/analytics-types@npm:^2.5.0":
version: 2.5.0
resolution: "@amplitude/analytics-types@npm:2.5.0"
checksum: c2f0d4514d4d1772794dd6209df2311368076aaa2555b03763a9fcc21d4d861996fd1c13cd1c29a8d9f801470b20e56b2d47c3c4f35e76a3f8ab9ce2de3efcd9
languageName: node
linkType: hard

"@amplitude/plugin-page-view-tracking-browser@npm:^2.2.3":
version: 2.2.8
resolution: "@amplitude/plugin-page-view-tracking-browser@npm:2.2.8"
dependencies:
"@amplitude/analytics-client-common": ^2.1.5
"@amplitude/analytics-types": ^2.5.0
tslib: ^2.4.1
checksum: d6759f2df86765ca9488548bb80bf46b719c4a8a36ebd95ccc403ec70211a4e177df163e0765895a64314e8dafe1b69727a64924eb83f47e4c4eae478806257a
"@amplitude/analytics-types@npm:^2.5.1":
version: 2.5.1
resolution: "@amplitude/analytics-types@npm:2.5.1"
checksum: 7b46ed1fbe856990ac71ee3d9a9185f16f286a17f5bbd93560d03b608a6696deeb6c7cf42b9937889b38266f97e8b22a59f132177cdfd682da4b30accb3ae1b4
languageName: node
linkType: hard

"@amplitude/plugin-web-attribution-browser@npm:^2.1.4":
version: 2.1.9
resolution: "@amplitude/plugin-web-attribution-browser@npm:2.1.9"
"@amplitude/plugin-page-view-tracking-browser@npm:^2.2.12":
version: 2.2.12
resolution: "@amplitude/plugin-page-view-tracking-browser@npm:2.2.12"
dependencies:
"@amplitude/analytics-client-common": ^2.1.5
"@amplitude/analytics-core": ^2.2.6
"@amplitude/analytics-types": ^2.5.0
"@amplitude/analytics-client-common": ^2.2.0
"@amplitude/analytics-types": ^2.5.1
tslib: ^2.4.1
checksum: 7b49abaaa479f2114f4dd8100e4c99fb0e84be338a80d07f614814396825064144ede2fea57789e0d8f0abcde21597b23851d7efc99a602df8633db0ff4970b7
checksum: 5073f93fbf4e58e3907954b7d2070d936e67cdf8a9e5f665ea60777c970622a0c211767ade22326c5a5062d7c4149d5cd0a9688e88ff29beddb1cf61f28e6415
languageName: node
linkType: hard

Expand Down Expand Up @@ -2559,7 +2546,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@enkryptcom/extension@workspace:packages/extension"
dependencies:
"@amplitude/analytics-browser": 2.5.3
"@amplitude/analytics-browser": 2.8.0
"@babel/plugin-transform-class-static-block": ^7.24.4
"@babel/runtime": ^7.24.5
"@enkryptcom/extension-bridge": "workspace:^"
Expand Down

1 comment on commit b3e0281

@github-actions
Copy link

Choose a reason for hiding this comment

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

Please sign in to comment.