mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 15:53:27 +00:00
[AC-1863] Send initiationPath on organization or user signup (#7747)
* Sent initiation path for organization and user signups * Rename organizationQueryParameter > organizationTypeQueryParameter * Jared's feedback * Split PM & SM initiation path
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { PaymentMethodType, PlanType } from "../../../billing/enums";
|
||||
import { InitiationPath } from "../../../models/request/reference-event.request";
|
||||
|
||||
import { OrganizationKeysRequest } from "./organization-keys.request";
|
||||
|
||||
@@ -23,9 +24,9 @@ export class OrganizationCreateRequest {
|
||||
billingAddressState: string;
|
||||
billingAddressPostalCode: string;
|
||||
billingAddressCountry: string;
|
||||
|
||||
useSecretsManager: boolean;
|
||||
additionalSmSeats: number;
|
||||
additionalServiceAccounts: number;
|
||||
isFromSecretsManagerTrial: boolean;
|
||||
initiationPath: InitiationPath;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import { OrganizationResponse } from "../../admin-console/models/response/organization.response";
|
||||
import { InitiationPath } from "../../models/request/reference-event.request";
|
||||
import { PaymentMethodType, PlanType } from "../enums";
|
||||
|
||||
export type OrganizationInformation = {
|
||||
name: string;
|
||||
billingEmail: string;
|
||||
businessName?: string;
|
||||
initiationPath?: InitiationPath;
|
||||
};
|
||||
|
||||
export type PlanInformation = {
|
||||
|
||||
@@ -76,6 +76,18 @@ export class OrganizationBillingService implements OrganizationBillingServiceAbs
|
||||
};
|
||||
}
|
||||
|
||||
private prohibitsAdditionalSeats(planType: PlanType) {
|
||||
switch (planType) {
|
||||
case PlanType.Free:
|
||||
case PlanType.FamiliesAnnually:
|
||||
case PlanType.FamiliesAnnually2019:
|
||||
case PlanType.TeamsStarter:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private setOrganizationInformation(
|
||||
request: OrganizationCreateRequest,
|
||||
information: OrganizationInformation,
|
||||
@@ -83,6 +95,7 @@ export class OrganizationBillingService implements OrganizationBillingServiceAbs
|
||||
request.name = information.name;
|
||||
request.businessName = information.businessName;
|
||||
request.billingEmail = information.billingEmail;
|
||||
request.initiationPath = information.initiationPath;
|
||||
}
|
||||
|
||||
private setOrganizationKeys(request: OrganizationCreateRequest, keys: OrganizationKeys): void {
|
||||
@@ -121,7 +134,7 @@ export class OrganizationBillingService implements OrganizationBillingServiceAbs
|
||||
): void {
|
||||
request.planType = information.type;
|
||||
|
||||
if (request.planType === PlanType.Free) {
|
||||
if (this.prohibitsAdditionalSeats(request.planType)) {
|
||||
request.useSecretsManager = information.subscribeToSecretsManager;
|
||||
request.isFromSecretsManagerTrial = information.isFromSecretsManagerTrial;
|
||||
return;
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
export type InitiationPath =
|
||||
| "Registration form"
|
||||
| "Password Manager trial from marketing website"
|
||||
| "Secrets Manager trial from marketing website"
|
||||
| "New organization creation in-product"
|
||||
| "Upgrade in-product";
|
||||
|
||||
export class ReferenceEventRequest {
|
||||
id: string;
|
||||
session: string;
|
||||
layout: string;
|
||||
flow: string;
|
||||
initiationPath: InitiationPath;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user