-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Expand file tree
/
Copy pathaudiences.ts
More file actions
54 lines (51 loc) · 1.46 KB
/
Copy pathaudiences.ts
File metadata and controls
54 lines (51 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
export const contactProperties = {
capGreeting: "string",
capAudience: "string",
capOrigin: "string",
capConsent: "string",
capTeammate: "boolean",
capCustomer: "boolean",
capPlanName: "string",
capCustomerWelcome: "string",
capPromotionalEligible: "boolean",
capOnboardingEligible: "boolean",
capLifecycleEnabled: "boolean",
capLifecycleStage: "string",
capHasVideo: "boolean",
capHasSharedVideo: "boolean",
capReadyForPro: "boolean",
capNeedsSharingHelp: "boolean",
capNeedsRecordingHelp: "boolean",
capFreeOnboardingVariant: "string",
capFreeOnboardingExperiment: "string",
capFreeOnboardingAssignedAt: "date",
capVerifiedAt: "date",
capImportedAt: "date",
capSignupAt: "date",
capSourceTags: "string",
capSourceGroup: "string",
} as const;
export type Condition = {
type: "property";
key: string;
operator: "equals" | "isTrue" | "isFalse";
value?: string;
};
export const condition = (key: string, value: string | boolean): Condition =>
typeof value === "boolean"
? { type: "property", key, operator: value ? "isTrue" : "isFalse" }
: { type: "property", key, operator: "equals", value };
export const audienceFilter = (audience: string, promotional: boolean) => ({
match: "all" as const,
conditions: [
condition("subscribed", true),
condition("capConsent", "subscribed"),
condition("capAudience", audience),
...(promotional
? [
condition("capTeammate", false),
condition("capPromotionalEligible", true),
]
: []),
],
});