Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"react-dom": "19.0.0",
"resend": "^6.0.1",
"semver": "^7.6.3",
"sharp": "^0.32.6",
"sharp": "^0.34.4",
"stripe": "^18.3.0",
"svix": "^1.25.0",
"vite": "^6.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export const POST = createSmartRouteHandler({
product: inlineProductSchema,
stripe_account_id: yupString().defined(),
project_id: yupString().defined(),
project_logo_url: yupString().nullable().defined(),
already_bought_non_stackable: yupBoolean().defined(),
conflicting_products: yupArray(yupObject({
product_id: yupString().defined(),
Expand Down Expand Up @@ -96,6 +97,7 @@ export const POST = createSmartRouteHandler({
product: productToInlineProduct(product),
stripe_account_id: verificationCode.data.stripeAccountId,
project_id: tenancy.project.id,
project_logo_url: tenancy.project.logo_url ?? null,
already_bought_non_stackable: alreadyBoughtNonStackable,
conflicting_products: conflictingCatalogProducts,
test_mode: tenancy.config.payments.testMode === true,
Expand Down
368 changes: 238 additions & 130 deletions apps/dashboard/src/app/(main)/purchase/[code]/page-client.tsx

Large diffs are not rendered by default.

50 changes: 50 additions & 0 deletions apps/e2e/tests/backend/endpoints/api/v1/internal/projects.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -647,3 +647,53 @@ it("gives an error when updating email_theme with an invalid value", async ({ ex
}
`);
});

it("lets user update logo_url to a valid image", async ({ expect }) => {
await Project.createAndSwitch();
// 1x1 png
const logo_url = `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAD0lEQVR4AQEEAPv/ALHBwQRaAjRgT7lCAAAAAElFTkSuQmCC`;
const response = await niceBackendFetch("/api/v1/internal/projects/current", {
method: "PATCH",
accessType: "admin",
body: {
logo_url,
}
});
expect(response).toMatchInlineSnapshot(`
NiceResponse {
"status": 200,
"body": {
"config": {
"allow_localhost": true,
"allow_team_api_keys": false,
"allow_user_api_keys": false,
"client_team_creation_enabled": false,
"client_user_deletion_enabled": false,
"create_team_on_sign_up": false,
"credential_enabled": true,
"domains": [],
"email_config": { "type": "shared" },
"email_theme": "<stripped UUID>",
"enabled_oauth_providers": [],
"magic_link_enabled": false,
"oauth_account_merge_strategy": "link_method",
"oauth_providers": [],
"passkey_enabled": false,
"sign_up_enabled": true,
"team_creator_default_permissions": [{ "id": "team_admin" }],
"team_member_default_permissions": [{ "id": "team_member" }],
"user_default_permissions": [],
},
"created_at_millis": <stripped field 'created_at_millis'>,
"description": "",
"display_name": "New Project",
"full_logo_url": null,
"id": "<stripped UUID>",
"is_production_mode": false,
"logo_url": "http://localhost:<$NEXT_PUBLIC_STACK_PORT_PREFIX>21/stack-storage/project-logos/<stripped UUID>.png",
"owner_team_id": "<stripped UUID>",
},
"headers": Headers { <some fields may have been hidden> },
}
`);
});
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ it("should allow valid code and return offer data", async ({ expect }) => {
"stackable": false,
},
"project_id": "<stripped UUID>",
"project_logo_url": null,
"stripe_account_id": <stripped field 'stripe_account_id'>,
"test_mode": false,
},
Expand Down Expand Up @@ -243,6 +244,7 @@ it("should include conflicting_group_offers when switching within the same group
"stackable": false,
},
"project_id": "<stripped UUID>",
"project_logo_url": null,
"stripe_account_id": <stripped field 'stripe_account_id'>,
"test_mode": true,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ it("should return inline product metadata when validating purchase code", async
"stackable": false,
},
"project_id": "<stripped UUID>",
"project_logo_url": null,
"stripe_account_id": <stripped field 'stripe_account_id'>,
"test_mode": true,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ it("should allow valid code and return product data", async ({ expect }) => {
"stackable": false,
},
"project_id": "<stripped UUID>",
"project_logo_url": null,
"stripe_account_id": <stripped field 'stripe_account_id'>,
"test_mode": false,
},
Expand Down Expand Up @@ -243,6 +244,7 @@ it("should include conflicting_products when switching within the same group", a
"stackable": false,
},
"project_id": "<stripped UUID>",
"project_logo_url": null,
"stripe_account_id": <stripped field 'stripe_account_id'>,
"test_mode": true,
},
Expand Down Expand Up @@ -338,6 +340,7 @@ it("should reject untrusted return_url and accept trusted return_url", async ({
"stackable": false,
},
"project_id": "<stripped UUID>",
"project_logo_url": null,
"stripe_account_id": <stripped field 'stripe_account_id'>,
"test_mode": true,
},
Expand Down
4 changes: 2 additions & 2 deletions pnpm-lock.yaml

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

Loading