mirror of
https://github.com/twentyhq/twenty.git
synced 2024-12-24 04:23:57 +03:00
Set optional checkout.session.url (#4569)
* Set optional checkout.session.url * Lint * Edit .env.example * Vale CI --------- Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
This commit is contained in:
parent
c90e379fc4
commit
35d41e38c8
@ -27,4 +27,4 @@ const getDefaultUrl = () => {
|
||||
export const REACT_APP_SERVER_BASE_URL =
|
||||
window._env_?.REACT_APP_SERVER_BASE_URL ||
|
||||
process.env.REACT_APP_SERVER_BASE_URL ||
|
||||
getDefaultUrl();
|
||||
getDefaultUrl();
|
||||
|
@ -552,7 +552,7 @@ export type Sentry = {
|
||||
|
||||
export type SessionEntity = {
|
||||
__typename?: 'SessionEntity';
|
||||
url: Scalars['String'];
|
||||
url?: Maybe<Scalars['String']>;
|
||||
};
|
||||
|
||||
/** Sort Directions */
|
||||
@ -1015,7 +1015,7 @@ export type BillingPortalSessionQueryVariables = Exact<{
|
||||
}>;
|
||||
|
||||
|
||||
export type BillingPortalSessionQuery = { __typename?: 'Query', billingPortalSession: { __typename?: 'SessionEntity', url: string } };
|
||||
export type BillingPortalSessionQuery = { __typename?: 'Query', billingPortalSession: { __typename?: 'SessionEntity', url?: string | null } };
|
||||
|
||||
export type CheckoutSessionMutationVariables = Exact<{
|
||||
recurringInterval: Scalars['String'];
|
||||
@ -1023,7 +1023,7 @@ export type CheckoutSessionMutationVariables = Exact<{
|
||||
}>;
|
||||
|
||||
|
||||
export type CheckoutSessionMutation = { __typename?: 'Mutation', checkoutSession: { __typename?: 'SessionEntity', url: string } };
|
||||
export type CheckoutSessionMutation = { __typename?: 'Mutation', checkoutSession: { __typename?: 'SessionEntity', url?: string | null } };
|
||||
|
||||
export type GetProductPricesQueryVariables = Exact<{
|
||||
product: Scalars['String'];
|
||||
|
@ -35,6 +35,9 @@ export const SettingsBilling = () => {
|
||||
},
|
||||
});
|
||||
|
||||
const billingPortalButtonDisabled =
|
||||
loading || !isDefined(data) || !isDefined(data.billingPortalSession.url);
|
||||
|
||||
const displayPaymentFailInfo =
|
||||
onboardingStatus === OnboardingStatus.PastDue ||
|
||||
onboardingStatus === OnboardingStatus.Unpaid;
|
||||
@ -46,7 +49,7 @@ export const SettingsBilling = () => {
|
||||
onboardingStatus === OnboardingStatus.CompletedWithoutSubscription;
|
||||
|
||||
const openBillingPortal = () => {
|
||||
if (isDefined(data)) {
|
||||
if (isDefined(data) && isDefined(data.billingPortalSession.url)) {
|
||||
window.location.replace(data.billingPortalSession.url);
|
||||
}
|
||||
};
|
||||
@ -95,7 +98,7 @@ export const SettingsBilling = () => {
|
||||
title="View billing details"
|
||||
variant="secondary"
|
||||
onClick={openBillingPortal}
|
||||
disabled={loading}
|
||||
disabled={billingPortalButtonDisabled}
|
||||
/>
|
||||
</Section>
|
||||
)}
|
||||
|
@ -8,6 +8,7 @@ FRONT_BASE_URL=http://localhost:3001
|
||||
ACCESS_TOKEN_SECRET=replace_me_with_a_random_string_access
|
||||
LOGIN_TOKEN_SECRET=replace_me_with_a_random_string_login
|
||||
REFRESH_TOKEN_SECRET=replace_me_with_a_random_string_refresh
|
||||
FILE_TOKEN_SECRET=replace_me_with_a_random_string_refresh
|
||||
SIGN_IN_PREFILLED=true
|
||||
|
||||
# ———————— Optional ————————
|
||||
|
@ -131,10 +131,13 @@ export class BillingService {
|
||||
workspaceId: string,
|
||||
returnUrlPath?: string,
|
||||
) {
|
||||
const billingSubscription =
|
||||
await this.billingSubscriptionRepository.findOneOrFail({
|
||||
where: { workspaceId },
|
||||
});
|
||||
const billingSubscription = await this.getCurrentBillingSubscription({
|
||||
workspaceId,
|
||||
});
|
||||
|
||||
if (!billingSubscription) {
|
||||
return;
|
||||
}
|
||||
|
||||
const frontBaseUrl = this.environmentService.get('FRONT_BASE_URL');
|
||||
const returnUrl = returnUrlPath
|
||||
@ -190,10 +193,9 @@ export class BillingService {
|
||||
}
|
||||
|
||||
async deleteSubscription(workspaceId: string) {
|
||||
const subscriptionToCancel =
|
||||
await this.billingSubscriptionRepository.findOneBy({
|
||||
workspaceId,
|
||||
});
|
||||
const subscriptionToCancel = await this.getCurrentBillingSubscription({
|
||||
workspaceId,
|
||||
});
|
||||
|
||||
if (subscriptionToCancel) {
|
||||
await this.stripeService.cancelSubscription(
|
||||
|
@ -2,6 +2,6 @@ import { Field, ObjectType } from '@nestjs/graphql';
|
||||
|
||||
@ObjectType()
|
||||
export class SessionEntity {
|
||||
@Field(() => String)
|
||||
@Field(() => String, { nullable: true })
|
||||
url: string;
|
||||
}
|
||||
|
@ -5,6 +5,6 @@ Date: Feb 3rd 2024
|
||||
|
||||
# Rating field
|
||||
|
||||
The new Rating field represents a numeric value from 0 to 5, it can be useful for various use-cases such as scoring leads.
|
||||
The new Rating field represents a numeric value from zero to five, it can be useful for various use-cases such as scoring leads.
|
||||
|
||||
![rating](/images/releases/0.3.0_rating.png)
|
Loading…
Reference in New Issue
Block a user