[CLD-7567] Deprecate Self Serve: Second Pass (#26853)

* Deprecate Self Serve: First Pass

* Fix ci

* Fix more ci

* Remmove outdated server tests

* Fix a missed spot opening purchase modal in Self Hosted

* Fix i18n

* Clean up some more server code, fix webapp test

* Fix alignment of button

* Fix linter

* Fix i18n server side

* Deprecate in product true up

* Add back translation

* Remove client functions

* Put back client functions

* webapp deprecation

* Deprecate Self Serve: Second Pass

* Fix various pipeline issues

* Fix linter

* Fix pipelines

* Fix handlers_test.go

* Fix console.error around hostedCustomer in reducer

* PICKY LINTER PLEASE

* Fix webapp tests, various other fixes for the CI pipelines

* Fix i18n

* Updates to accomadate enterprise code removal

* Fix mocks

* More removal

* Fix

* Adjustments from PR

* Fixes for QA Feedback

* Update

* Add migrations to remove true up review history

* Fix migrations check

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Co-authored-by: maria.nunez <maria.nunez@mattermost.com>
Этот коммит содержится в:
Nick Misasi
2024-05-02 09:15:15 -04:00
коммит произвёл GitHub
родитель 6028cbe4e2
Коммит f1019d076e
127 изменённых файлов: 169 добавлений и 8222 удалений

Просмотреть файл

@@ -37,10 +37,6 @@ import type {
NotifyAdminRequest,
Subscription,
ValidBusinessEmail,
LicenseSelfServeStatus,
CreateSubscriptionRequest,
Feedback,
WorkspaceDeletionRequest,
NewsletterRequestBody,
Installation,
} from '@mattermost/types/cloud';
@@ -83,13 +79,6 @@ import type {
GetGroupsForUserParams,
GroupStats,
} from '@mattermost/types/groups';
import type {
SelfHostedSignupForm,
SelfHostedSignupCustomerResponse,
SelfHostedSignupSuccessResponse,
SelfHostedSignupBootstrapResponse,
SelfHostedExpansionRequest,
} from '@mattermost/types/hosted_customer';
import type {PostActionResponse} from '@mattermost/types/integration_actions';
import type {
Command,
@@ -3905,53 +3894,12 @@ export default class Client4 {
);
};
bootstrapSelfHostedSignup = (reset?: boolean) => {
let query = '';
// reset will drop the old token
if (reset) {
query = '?reset=true';
}
return this.doFetch<SelfHostedSignupBootstrapResponse>(
`${this.getHostedCustomerRoute()}/bootstrap${query}`,
{method: 'post'},
);
};
getAvailabilitySelfHostedSignup = () => {
return this.doFetch<void>(
`${this.getHostedCustomerRoute()}/signup_available`,
{method: 'get'},
);
};
getSelfHostedProducts = () => {
return this.doFetch<Product[]>(
`${this.getCloudRoute()}/products/selfhosted`, {method: 'get'},
);
};
createCustomerSelfHostedSignup = (form: SelfHostedSignupForm) => {
return this.doFetch<SelfHostedSignupCustomerResponse>(
`${this.getHostedCustomerRoute()}/customer`,
{method: 'post', body: JSON.stringify(form)},
);
};
confirmSelfHostedSignup = (setupIntentId: string, createSubscriptionRequest: CreateSubscriptionRequest) => {
return this.doFetch<SelfHostedSignupSuccessResponse>(
`${this.getHostedCustomerRoute()}/confirm`,
{method: 'post', body: JSON.stringify({stripe_setup_intent_id: setupIntentId, subscription: createSubscriptionRequest})},
);
};
confirmSelfHostedExpansion = (setupIntentId: string, expandRequest: SelfHostedExpansionRequest) => {
return this.doFetch<SelfHostedSignupSuccessResponse>(
`${this.getHostedCustomerRoute()}/confirm-expand`,
{method: 'post', body: JSON.stringify({stripe_setup_intent_id: setupIntentId, expand_request: expandRequest})},
);
};
subscribeToNewsletter = (newletterRequestBody: NewsletterRequestBody) => {
return this.doFetch<StatusOK>(
`${this.getHostedCustomerRoute()}/subscribe-newsletter`,
@@ -3959,10 +3907,10 @@ export default class Client4 {
);
};
createPaymentMethod = async () => {
return this.doFetch(
`${this.getCloudRoute()}/payment`,
{method: 'post'},
cwsAvailabilityCheck = () => {
return this.doFetchWithResponse(
`${this.getCloudRoute()}/check-cws-connection`,
{method: 'get'},
);
};
@@ -3972,12 +3920,6 @@ export default class Client4 {
);
};
getLicenseSelfServeStatus = () => {
return this.doFetch<LicenseSelfServeStatus>(
`${this.getCloudRoute()}/subscription/self-serve-status`, {method: 'get'},
);
};
updateCloudCustomer = (customerPatch: CloudCustomerPatch) => {
return this.doFetch<CloudCustomer>(
`${this.getCloudRoute()}/customer`,
@@ -3999,39 +3941,6 @@ export default class Client4 {
);
};
confirmPaymentMethod = async (stripeSetupIntentID: string) => {
return this.doFetch(
`${this.getCloudRoute()}/payment/confirm`,
{method: 'post', body: JSON.stringify({stripe_setup_intent_id: stripeSetupIntentID})},
);
};
subscribeCloudProduct = (productId: string, shippingAddress?: Address, seats = 0, downgradeFeedback?: Feedback, customerPatch?: CloudCustomerPatch) => {
const body = {
product_id: productId,
seats,
downgrade_feedback: downgradeFeedback,
} as any;
if (shippingAddress) {
body.shipping_address = shippingAddress;
}
if (customerPatch) {
body.customer = customerPatch;
}
return this.doFetch<Subscription>(
`${this.getCloudRoute()}/subscription`,
{method: 'put', body: JSON.stringify(body)},
);
};
requestCloudTrial = (subscriptionId: string, email = '') => {
return this.doFetchWithResponse<Subscription>(
`${this.getCloudRoute()}/request-trial`,
{method: 'put', body: JSON.stringify({email, subscription_id: subscriptionId})},
);
};
validateBusinessEmail = (email = '') => {
return this.doFetchWithResponse<ValidBusinessEmail>(
`${this.getCloudRoute()}/validate-business-email`,
@@ -4060,13 +3969,6 @@ export default class Client4 {
);
};
getRenewalLink = () => {
return this.doFetch<{renewal_link: string}>(
`${this.getBaseRoute()}/license/renewal`,
{method: 'get'},
);
};
getInvoices = () => {
return this.doFetch<Invoice[]>(
`${this.getCloudRoute()}/subscription/invoices`,
@@ -4078,17 +3980,6 @@ export default class Client4 {
return `${this.getCloudRoute()}/subscription/invoices/${invoiceId}/pdf`;
};
getSelfHostedInvoices = () => {
return this.doFetch<Invoice[]>(
`${this.getHostedCustomerRoute()}/invoices`,
{method: 'get'},
);
};
getSelfHostedInvoicePdfUrl = (invoiceId: string) => {
return `${this.getHostedCustomerRoute()}/invoices/${invoiceId}/pdf`;
};
getCloudLimits = () => {
return this.doFetch<Limits>(
`${this.getCloudRoute()}/limits`,
@@ -4329,34 +4220,6 @@ export default class Client4 {
);
};
submitTrueUpReview = () => {
return this.doFetch(
`${this.getBaseRoute()}/license/review`,
{method: 'post'},
);
};
getTrueUpReviewStatus = () => {
return this.doFetch(
`${this.getBaseRoute()}/license/review/status`,
{method: 'get'},
);
};
cwsAvailabilityCheck = () => {
return this.doFetchWithResponse(
`${this.getCloudRoute()}/check-cws-connection`,
{method: 'get'},
);
};
deleteWorkspace = (deletionRequest: WorkspaceDeletionRequest) => {
return this.doFetch<StatusOK>(
`${this.getCloudRoute()}/delete-workspace`,
{method: 'delete', body: JSON.stringify(deletionRequest)},
);
};
getGroupMessageMembersCommonTeams = (channelId: string) => {
return this.doFetchWithResponse<Team[]>(
`${this.getChannelRoute(channelId)}/common_teams`,

Просмотреть файл

@@ -2,14 +2,12 @@
// See LICENSE.txt for license information.
import type {AllowedIPRange} from './config';
import type {ValueOf} from './utilities';
export type CloudState = {
subscription?: Subscription;
products?: Record<string, Product>;
customer?: CloudCustomer;
invoices?: Record<string, Invoice>;
subscriptionStats?: LicenseSelfServeStatusReducer;
limits: {
limitsLoaded: boolean;
limits: Limits;
@@ -22,9 +20,6 @@ export type CloudState = {
limits?: true;
trueUpReview?: true;
};
selfHostedSignup: {
progress: ValueOf<typeof SelfHostedSignupProgress>;
};
}
export type Installation = {
@@ -74,27 +69,6 @@ export type AddOn = {
price_per_seat: number;
};
export const TypePurchases = {
firstSelfHostLicensePurchase: 'first_purchase',
renewalSelfHost: 'renewal_self',
monthlySubscription: 'monthly_subscription',
annualSubscription: 'annual_subscription',
} as const;
export const SelfHostedSignupProgress = {
START: 'START',
CREATED_CUSTOMER: 'CREATED_CUSTOMER',
CREATED_INTENT: 'CREATED_INTENT',
CONFIRMED_INTENT: 'CONFIRMED_INTENT',
CREATED_SUBSCRIPTION: 'CREATED_SUBSCRIPTION',
PAID: 'PAID',
CREATED_LICENSE: 'CREATED_LICENSE',
} as const;
export type MetadataGatherWireTransferKeys = `${ValueOf<typeof TypePurchases>}_alt_payment_method`
export type CustomerMetadataGatherWireTransfer = Partial<Record<MetadataGatherWireTransferKeys, string>>
// Customer model represents a customer on the system.
export type CloudCustomer = {
id: string;
@@ -108,16 +82,6 @@ export type CloudCustomer = {
billing_address: Address;
company_address: Address;
payment_method: PaymentMethod;
} & CustomerMetadataGatherWireTransfer
export type LicenseSelfServeStatus = {
is_expandable?: boolean;
is_renewable?: boolean;
}
type RequestState = 'IDLE' | 'LOADING' | 'ERROR' | 'OK'
export interface LicenseSelfServeStatusReducer extends LicenseSelfServeStatus {
getRequestState: RequestState;
}
// CustomerPatch model represents a customer patch on the system.
@@ -127,7 +91,7 @@ export type CloudCustomerPatch = {
num_employees?: number;
contact_first_name?: string;
contact_last_name?: string;
} & CustomerMetadataGatherWireTransfer
}
// Address model represents a customer's address.
export type Address = {
@@ -226,13 +190,6 @@ export type ValidBusinessEmail = {
is_valid: boolean;
}
export interface CreateSubscriptionRequest {
product_id: string;
add_ons: string[];
seats: number;
internal_purchase_order?: string;
}
export interface NewsletterRequestBody {
email: string;
subscribed_content: string;
@@ -248,8 +205,3 @@ export type Feedback = {
reason: string;
comments: string;
}
export type WorkspaceDeletionRequest = {
subscription_id: string;
delete_feedback: Feedback;
}

Просмотреть файл

@@ -1,82 +1,11 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import type {Address, Product, Invoice} from './cloud';
import type {ValueOf} from './utilities';
export const SelfHostedSignupProgress = {
START: 'START',
CREATED_CUSTOMER: 'CREATED_CUSTOMER',
CREATED_INTENT: 'CREATED_INTENT',
CONFIRMED_INTENT: 'CONFIRMED_INTENT',
CREATED_SUBSCRIPTION: 'CREATED_SUBSCRIPTION',
PAID: 'PAID',
CREATED_LICENSE: 'CREATED_LICENSE',
} as const;
export interface SelfHostedSignupForm {
first_name: string;
last_name: string;
billing_address: Address;
shipping_address: Address;
organization: string;
}
export interface SelfHostedSignupBootstrapResponse {
progress: ValueOf<typeof SelfHostedSignupProgress>;
email: string;
}
export interface SelfHostedSignupCustomerResponse {
customer_id: string;
setup_intent_id: string;
setup_intent_secret: string;
progress: ValueOf<typeof SelfHostedSignupProgress>;
}
export interface SelfHostedSignupSuccessResponse {
progress: ValueOf<typeof SelfHostedSignupProgress>;
license: Record<string, string>;
}
import type {Product} from './cloud';
export type HostedCustomerState = {
products: {
products: Record<string, Product>;
productsLoaded: boolean;
};
invoices: {
invoices: Record<string, Invoice>;
invoicesLoaded: boolean;
};
errors: {
products?: true;
invoices?: true;
trueUpReview?: true;
};
signupProgress: ValueOf<typeof SelfHostedSignupProgress>;
trueUpReviewStatus: TrueUpReviewStatusReducer;
trueUpReviewProfile: TrueUpReviewProfileReducer;
}
export type TrueUpReviewProfile = {
content: string;
}
export type TrueUpReviewStatus = {
due_date: number;
complete: boolean;
}
type RequestState = 'IDLE' | 'LOADING' | 'OK'
export interface TrueUpReviewProfileReducer extends TrueUpReviewProfile {
getRequestState: RequestState;
}
export interface TrueUpReviewStatusReducer extends TrueUpReviewStatus {
getRequestState: RequestState;
}
export type SelfHostedExpansionRequest = {
seats: number;
license_id: string;
}