mirror of
https://github.com/documenso/documenso.git
synced 2025-11-20 03:32:14 +10:00
fix: wip
This commit is contained in:
@ -36,9 +36,14 @@ export const DocumentDuplicateDialog = ({
|
||||
|
||||
const team = useOptionalCurrentTeam();
|
||||
|
||||
const { data: document, isLoading } = trpcReact.document.getDocumentById.useQuery({
|
||||
const { data: document, isLoading } = trpcReact.document.getDocumentById.useQuery(
|
||||
{
|
||||
documentId: id,
|
||||
});
|
||||
},
|
||||
{
|
||||
enabled: open === true,
|
||||
},
|
||||
);
|
||||
|
||||
const documentData = document?.documentData
|
||||
? {
|
||||
|
||||
@ -6,6 +6,6 @@ import { stripeWebhookHandler } from '@documenso/ee/server-only/stripe/webhook/h
|
||||
// };
|
||||
import type { Route } from './+types/webhook.trigger';
|
||||
|
||||
export async function loader({ request }: Route.LoaderArgs) {
|
||||
export async function action({ request }: Route.ActionArgs) {
|
||||
return stripeWebhookHandler(request);
|
||||
}
|
||||
|
||||
@ -12,6 +12,6 @@ import type { Route } from './+types/webhook.trigger';
|
||||
// },
|
||||
// };
|
||||
|
||||
export async function loader({ request }: Route.LoaderArgs) {
|
||||
export async function action({ request }: Route.ActionArgs) {
|
||||
return handlerTriggerWebhooks(request);
|
||||
}
|
||||
|
||||
@ -72,6 +72,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.26.7",
|
||||
"@babel/preset-react": "^7.26.3",
|
||||
"@babel/preset-typescript": "^7.26.0",
|
||||
"@lingui/babel-plugin-lingui-macro": "^5.2.0",
|
||||
"@lingui/vite-plugin": "^5.2.0",
|
||||
|
||||
@ -25,6 +25,7 @@ const config = {
|
||||
noEmitOnError: true,
|
||||
moduleResolution: 'bundler',
|
||||
include: ['server/**/*', '../../packages/**/*', '../../packages/lib/translations/**/*'],
|
||||
jsx: 'preserve',
|
||||
}),
|
||||
resolve({
|
||||
rootDir: path.join(process.cwd(), '../..'),
|
||||
@ -41,8 +42,8 @@ const config = {
|
||||
commonjs(),
|
||||
babel({
|
||||
babelHelpers: 'bundled',
|
||||
extensions: ['.js', '.ts', '.tsx'],
|
||||
presets: ['@babel/preset-typescript'],
|
||||
extensions: ['.ts', '.tsx'],
|
||||
presets: ['@babel/preset-typescript', ['@babel/preset-react', { runtime: 'automatic' }]],
|
||||
plugins: [linguiMacro],
|
||||
}),
|
||||
],
|
||||
|
||||
@ -27,7 +27,7 @@ export const appContext = async (c: Context, next: Next) => {
|
||||
const noSessionCookie = extractSessionCookieFromHeaders(request.headers) === null;
|
||||
|
||||
if (!isPageRequest(request) || noSessionCookie || blacklistedPathsRegex.test(url.pathname)) {
|
||||
logger.log('Pathname ignored', url.pathname);
|
||||
// logger.log('Pathname ignored', url.pathname);
|
||||
|
||||
setAppContext(c, {
|
||||
requestMetadata: extractRequestMetadata(request),
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
"noEmit": true,
|
||||
"moduleDetection": "force",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": true,
|
||||
"useUnknownInCatchVariables": false
|
||||
|
||||
91
package-lock.json
generated
91
package-lock.json
generated
@ -154,6 +154,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.26.7",
|
||||
"@babel/preset-react": "^7.26.3",
|
||||
"@babel/preset-typescript": "^7.26.0",
|
||||
"@lingui/babel-plugin-lingui-macro": "^5.2.0",
|
||||
"@lingui/vite-plugin": "^5.2.0",
|
||||
@ -2391,6 +2392,75 @@
|
||||
"@babel/core": "^7.0.0-0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/plugin-transform-react-display-name": {
|
||||
"version": "7.25.9",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-display-name/-/plugin-transform-react-display-name-7.25.9.tgz",
|
||||
"integrity": "sha512-KJfMlYIUxQB1CJfO3e0+h0ZHWOTLCPP115Awhaz8U0Zpq36Gl/cXlpoyMRnUWlhNUBAzldnCiAZNvCDj7CrKxQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.25.9"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "^7.0.0-0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/plugin-transform-react-jsx": {
|
||||
"version": "7.25.9",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.25.9.tgz",
|
||||
"integrity": "sha512-s5XwpQYCqGerXl+Pu6VDL3x0j2d82eiV77UJ8a2mDHAW7j9SWRqQ2y1fNo1Z74CdcYipl5Z41zvjj4Nfzq36rw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-annotate-as-pure": "^7.25.9",
|
||||
"@babel/helper-module-imports": "^7.25.9",
|
||||
"@babel/helper-plugin-utils": "^7.25.9",
|
||||
"@babel/plugin-syntax-jsx": "^7.25.9",
|
||||
"@babel/types": "^7.25.9"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "^7.0.0-0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/plugin-transform-react-jsx-development": {
|
||||
"version": "7.25.9",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-development/-/plugin-transform-react-jsx-development-7.25.9.tgz",
|
||||
"integrity": "sha512-9mj6rm7XVYs4mdLIpbZnHOYdpW42uoiBCTVowg7sP1thUOiANgMb4UtpRivR0pp5iL+ocvUv7X4mZgFRpJEzGw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/plugin-transform-react-jsx": "^7.25.9"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "^7.0.0-0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/plugin-transform-react-pure-annotations": {
|
||||
"version": "7.25.9",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-pure-annotations/-/plugin-transform-react-pure-annotations-7.25.9.tgz",
|
||||
"integrity": "sha512-KQ/Takk3T8Qzj5TppkS1be588lkbTp5uj7w6a0LeQaTMSckU/wK0oJ/pih+T690tkgI5jfmg2TqDJvd41Sj1Cg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-annotate-as-pure": "^7.25.9",
|
||||
"@babel/helper-plugin-utils": "^7.25.9"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "^7.0.0-0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/plugin-transform-typescript": {
|
||||
"version": "7.26.7",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.26.7.tgz",
|
||||
@ -2411,6 +2481,27 @@
|
||||
"@babel/core": "^7.0.0-0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/preset-react": {
|
||||
"version": "7.26.3",
|
||||
"resolved": "https://registry.npmjs.org/@babel/preset-react/-/preset-react-7.26.3.tgz",
|
||||
"integrity": "sha512-Nl03d6T9ky516DGK2YMxrTqvnpUW63TnJMOMonj+Zae0JiPC5BC9xPMSL6L8fiSpA5vP88qfygavVQvnLp+6Cw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.25.9",
|
||||
"@babel/helper-validator-option": "^7.25.9",
|
||||
"@babel/plugin-transform-react-display-name": "^7.25.9",
|
||||
"@babel/plugin-transform-react-jsx": "^7.25.9",
|
||||
"@babel/plugin-transform-react-jsx-development": "^7.25.9",
|
||||
"@babel/plugin-transform-react-pure-annotations": "^7.25.9"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "^7.0.0-0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/preset-typescript": {
|
||||
"version": "7.26.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/preset-typescript/-/preset-typescript-7.26.0.tgz",
|
||||
|
||||
@ -21,12 +21,13 @@ export const apiSignin = async ({
|
||||
}: LoginOptions) => {
|
||||
const { request } = page.context();
|
||||
|
||||
// const csrfToken = await getCsrfToken(page);
|
||||
const csrfToken = await getCsrfToken(page);
|
||||
|
||||
await request.post(`${NEXT_PUBLIC_WEBAPP_URL()}/api/auth/email-password/authorize`, {
|
||||
data: {
|
||||
email,
|
||||
password,
|
||||
csrfToken,
|
||||
},
|
||||
});
|
||||
|
||||
@ -50,6 +51,7 @@ const getCsrfToken = async (page: Page) => {
|
||||
});
|
||||
|
||||
const { csrfToken } = await response.json();
|
||||
|
||||
if (!csrfToken) {
|
||||
throw new Error('Invalid session');
|
||||
}
|
||||
|
||||
@ -422,10 +422,13 @@ test('[TEAMS]: check document visibility based on team member role', async ({ pa
|
||||
},
|
||||
]);
|
||||
|
||||
const teamUrlRedirect = `/t/${team.url}/documents?status=COMPLETED`;
|
||||
|
||||
// Test cases for each role
|
||||
const testCases = [
|
||||
{
|
||||
user: adminUser,
|
||||
path: teamUrlRedirect,
|
||||
expectedDocuments: [
|
||||
'Document Visible to Everyone',
|
||||
'Document Visible to Manager and Above',
|
||||
@ -435,14 +438,17 @@ test('[TEAMS]: check document visibility based on team member role', async ({ pa
|
||||
},
|
||||
{
|
||||
user: managerUser,
|
||||
path: teamUrlRedirect,
|
||||
expectedDocuments: ['Document Visible to Everyone', 'Document Visible to Manager and Above'],
|
||||
},
|
||||
{
|
||||
user: memberUser,
|
||||
path: teamUrlRedirect,
|
||||
expectedDocuments: ['Document Visible to Everyone'],
|
||||
},
|
||||
{
|
||||
user: outsideUser,
|
||||
path: '/documents',
|
||||
expectedDocuments: ['Document Visible to Admin with Recipient'],
|
||||
},
|
||||
];
|
||||
@ -451,7 +457,7 @@ test('[TEAMS]: check document visibility based on team member role', async ({ pa
|
||||
await apiSignin({
|
||||
page,
|
||||
email: testCase.user.email,
|
||||
redirectPath: `/t/${team.url}/documents?status=COMPLETED`,
|
||||
redirectPath: testCase.path,
|
||||
});
|
||||
|
||||
// Check that the user sees the expected documents
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
"scripts": {
|
||||
"test:dev": "NODE_OPTIONS=--experimental-require-module playwright test",
|
||||
"test-ui:dev": "NODE_OPTIONS=--experimental-require-module playwright test --ui",
|
||||
"test:e2e": "NODE_OPTIONS=--experimental-require-module start-server-and-test \"npm run start -w @documenso/web\" http://localhost:3000 \"playwright test $E2E_TEST_PATH\""
|
||||
"test:e2e": "NODE_OPTIONS=--experimental-require-module start-server-and-test \"npm run start -w @documenso/remix\" http://localhost:3000 \"playwright test $E2E_TEST_PATH\""
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
|
||||
@ -53,8 +53,12 @@ export class AuthClient {
|
||||
}
|
||||
|
||||
public emailPassword = {
|
||||
signIn: async (data: Omit<TEmailPasswordSignin, 'csrfToken'>) => {
|
||||
const { csrfToken } = await this.client.csrf.$get().then(async (res) => res.json());
|
||||
signIn: async (data: Omit<TEmailPasswordSignin, 'csrfToken'> & { csrfToken?: string }) => {
|
||||
let csrfToken = data.csrfToken;
|
||||
|
||||
if (!csrfToken) {
|
||||
csrfToken = (await this.client.csrf.$get().then(async (res) => res.json())).csrfToken;
|
||||
}
|
||||
|
||||
const response = await this.client['email-password'].authorize.$post({
|
||||
json: {
|
||||
|
||||
Reference in New Issue
Block a user