Skip to content

Commit

Permalink
Merge branch 'main' into bug-iframe-navigate-notMonetized
Browse files Browse the repository at this point in the history
  • Loading branch information
sidvishnoi authored Jan 15, 2025
2 parents 65d901e + c87be2d commit f768e3a
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 23 deletions.
1 change: 0 additions & 1 deletion biome.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"rules": {
"recommended": true,
"style": {
"noUnusedTemplateLiteral": "off", // TODO: turn on, too many cases
"noUselessElse": "off", // TODO: turn on, too many cases
"noNonNullAssertion": "off" // TODO: turn on, too many cases
},
Expand Down
4 changes: 2 additions & 2 deletions esbuild/prod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ function preservePolyfillClassNamesPlugin({
const minifiedName = match[1];

const result = polyfillContent
.replace(definitionRegex, `class MonetizationEvent extends Event`)
.replace(definitionRegex, 'class MonetizationEvent extends Event')
.replace(
`window.MonetizationEvent=${minifiedName}`,
`window.MonetizationEvent=MonetizationEvent`,
'window.MonetizationEvent=MonetizationEvent',
)
.replaceAll(`new ${minifiedName}`, 'new MonetizationEvent');

Expand Down
6 changes: 3 additions & 3 deletions src/background/services/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ export class Background {
// Firefox <128 will throw saying world: MAIN isn't supported. So, we'll
// inject via contentScript later. Injection via contentScript is slow,
// but apart from WM detection on page-load, everything else works fine.
if (!error.message.includes(`world`)) {
if (!error.message.includes('world')) {
this.logger.error(
`Content script execution world \`MAIN\` not supported by your browser.\n` +
`Check https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/scripting/ExecutionWorld#browser_compatibility for browser compatibility.`,
'Content script execution world `MAIN` not supported by your browser.\n' +
'Check https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/scripting/ExecutionWorld#browser_compatibility for browser compatibility.',
error,
);
}
Expand Down
6 changes: 3 additions & 3 deletions src/background/services/monetization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ export class MonetizationService {

private onKeyRevoked() {
this.events.once('open_payments.key_revoked', async () => {
this.logger.warn(`Key revoked. Stopping all payment sessions.`);
this.logger.warn('Key revoked. Stopping all payment sessions.');
this.stopAllSessions();
await this.storage.setState({ key_revoked: true });
this.onKeyRevoked(); // setup listener again once all is done
Expand All @@ -482,7 +482,7 @@ export class MonetizationService {

private onOutOfFunds() {
this.events.once('open_payments.out_of_funds', async () => {
this.logger.warn(`Out of funds. Stopping all payment sessions.`);
this.logger.warn('Out of funds. Stopping all payment sessions.');
this.stopAllSessions();
await this.storage.setState({ out_of_funds: true });
this.onOutOfFunds(); // setup listener again once all is done
Expand All @@ -502,7 +502,7 @@ export class MonetizationService {
for (const session of this.tabState.getAllSessions()) {
session.stop();
}
this.logger.debug(`All payment sessions stopped.`);
this.logger.debug('All payment sessions stopped.');
}

async getPopupData(tab: Pick<Tabs.Tab, 'id' | 'url'>): Promise<PopupStore> {
Expand Down
2 changes: 1 addition & 1 deletion src/content/keyAutoAdd/chimoney.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const findWallet: Run<{ walletAddressId: string }> = async (
match(el) {
const prefix = walletAddress.hostname;
const text = el.textContent?.trim() ?? '';
return text.startsWith(`Wallet Address:`) && text.includes(prefix);
return text.startsWith('Wallet Address:') && text.includes(prefix);
},
}).catch(() => {
throw new Error(
Expand Down
2 changes: 1 addition & 1 deletion src/content/keyAutoAdd/lib/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export async function waitForURL(
const abortSignal = AbortSignal.timeout(timeout);
abortSignal.addEventListener('abort', (e) => {
observer.disconnect();
reject(new TimeoutError(`Timeout waiting for URL`, { cause: e }));
reject(new TimeoutError('Timeout waiting for URL', { cause: e }));
});

let url = window.location.href;
Expand Down
3 changes: 2 additions & 1 deletion src/content/polyfill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ import type { MonetizationEventPayload } from '@/shared/messages';

get detail() {
if (!eventDetailDeprecationEmitted) {
const msg = `MonetizationEvent.detail is deprecated. Access attributes directly instead.`;
const msg =
'MonetizationEvent.detail is deprecated. Access attributes directly instead.';
// biome-ignore lint/suspicious/noConsole: warning meant for website devs
console.warn(msg);
eventDetailDeprecationEmitted = true;
Expand Down
4 changes: 1 addition & 3 deletions src/pages/shared/components/ui/RadioGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ export const Radio = ({
/>

<label htmlFor={inputId} className="group flex items-center">
<span
className={`inline-block h-6 w-6 rounded-full border-2 border-base peer-checked:group-[]:border-blue-500 peer-checked:group-[]:bg-primary peer-checked:group-[]:ring-4 peer-checked:group-[]:ring-inset peer-checked:group-[]:ring-white`}
/>
<span className="inline-block h-6 w-6 rounded-full border-2 border-base peer-checked:group-[]:border-blue-500 peer-checked:group-[]:bg-primary peer-checked:group-[]:ring-4 peer-checked:group-[]:ring-inset peer-checked:group-[]:ring-white" />
{label ? (
<p className="ms-2 text-base leading-6 text-medium">{label}</p>
) : (
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/connectAutoKeyChimoney.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ test('Connect to Chimoney wallet with automatic key addition when not logged-in
timeout: 5000,
});
expect(page.url()).toContain(URLS.login);
expect(page.url()).toContain(`?next=`);
expect(page.url()).toContain('?next=');
await page.close();
});

Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/fixtures/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export async function loadContext(
context = await chromium.launchPersistentContext('', {
channel,
args: [
`--headless=new`,
'--headless=new',
`--disable-extensions-except=${pathToExtension}`,
`--load-extension=${pathToExtension}`,
],
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/helpers/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { BrowserContext, Page } from '@playwright/test';
import type { ConnectDetails } from '../pages/popup';
import { getWalletInformation } from '@/shared/helpers';

const OPEN_PAYMENTS_REDIRECT_URL = `https://webmonetization.org/welcome`;
const OPEN_PAYMENTS_REDIRECT_URL = 'https://webmonetization.org/welcome';

export async function waitForWelcomePage(page: Page) {
await page.waitForURL(
Expand Down
5 changes: 3 additions & 2 deletions tests/e2e/helpers/fynbos.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import type { Page } from '@playwright/test';
import { waitForWelcomePage } from './common';

export const KEYS_PAGE_URL = `https://eu1.fynbos.dev/settings/keys`;
export const LOGIN_PAGE_URL = `https://eu1.fynbos.dev/login?returnTo=%2Fsettings%2Fkeys`;
export const KEYS_PAGE_URL = 'https://eu1.fynbos.dev/settings/keys';
export const LOGIN_PAGE_URL =
'https://eu1.fynbos.dev/login?returnTo=%2Fsettings%2Fkeys';

export async function completeGrant(page: Page, continueWaitMs: number) {
await waitForGrantConsentPage(page);
Expand Down
8 changes: 5 additions & 3 deletions tests/e2e/helpers/testWallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ import {
import { fillPopup, type Popup, type ConnectDetails } from '../pages/popup';
import { getContinueWaitTime, waitForWelcomePage } from './common';

export const KEYS_PAGE_URL = `https://wallet.interledger-test.dev/settings/developer-keys`;
export const LOGIN_PAGE_URL = `https://wallet.interledger-test.dev/auth/login?callbackUrl=%2Fsettings%2Fdeveloper-keys`;
export const API_URL_ORIGIN = `https://api.wallet.interledger-test.dev`;
export const KEYS_PAGE_URL =
'https://wallet.interledger-test.dev/settings/developer-keys';
export const LOGIN_PAGE_URL =
'https://wallet.interledger-test.dev/auth/login?callbackUrl=%2Fsettings%2Fdeveloper-keys';
export const API_URL_ORIGIN = 'https://api.wallet.interledger-test.dev';
export const DEFAULT_CONTINUE_WAIT_MS = 1000;

export async function connectWallet(
Expand Down

0 comments on commit f768e3a

Please sign in to comment.