Skip to content

Commit

Permalink
Release v1.21 (#1133)
Browse files Browse the repository at this point in the history
Merge pull request #1133 from madfish-solutions/development
  • Loading branch information
alex-tsx authored Apr 22, 2024
2 parents a3cfb33 + 10d2350 commit b430339
Show file tree
Hide file tree
Showing 53 changed files with 399 additions and 2,156 deletions.
2 changes: 2 additions & 0 deletions .env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,5 @@ PERSONA_ADS_BANNER_UNIT_ID=
PERSONA_ADS_WIDE_BANNER_UNIT_ID=
PERSONA_ADS_MEDIUM_BANNER_UNIT_ID=
PERSONA_ADS_SQUARISH_BANNER_UNIT_ID=

TEMPLE_ADS_ORIGIN_PASSPHRASE=
11 changes: 11 additions & 0 deletions .github/workflows/code-quality-check/action.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
name: Code quality check
description: Installs dependencies and checks TS, linting, dead code

inputs:
optional_modules:
description: Install optional modules too
required: true

runs:
using: 'composite'
steps:
- run: yarn install
if: inputs.optional_modules == 'true'
shell: bash

- run: yarn install --ignore-optional
if: inputs.optional_modules != 'true'
shell: bash

- name: Audit dependencies
Expand Down
26 changes: 25 additions & 1 deletion .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
uses: ./.github/workflows/secrets-setup
with:
GITHUB_ACTION_RUN_ENV: development
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
TEMPLE_WALLET_JITSU_TRACKING_HOST: ${{ vars.TEMPLE_WALLET_JITSU_TRACKING_HOST }}
TEMPLE_WALLET_JITSU_WRITE_KEY: ${{ vars.TEMPLE_WALLET_JITSU_WRITE_KEY }}
TEMPLE_WALLET_EXOLIX_API_KEY: ${{ secrets.TEMPLE_WALLET_EXOLIX_API_KEY }}
Expand All @@ -46,9 +47,12 @@ jobs:
PERSONA_ADS_WIDE_BANNER_UNIT_ID: ${{ vars.PERSONA_ADS_WIDE_BANNER_UNIT_ID }}
PERSONA_ADS_MEDIUM_BANNER_UNIT_ID: ${{ vars.PERSONA_ADS_MEDIUM_BANNER_UNIT_ID }}
PERSONA_ADS_SQUARISH_BANNER_UNIT_ID: ${{ vars.PERSONA_ADS_SQUARISH_BANNER_UNIT_ID }}
TEMPLE_ADS_ORIGIN_PASSPHRASE: ${{ vars.TEMPLE_ADS_ORIGIN_PASSPHRASE }}

- name: Install dependencies and code quality check
- name: Install dependencies and code quality check with private modules
uses: ./.github/workflows/code-quality-check
with:
optional_modules: true

- name: Create Chrome build
run: yarn build:chrome
Expand All @@ -60,3 +64,23 @@ jobs:
path: dist/chrome.zip
if-no-files-found: error
retention-days: 10

- name: Remove private modules
run: rm -rf node_modules/@temple-wallet/extension-ads
shell: bash

- name: Install dependencies and code quality check without private modules
uses: ./.github/workflows/code-quality-check
with:
optional_modules: false

- name: Create Chrome core build
run: yarn build:chrome:core

- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: chrome_core
path: dist/chrome.zip
if-no-files-found: error
retention-days: 10
11 changes: 11 additions & 0 deletions .github/workflows/e2e/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,23 @@ name: End-to-end tests

description: Prepares and runs e2e tests

inputs:
optional_modules:
description: Install optional modules too
required: true

runs:
using: 'composite'
steps:
- working-directory: ./e2e
if: inputs.optional_modules == 'true'
shell: bash
run: yarn install

- working-directory: ./e2e
if: inputs.optional_modules != 'true'
shell: bash
run: yarn install --ignore-optional

- name: Run tests
working-directory: ./e2e
Expand Down
24 changes: 21 additions & 3 deletions .github/workflows/manual-builds.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
name: Manual builds
run-name: Manual build of ${{ github.ref_name }} (Chrome=${{ github.event.inputs.chrome == 'true' || github.event.inputs.chromePlusE2E == 'true' }}; Firefox=${{ github.event.inputs.firefox == 'true' }}; E2E=${{ github.event.inputs.chromePlusE2E == 'true' }})
run-name: Manual build of ${{ github.ref_name }} (Chrome=${{ github.event.inputs.chrome == 'true' || github.event.inputs.chromePlusE2E == 'true' }}; Firefox=${{ github.event.inputs.firefox == 'true' }}; E2E=${{ github.event.inputs.chromePlusE2E == 'true' }}; Core=${{ github.event.inputs.core == 'true' }})

on:
workflow_dispatch:
inputs:
core:
type: boolean
description: Build without private packages
required: false
chrome:
type: boolean
description: Chrome build
Expand Down Expand Up @@ -33,6 +37,7 @@ jobs:
uses: ./.github/workflows/secrets-setup
with:
GITHUB_ACTION_RUN_ENV: development
NPM_TOKEN: ${{ github.event.inputs.core && '' || secrets.NPM_TOKEN }}
TEMPLE_WALLET_JITSU_TRACKING_HOST: ${{ vars.TEMPLE_WALLET_JITSU_TRACKING_HOST }}
TEMPLE_WALLET_JITSU_WRITE_KEY: ${{ vars.TEMPLE_WALLET_JITSU_WRITE_KEY }}
TEMPLE_WALLET_EXOLIX_API_KEY: ${{ secrets.TEMPLE_WALLET_EXOLIX_API_KEY }}
Expand All @@ -57,6 +62,7 @@ jobs:
PERSONA_ADS_WIDE_BANNER_UNIT_ID: ${{ vars.PERSONA_ADS_WIDE_BANNER_UNIT_ID }}
PERSONA_ADS_MEDIUM_BANNER_UNIT_ID: ${{ vars.PERSONA_ADS_MEDIUM_BANNER_UNIT_ID }}
PERSONA_ADS_SQUARISH_BANNER_UNIT_ID: ${{ vars.PERSONA_ADS_SQUARISH_BANNER_UNIT_ID }}
TEMPLE_ADS_ORIGIN_PASSPHRASE: ${{ vars.TEMPLE_ADS_ORIGIN_PASSPHRASE }}
# [e2e]
DEFAULT_HD_ACCOUNT_SEED_PHRASE: ${{ secrets.DEFAULT_HD_ACCOUNT_SEED_PHRASE }}
DEFAULT_HD_ACCOUNT_FIRST_PRIVATE_KEY: ${{ secrets.DEFAULT_HD_ACCOUNT_FIRST_PRIVATE_KEY }}
Expand All @@ -82,11 +88,17 @@ jobs:

- name: Install dependencies and code quality
uses: ./.github/workflows/code-quality-check
with:
optional_modules: ${{ github.event.inputs.core != 'true' }}

- name: Create Chrome build
if: ${{ github.event.inputs.chrome == 'true' || github.event.inputs.chromePlusE2E == 'true' }}
if: ${{ (github.event.inputs.chrome == 'true' || github.event.inputs.chromePlusE2E == 'true') && github.event.inputs.core != 'true' }}
run: yarn build:chrome

- name: Create core Chrome build
if: ${{ (github.event.inputs.chrome == 'true' || github.event.inputs.chromePlusE2E == 'true') && github.event.inputs.core == 'true' }}
run: yarn build:chrome:core

- name: Upload Chrome artifact
if: ${{ github.event.inputs.chrome == 'true' || github.event.inputs.chromePlusE2E == 'true' }}
uses: actions/upload-artifact@v2
Expand All @@ -99,6 +111,8 @@ jobs:
- name: Perform end-to-end tests
if: ${{ github.event.inputs.chromePlusE2E == 'true' }}
uses: ./.github/workflows/e2e
with:
optional_modules: ${{ github.event.inputs.core != 'true' }}

- name: Upload E2E video to Slack
if: ${{ failure() && github.event.inputs.chromePlusE2E == 'true' }}
Expand All @@ -110,9 +124,13 @@ jobs:
initial_comment: <https://github.com/madfish-solutions/templewallet-extension/pull/${{ github.event.number }}|${{ github.event.pull_request.title }}> (Run <https://github.com/madfish-solutions/templewallet-extension/actions/runs/${{ github.run_id }}|№${{ github.run_number }}>)

- name: Create Firefox build
if: ${{ github.event.inputs.firefox == 'true' }}
if: ${{ github.event.inputs.firefox == 'true' && github.event.inputs.core != 'true'}}
run: yarn build:firefox

- name: Create core Firefox build
if: ${{ github.event.inputs.firefox == 'true' && github.event.inputs.core == 'true'}}
run: yarn build:firefox:core

- name: Upload Firefox artifact
if: ${{ github.event.inputs.firefox == 'true' }}
uses: actions/upload-artifact@v2
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
uses: ./.github/workflows/secrets-setup
with:
GITHUB_ACTION_RUN_ENV: production
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
TEMPLE_WALLET_JITSU_TRACKING_HOST: ${{ vars.TEMPLE_WALLET_JITSU_TRACKING_HOST }}
TEMPLE_WALLET_JITSU_WRITE_KEY: ${{ vars.TEMPLE_WALLET_JITSU_WRITE_KEY }}
TEMPLE_WALLET_EXOLIX_API_KEY: ${{ secrets.TEMPLE_WALLET_EXOLIX_API_KEY }}
Expand All @@ -47,9 +48,12 @@ jobs:
PERSONA_ADS_WIDE_BANNER_UNIT_ID: ${{ vars.PERSONA_ADS_WIDE_BANNER_UNIT_ID }}
PERSONA_ADS_MEDIUM_BANNER_UNIT_ID: ${{ vars.PERSONA_ADS_MEDIUM_BANNER_UNIT_ID }}
PERSONA_ADS_SQUARISH_BANNER_UNIT_ID: ${{ vars.PERSONA_ADS_SQUARISH_BANNER_UNIT_ID }}
TEMPLE_ADS_ORIGIN_PASSPHRASE: ${{ vars.TEMPLE_ADS_ORIGIN_PASSPHRASE }}

- name: Install dependencies and code quality
uses: ./.github/workflows/code-quality-check
with:
optional_modules: true

- name: Create Chrome and Firefox builds
run: yarn build:chrome & yarn build:firefox
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/secrets-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ description: Writes secrets
inputs:
GITHUB_ACTION_RUN_ENV:
required: true
NPM_TOKEN:
required: false
TEMPLE_WALLET_JITSU_TRACKING_HOST:
required: true
TEMPLE_WALLET_JITSU_WRITE_KEY:
Expand Down Expand Up @@ -100,6 +102,10 @@ inputs:
runs:
using: 'composite'
steps:
- name: Authenticate with private NPM package
shell: bash
if: ${{ inputs.NPM_TOKEN }}
run: echo "//registry.npmjs.org/:_authToken=${{ inputs.NPM_TOKEN }}" > .npmrc
- name: Create .env file
shell: bash
run: |
Expand Down Expand Up @@ -133,6 +139,7 @@ runs:
PERSONA_ADS_WIDE_BANNER_UNIT_ID=${{ inputs.PERSONA_ADS_WIDE_BANNER_UNIT_ID }}
PERSONA_ADS_MEDIUM_BANNER_UNIT_ID=${{ inputs.PERSONA_ADS_MEDIUM_BANNER_UNIT_ID }}
PERSONA_ADS_SQUARISH_BANNER_UNIT_ID=${{ inputs.PERSONA_ADS_SQUARISH_BANNER_UNIT_ID }}
TEMPLE_ADS_ORIGIN_PASSPHRASE=${{ inputs.TEMPLE_ADS_ORIGIN_PASSPHRASE }}
TEMPLE_WALLET_DEVELOPMENT_BRANCH_NAME=${{ github.ref_name }}
EOF
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,6 @@ DerivedData

#e2e
video-rep

#private package config
.npmrc
17 changes: 14 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
{
"name": "temple-wallet",
"version": "1.20.2",
"version": "1.21.0",
"private": true,
"scripts": {
"start-run": "cross-env TS_NODE_PROJECT=\"webpack/tsconfig.json\" webpack --watch --stats errors-warnings",
"start": "cross-env NODE_ENV=development run-s start-run",
"start:core": "cross-env CORE_BUILD=true run-s start",
"start:firefox": "cross-env TARGET_BROWSER=firefox run-s start",
"start:firefox:core": "cross-env CORE_BUILD=true run-s start:firefox",
"build-run": "cross-env TS_NODE_PROJECT=\"webpack/tsconfig.json\" webpack && ts-node webpack/check-script.ts && ts-node webpack/zip-script.ts",
"build": "cross-env NODE_ENV=production run-s build-run",
"build-all": "run-s build:*",
"build-all": "run-s \"build:!(*:core)\"",
"build-all:core": "run-s build:*:core",
"build:chrome": "cross-env TARGET_BROWSER=chrome run-s build",
"build:chrome:core": "cross-env CORE_BUILD=true run-s build:chrome",
"build:firefox": "cross-env TARGET_BROWSER=firefox run-s build",
"build:firefox:core": "cross-env CORE_BUILD=true run-s build:firefox",
"build:safari": "cross-env TARGET_BROWSER=safari run-s build",
"build:safari:core": "cross-env CORE_BUILD=true run-s build:safari",
"build:opera": "cross-env TARGET_BROWSER=opera run-s build",
"build:opera:core": "cross-env CORE_BUILD=true run-s build:opera",
"test": "jest",
"test:coverage": "jest --coverage",
"ts": "tsc --pretty",
Expand All @@ -34,6 +41,8 @@
"@dicebear/avatars": "4.2.5",
"@dicebear/avatars-bottts-sprites": "4.2.5",
"@dicebear/avatars-jdenticon-sprites": "4.2.5",
"@firebase/app": "^0.10.1",
"@firebase/messaging": "^0.12.8",
"@google/model-viewer": "3.1.1",
"@hypelab/sdk-react": "^1.0.3",
"@jitsu/sdk-js": "madfish-solutions/jitsu-js#87c49de334f5747952f7beda573b95ceb5d86903",
Expand Down Expand Up @@ -136,7 +145,6 @@
"eslint-webpack-plugin": "^3.2.0",
"fast-glob": "^3.2.12",
"file-loader": "6.2.0",
"firebase": "^10.0.0",
"fontfaceobserver": "2.1.0",
"fuse.js": "6.4.6",
"graphql": "^16.6.0",
Expand Down Expand Up @@ -223,5 +231,8 @@
"graphql-request": "^6.1.0",
"json5": "^2.2.2",
"follow-redirects": "^1.15.4"
},
"optionalDependencies": {
"@temple-wallet/extension-ads": "^5.0.1"
}
}
14 changes: 14 additions & 0 deletions public/iframes/ads-stack.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<style>
html, body {
margin: 0;
height: 100%;
width: 100%;
overflow-y: hidden;
}
</style>
</head>
<body></body>
</html>
4 changes: 2 additions & 2 deletions src/app/WithDataLoading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { useLongRefreshLoading } from './hooks/use-long-refresh-loading.hook';
import { useMetadataLoading } from './hooks/use-metadata-loading';
import { useMetadataRefresh } from './hooks/use-metadata-refresh';
import { useStorageAnalytics } from './hooks/use-storage-analytics';
import { useUserIdSync } from './hooks/use-user-id-sync';
import { useUserIdAccountPkhSync } from './hooks/use-user-id-account-pkh-sync';

export const WithDataLoading: FC<PropsWithChildren> = ({ children }) => {
useAssetsMigrations();
Expand All @@ -37,7 +37,7 @@ export const WithDataLoading: FC<PropsWithChildren> = ({ children }) => {
}, []);

useStorageAnalytics();
useUserIdSync();
useUserIdAccountPkhSync();

return <>{children}</>;
};
15 changes: 15 additions & 0 deletions src/app/hooks/use-ads-viewer-pkh.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { useMemo } from 'react';

import { useAccount, useAllAccounts } from 'lib/temple/front';
import { isAccountOfActableType } from 'lib/temple/helpers';

export const useAdsViewerPkh = () => {
const allAccounts = useAllAccounts();
const selectedAccount = useAccount();

return useMemo(() => {
if (isAccountOfActableType(selectedAccount)) return selectedAccount.publicKeyHash;

return allAccounts[0].publicKeyHash;
}, [allAccounts, selectedAccount]);
};
4 changes: 2 additions & 2 deletions src/app/hooks/use-push-notifications.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useEffect } from 'react';

import { initializeApp } from 'firebase/app';
import { getMessaging, getToken } from 'firebase/messaging';
import { initializeApp } from '@firebase/app';
import { getMessaging, getToken } from '@firebase/messaging';
import browser from 'webextension-polyfill';

import { AnalyticsEventCategory, useAnalytics } from 'lib/analytics';
Expand Down
30 changes: 30 additions & 0 deletions src/app/hooks/use-user-id-account-pkh-sync.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { useEffect } from 'react';

import { useUserIdSelector } from 'app/store/settings/selectors';
import { ADS_VIEWER_ADDRESS_STORAGE_KEY, ANALYTICS_USER_ID_STORAGE_KEY } from 'lib/constants';
import { usePassiveStorage } from 'lib/temple/front/storage';

import { useAdsViewerPkh } from './use-ads-viewer-pkh';

export const useUserIdAccountPkhSync = () => {
// User ID

const [storedUserId, setStoredUserId] = usePassiveStorage<string>(ANALYTICS_USER_ID_STORAGE_KEY);
const userId = useUserIdSelector();

useEffect(() => {
if (userId !== storedUserId) {
setStoredUserId(userId);
}
}, [setStoredUserId, storedUserId, userId]);

// ADs viewer address

const adsViewerAddress = useAdsViewerPkh();

const [adsViewerAddressStored, setAdsViewerAddress] = usePassiveStorage<string>(ADS_VIEWER_ADDRESS_STORAGE_KEY);

useEffect(() => {
if (adsViewerAddressStored !== adsViewerAddress) setAdsViewerAddress(adsViewerAddress);
}, [adsViewerAddressStored, adsViewerAddress, setAdsViewerAddress]);
};
16 changes: 0 additions & 16 deletions src/app/hooks/use-user-id-sync.ts

This file was deleted.

Loading

0 comments on commit b430339

Please sign in to comment.