Skip to content

Commit

Permalink
fix: support billing
Browse files Browse the repository at this point in the history
  • Loading branch information
qinluhe committed Dec 26, 2024
1 parent 90fda98 commit 9d4f40f
Show file tree
Hide file tree
Showing 94 changed files with 2,012 additions and 811 deletions.
4 changes: 2 additions & 2 deletions frontend/appflowy_web_app/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default defineConfig({
framework: 'react',
bundler: 'vite',
},
setupNodeEvents (on, config) {
setupNodeEvents(on, config) {
registerCodeCoverageTasks(on, config);
addMatchImageSnapshotPlugin(on, config);
return config;
Expand All @@ -26,7 +26,7 @@ export default defineConfig({
retries: {
// Configure retry attempts for `cypress run`
// Default is 0
runMode: 16,
runMode: 10,
// Configure retry attempts for `cypress open`
// Default is 0
openMode: 0,
Expand Down
2 changes: 1 addition & 1 deletion frontend/appflowy_web_app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"coverage": "pnpm run test:unit && pnpm run test:components"
},
"dependencies": {
"@appflowyinc/editor": "^0.0.30",
"@appflowyinc/editor": "^0.0.39",
"@atlaskit/primitives": "^5.5.3",
"@emoji-mart/data": "^1.1.2",
"@emoji-mart/react": "^1.1.1",
Expand Down
76 changes: 10 additions & 66 deletions frontend/appflowy_web_app/pnpm-lock.yaml

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

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import axios, { AxiosInstance } from 'axios';

let axiosInstance: AxiosInstance | null = null;

export function initGrantService (baseURL: string) {
export function initGrantService(baseURL: string) {
if (axiosInstance) {
return;
}
Expand All @@ -21,7 +21,7 @@ export function initGrantService (baseURL: string) {
});
}

export async function refreshToken (refresh_token: string) {
export async function refreshToken(refresh_token: string) {
const response = await axiosInstance?.post<{
access_token: string;
expires_at: number;
Expand All @@ -34,12 +34,14 @@ export async function refreshToken (refresh_token: string) {

if (newToken) {
refreshSessionToken(JSON.stringify(newToken));
} else {
return Promise.reject('Failed to refresh token');

Check warning on line 38 in frontend/appflowy_web_app/src/application/services/js-services/http/gotrue.ts

View check run for this annotation

Codecov / codecov/patch

frontend/appflowy_web_app/src/application/services/js-services/http/gotrue.ts#L38

Added line #L38 was not covered by tests
}

return newToken;
}

export async function signInWithMagicLink (email: string, authUrl: string) {
export async function signInWithMagicLink(email: string, authUrl: string) {
const res = await axiosInstance?.post(
'/magiclink',
{
Expand All @@ -58,13 +60,13 @@ export async function signInWithMagicLink (email: string, authUrl: string) {
return res?.data;
}

export async function settings () {
export async function settings() {
const res = await axiosInstance?.get('/settings');

return res?.data;
}

export function signInGoogle (authUrl: string) {
export function signInGoogle(authUrl: string) {

Check warning on line 69 in frontend/appflowy_web_app/src/application/services/js-services/http/gotrue.ts

View check run for this annotation

Codecov / codecov/patch

frontend/appflowy_web_app/src/application/services/js-services/http/gotrue.ts#L69

Added line #L69 was not covered by tests
const provider = 'google';
const redirectTo = encodeURIComponent(authUrl);
const accessType = 'offline';
Expand All @@ -75,7 +77,7 @@ export function signInGoogle (authUrl: string) {
window.open(url, '_current');
}

export function signInApple (authUrl: string) {
export function signInApple(authUrl: string) {

Check warning on line 80 in frontend/appflowy_web_app/src/application/services/js-services/http/gotrue.ts

View check run for this annotation

Codecov / codecov/patch

frontend/appflowy_web_app/src/application/services/js-services/http/gotrue.ts#L80

Added line #L80 was not covered by tests
const provider = 'apple';
const redirectTo = encodeURIComponent(authUrl);
const baseURL = axiosInstance?.defaults.baseURL;
Expand All @@ -84,7 +86,7 @@ export function signInApple (authUrl: string) {
window.open(url, '_current');
}

export function signInGithub (authUrl: string) {
export function signInGithub(authUrl: string) {

Check warning on line 89 in frontend/appflowy_web_app/src/application/services/js-services/http/gotrue.ts

View check run for this annotation

Codecov / codecov/patch

frontend/appflowy_web_app/src/application/services/js-services/http/gotrue.ts#L89

Added line #L89 was not covered by tests
const provider = 'github';
const redirectTo = encodeURIComponent(authUrl);
const baseURL = axiosInstance?.defaults.baseURL;
Expand All @@ -93,7 +95,7 @@ export function signInGithub (authUrl: string) {
window.open(url, '_current');
}

export function signInDiscord (authUrl: string) {
export function signInDiscord(authUrl: string) {

Check warning on line 98 in frontend/appflowy_web_app/src/application/services/js-services/http/gotrue.ts

View check run for this annotation

Codecov / codecov/patch

frontend/appflowy_web_app/src/application/services/js-services/http/gotrue.ts#L98

Added line #L98 was not covered by tests
const provider = 'discord';
const redirectTo = encodeURIComponent(authUrl);
const baseURL = axiosInstance?.defaults.baseURL;
Expand Down
Loading

0 comments on commit 9d4f40f

Please sign in to comment.