placementt-core 1.400.1251 → 1.400.1252
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/bulkEngagement.d.ts +26 -0
- package/lib/bulkEngagement.js +26 -1
- package/lib/bulkEngagement.js.map +1 -1
- package/lib/bulkEngagement.test.js +39 -0
- package/lib/bulkEngagement.test.js.map +1 -1
- package/lib/callables/engagement.d.ts +6 -0
- package/lib/callables/engagement.js +3 -0
- package/lib/callables/engagement.js.map +1 -1
- package/lib/callables/registry.d.ts +10 -0
- package/package.json +1 -1
- package/src/bulkEngagement.test.ts +54 -1
- package/src/bulkEngagement.ts +38 -0
- package/src/callables/engagement.ts +3 -0
package/lib/bulkEngagement.d.ts
CHANGED
|
@@ -12,6 +12,19 @@ export type BulkEngagementFlag = "noContacts" | "noRenewalDate" | "noQuote" | "n
|
|
|
12
12
|
export declare const BULK_ENGAGEMENT_FLAG_LABELS: Record<BulkEngagementFlag, string>;
|
|
13
13
|
/** Flags that stop a school being sent the email at all. */
|
|
14
14
|
export declare const BULK_ENGAGEMENT_BLOCKING_FLAGS: BulkEngagementFlag[];
|
|
15
|
+
/** The account types the send popup filters by, and what it calls them. */
|
|
16
|
+
export declare const BULK_ENGAGEMENT_PACKAGE_LABELS: {
|
|
17
|
+
[pkg: string]: string;
|
|
18
|
+
};
|
|
19
|
+
/** The products the send popup filters by. Flags on ResolvedProducts. */
|
|
20
|
+
export type BulkEngagementProduct = "wex" | "employerEvents" | "destinations";
|
|
21
|
+
export declare const BULK_ENGAGEMENT_PRODUCTS: BulkEngagementProduct[];
|
|
22
|
+
export declare const BULK_ENGAGEMENT_PRODUCT_LABELS: Record<BulkEngagementProduct, string>;
|
|
23
|
+
/** What the admin has ticked in the send popup's filters. Empty means any. */
|
|
24
|
+
export type BulkEngagementFilters = {
|
|
25
|
+
packages: string[];
|
|
26
|
+
products: string[];
|
|
27
|
+
};
|
|
15
28
|
/** A school that had this email this recently isn't suggested it again. */
|
|
16
29
|
export declare const RECENTLY_SENT_DAYS = 60;
|
|
17
30
|
export type BulkEngagementSchool = {
|
|
@@ -46,3 +59,16 @@ export type BulkEngagementSuggestion = {
|
|
|
46
59
|
* @return {BulkEngagementSuggestion} whether to suggest it, why, and its flags.
|
|
47
60
|
*/
|
|
48
61
|
export declare const bulkEngagementSuggestion: (templateKey: string, school: BulkEngagementSchool) => BulkEngagementSuggestion;
|
|
62
|
+
/**
|
|
63
|
+
* Whether a school passes the send popup's filters: its package is one of
|
|
64
|
+
* those ticked, and it has any of the products ticked. An empty filter
|
|
65
|
+
* matches everything.
|
|
66
|
+
*
|
|
67
|
+
* @param {object} school the school's package and products.
|
|
68
|
+
* @param {BulkEngagementFilters} filters what is ticked.
|
|
69
|
+
* @return {boolean} whether the school matches.
|
|
70
|
+
*/
|
|
71
|
+
export declare const matchesBulkFilters: (school: {
|
|
72
|
+
package: string;
|
|
73
|
+
products: string[];
|
|
74
|
+
}, { packages, products }: BulkEngagementFilters) => boolean;
|
package/lib/bulkEngagement.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.bulkEngagementSuggestion = exports.RECENTLY_SENT_DAYS = exports.BULK_ENGAGEMENT_BLOCKING_FLAGS = exports.BULK_ENGAGEMENT_FLAG_LABELS = void 0;
|
|
3
|
+
exports.matchesBulkFilters = exports.bulkEngagementSuggestion = exports.RECENTLY_SENT_DAYS = exports.BULK_ENGAGEMENT_PRODUCT_LABELS = exports.BULK_ENGAGEMENT_PRODUCTS = exports.BULK_ENGAGEMENT_PACKAGE_LABELS = exports.BULK_ENGAGEMENT_BLOCKING_FLAGS = exports.BULK_ENGAGEMENT_FLAG_LABELS = void 0;
|
|
4
4
|
const renewals_1 = require("./renewals");
|
|
5
5
|
const constants_1 = require("./constants");
|
|
6
6
|
exports.BULK_ENGAGEMENT_FLAG_LABELS = {
|
|
@@ -12,6 +12,19 @@ exports.BULK_ENGAGEMENT_FLAG_LABELS = {
|
|
|
12
12
|
};
|
|
13
13
|
/** Flags that stop a school being sent the email at all. */
|
|
14
14
|
exports.BULK_ENGAGEMENT_BLOCKING_FLAGS = ["noContacts"];
|
|
15
|
+
/** The account types the send popup filters by, and what it calls them. */
|
|
16
|
+
exports.BULK_ENGAGEMENT_PACKAGE_LABELS = {
|
|
17
|
+
"institutes-one": "School",
|
|
18
|
+
"institutes-two": "Trust",
|
|
19
|
+
"careersHub": "Careers hub",
|
|
20
|
+
"careersSchool": "Hub school",
|
|
21
|
+
};
|
|
22
|
+
exports.BULK_ENGAGEMENT_PRODUCTS = ["wex", "employerEvents", "destinations"];
|
|
23
|
+
exports.BULK_ENGAGEMENT_PRODUCT_LABELS = {
|
|
24
|
+
wex: "Work experience",
|
|
25
|
+
employerEvents: "Employer events",
|
|
26
|
+
destinations: "Destinations",
|
|
27
|
+
};
|
|
15
28
|
/** A school that had this email this recently isn't suggested it again. */
|
|
16
29
|
exports.RECENTLY_SENT_DAYS = 60;
|
|
17
30
|
/**
|
|
@@ -69,4 +82,16 @@ const bulkEngagementSuggestion = (templateKey, school) => {
|
|
|
69
82
|
return { suggested: true, reason: `Renews in ${days} days`, flags };
|
|
70
83
|
};
|
|
71
84
|
exports.bulkEngagementSuggestion = bulkEngagementSuggestion;
|
|
85
|
+
/**
|
|
86
|
+
* Whether a school passes the send popup's filters: its package is one of
|
|
87
|
+
* those ticked, and it has any of the products ticked. An empty filter
|
|
88
|
+
* matches everything.
|
|
89
|
+
*
|
|
90
|
+
* @param {object} school the school's package and products.
|
|
91
|
+
* @param {BulkEngagementFilters} filters what is ticked.
|
|
92
|
+
* @return {boolean} whether the school matches.
|
|
93
|
+
*/
|
|
94
|
+
const matchesBulkFilters = (school, { packages, products }) => (!packages.length || packages.includes(school.package)) &&
|
|
95
|
+
(!products.length || products.some((p) => school.products.includes(p)));
|
|
96
|
+
exports.matchesBulkFilters = matchesBulkFilters;
|
|
72
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,MAAM,CAAC,OAAO,CAAC,CAAC;IACvD,CAAC,CAAC,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAL/D,QAAA,kBAAkB,sBAK6C"}
|
|
@@ -60,4 +60,43 @@ describe("bulk engagement suggestions", () => {
|
|
|
60
60
|
expect(suggest("engagementPickFeatures", school(), "2026-11-04", { nextOnboardingTemplate: "engagementPlanYear" }).suggested).toBe(false);
|
|
61
61
|
});
|
|
62
62
|
});
|
|
63
|
+
describe("matchesBulkFilters", () => {
|
|
64
|
+
const trust = { package: "institutes-two", products: ["wex", "destinations"] };
|
|
65
|
+
const hub = { package: "careersHub", products: ["employerEvents"] };
|
|
66
|
+
const none = { package: "institutes-one", products: [] };
|
|
67
|
+
it("matches everything when nothing is ticked", () => {
|
|
68
|
+
[trust, hub, none].forEach((s) => expect((0, bulkEngagement_1.matchesBulkFilters)(s, { packages: [], products: [] })).toBe(true));
|
|
69
|
+
});
|
|
70
|
+
it("matches a package that is one of those ticked", () => {
|
|
71
|
+
const packages = ["institutes-two", "careersHub"];
|
|
72
|
+
expect((0, bulkEngagement_1.matchesBulkFilters)(trust, { packages, products: [] })).toBe(true);
|
|
73
|
+
expect((0, bulkEngagement_1.matchesBulkFilters)(hub, { packages, products: [] })).toBe(true);
|
|
74
|
+
expect((0, bulkEngagement_1.matchesBulkFilters)(none, { packages, products: [] })).toBe(false);
|
|
75
|
+
});
|
|
76
|
+
it("matches a school with any of the products ticked, not all of them", () => {
|
|
77
|
+
expect((0, bulkEngagement_1.matchesBulkFilters)(trust, { packages: [], products: ["destinations", "employerEvents"] })).toBe(true);
|
|
78
|
+
expect((0, bulkEngagement_1.matchesBulkFilters)(trust, { packages: [], products: ["employerEvents"] })).toBe(false);
|
|
79
|
+
});
|
|
80
|
+
it("never matches a school with no products once a product is ticked", () => {
|
|
81
|
+
expect((0, bulkEngagement_1.matchesBulkFilters)(none, { packages: [], products: ["wex"] })).toBe(false);
|
|
82
|
+
});
|
|
83
|
+
it("needs both filters to pass", () => {
|
|
84
|
+
expect((0, bulkEngagement_1.matchesBulkFilters)(trust, { packages: ["institutes-two"], products: ["wex"] })).toBe(true);
|
|
85
|
+
expect((0, bulkEngagement_1.matchesBulkFilters)(trust, { packages: ["careersHub"], products: ["wex"] })).toBe(false);
|
|
86
|
+
expect((0, bulkEngagement_1.matchesBulkFilters)(trust, { packages: ["institutes-two"], products: ["employerEvents"] })).toBe(false);
|
|
87
|
+
});
|
|
88
|
+
it("labels every package and product in sentence case", () => {
|
|
89
|
+
expect(bulkEngagement_1.BULK_ENGAGEMENT_PACKAGE_LABELS).toEqual({
|
|
90
|
+
"institutes-one": "School",
|
|
91
|
+
"institutes-two": "Trust",
|
|
92
|
+
"careersHub": "Careers hub",
|
|
93
|
+
"careersSchool": "Hub school",
|
|
94
|
+
});
|
|
95
|
+
expect(bulkEngagement_1.BULK_ENGAGEMENT_PRODUCTS.map((p) => bulkEngagement_1.BULK_ENGAGEMENT_PRODUCT_LABELS[p])).toEqual(["Work experience", "Employer events", "Destinations"]);
|
|
96
|
+
});
|
|
97
|
+
it("offers products that resolveProducts sets", () => {
|
|
98
|
+
const products = (0, productResolver_1.resolveProducts)({ package: "careersHub", workExperience: true });
|
|
99
|
+
expect(bulkEngagement_1.BULK_ENGAGEMENT_PRODUCTS.filter((p) => products[p])).toEqual(["employerEvents"]);
|
|
100
|
+
});
|
|
101
|
+
});
|
|
63
102
|
//# sourceMappingURL=bulkEngagement.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bulkEngagement.test.js","sourceRoot":"","sources":["../src/bulkEngagement.test.ts"],"names":[],"mappings":";;AAAA,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,GAAG,EAAE,CAAC,CAAC,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,EAA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E,EAAC,QAAQ,EAAE,CAAC,gBAAgB,CAAC,EAAE,QAAQ,EAAE,CAAC,gBAAgB,CAAC,EAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAChH,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mDAAmD,EAAE,GAAG,EAAE;QACzD,MAAM,CAAC,+CAA8B,CAAC,CAAC,OAAO,CAAC;YAC3C,gBAAgB,EAAE,QAAQ;YAC1B,gBAAgB,EAAE,OAAO;YACzB,YAAY,EAAE,aAAa;YAC3B,eAAe,EAAE,YAAY;SAChC,CAAC,CAAC;QACH,MAAM,CAAC,yCAAwB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,+CAA8B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,iBAAiB,EAAE,iBAAiB,EAAE,cAAc,CAAC,CAAC,CAAC;IACnJ,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;QACjD,MAAM,QAAQ,GAAG,IAAA,iCAAe,EAAC,EAAC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,IAAI,EAAC,CAAC,CAAC;QAChF,MAAM,CAAC,yCAAwB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAC5F,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -14,6 +14,8 @@ export declare const engagementCallables: {
|
|
|
14
14
|
oId: z.ZodString;
|
|
15
15
|
name: z.ZodString;
|
|
16
16
|
package: z.ZodString;
|
|
17
|
+
/** The products the admin can filter this school by. */
|
|
18
|
+
products: z.ZodArray<z.ZodEnum<["wex", "employerEvents", "destinations"]>, "many">;
|
|
17
19
|
suggested: z.ZodBoolean;
|
|
18
20
|
reason: z.ZodOptional<z.ZodString>;
|
|
19
21
|
flags: z.ZodArray<z.ZodEnum<["noContacts", "noRenewalDate", "noQuote", "noFinanceContact", "sentRecently"]>, "many">;
|
|
@@ -30,6 +32,7 @@ export declare const engagementCallables: {
|
|
|
30
32
|
flags: ("noContacts" | "noRenewalDate" | "noQuote" | "noFinanceContact" | "sentRecently")[];
|
|
31
33
|
contacts: number;
|
|
32
34
|
params: Record<string, string>;
|
|
35
|
+
products: ("employerEvents" | "wex" | "destinations")[];
|
|
33
36
|
suggested: boolean;
|
|
34
37
|
reason?: string | undefined;
|
|
35
38
|
lastSent?: string | undefined;
|
|
@@ -40,6 +43,7 @@ export declare const engagementCallables: {
|
|
|
40
43
|
flags: ("noContacts" | "noRenewalDate" | "noQuote" | "noFinanceContact" | "sentRecently")[];
|
|
41
44
|
contacts: number;
|
|
42
45
|
params: Record<string, string>;
|
|
46
|
+
products: ("employerEvents" | "wex" | "destinations")[];
|
|
43
47
|
suggested: boolean;
|
|
44
48
|
reason?: string | undefined;
|
|
45
49
|
lastSent?: string | undefined;
|
|
@@ -52,6 +56,7 @@ export declare const engagementCallables: {
|
|
|
52
56
|
flags: ("noContacts" | "noRenewalDate" | "noQuote" | "noFinanceContact" | "sentRecently")[];
|
|
53
57
|
contacts: number;
|
|
54
58
|
params: Record<string, string>;
|
|
59
|
+
products: ("employerEvents" | "wex" | "destinations")[];
|
|
55
60
|
suggested: boolean;
|
|
56
61
|
reason?: string | undefined;
|
|
57
62
|
lastSent?: string | undefined;
|
|
@@ -64,6 +69,7 @@ export declare const engagementCallables: {
|
|
|
64
69
|
flags: ("noContacts" | "noRenewalDate" | "noQuote" | "noFinanceContact" | "sentRecently")[];
|
|
65
70
|
contacts: number;
|
|
66
71
|
params: Record<string, string>;
|
|
72
|
+
products: ("employerEvents" | "wex" | "destinations")[];
|
|
67
73
|
suggested: boolean;
|
|
68
74
|
reason?: string | undefined;
|
|
69
75
|
lastSent?: string | undefined;
|
|
@@ -12,6 +12,7 @@ const types_1 = require("./types");
|
|
|
12
12
|
* an email interaction on the school. All of them are admin-only.
|
|
13
13
|
*/
|
|
14
14
|
const flag = zod_1.z.enum(["noContacts", "noRenewalDate", "noQuote", "noFinanceContact", "sentRecently"]);
|
|
15
|
+
const product = zod_1.z.enum(["wex", "employerEvents", "destinations"]);
|
|
15
16
|
exports.engagementCallables = {
|
|
16
17
|
"bulkEngagement-getBulkEngagementSchools": {
|
|
17
18
|
request: zod_1.z.object({
|
|
@@ -23,6 +24,8 @@ exports.engagementCallables = {
|
|
|
23
24
|
oId: zod_1.z.string(),
|
|
24
25
|
name: zod_1.z.string(),
|
|
25
26
|
package: zod_1.z.string(),
|
|
27
|
+
/** The products the admin can filter this school by. */
|
|
28
|
+
products: zod_1.z.array(product),
|
|
26
29
|
suggested: zod_1.z.boolean(),
|
|
27
30
|
reason: zod_1.z.string().optional(),
|
|
28
31
|
flags: zod_1.z.array(flag),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engagement.js","sourceRoot":"","sources":["../../src/callables/engagement.ts"],"names":[],"mappings":";;;AAAA,6BAAsB;AACtB,mCAAqD;AAErD;;;;;;;GAOG;AAEH,MAAM,IAAI,GAAG,OAAC,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,eAAe,EAAE,SAAS,EAAE,kBAAkB,EAAE,cAAc,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"engagement.js","sourceRoot":"","sources":["../../src/callables/engagement.ts"],"names":[],"mappings":";;;AAAA,6BAAsB;AACtB,mCAAqD;AAErD;;;;;;;GAOG;AAEH,MAAM,IAAI,GAAG,OAAC,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,eAAe,EAAE,SAAS,EAAE,kBAAkB,EAAE,cAAc,CAAC,CAAC,CAAC;AACpG,MAAM,OAAO,GAAG,OAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,gBAAgB,EAAE,cAAc,CAAC,CAAC,CAAC;AAErD,QAAA,mBAAmB,GAAG;IAC/B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;YAC7E,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,oBAAoB,CAAC;YACvD,8EAA8E;YAC9E,IAAI,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YACjC,4DAA4D;YAC5D,SAAS,EAAE,IAAA,qBAAa,EAAC,OAAC,CAAC,MAAM,EAAE,CAAC;YACpC,oFAAoF;YACpF,SAAS,EAAE,OAAC,CAAC,OAAO,EAAE;SACzB,CAAC;QACF,+DAA+D;QAC/D,QAAQ,EAAE,OAAC,CAAC,MAAM,CAAC;YACf,OAAO,EAAE,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,MAAM,EAAE,EAAE,OAAC,CAAC,MAAM,CAAC,EAAC,IAAI,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAC,CAAC,CAAC;SACrG,CAAC;KACL;IACD,qFAAqF;IACrF,uCAAuC,EAAE;QACrC,OAAO,EAAE,OAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE;QAChC,QAAQ,EAAE,OAAC,CAAC,MAAM,CAAC,EAAC,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,EAAC,CAAC;KAC5C;CACoB,CAAC"}
|
|
@@ -24,6 +24,7 @@ export declare const allCallables: {
|
|
|
24
24
|
oId: z.ZodString;
|
|
25
25
|
name: z.ZodString;
|
|
26
26
|
package: z.ZodString;
|
|
27
|
+
products: z.ZodArray<z.ZodEnum<["wex", "employerEvents", "destinations"]>, "many">;
|
|
27
28
|
suggested: z.ZodBoolean;
|
|
28
29
|
reason: z.ZodOptional<z.ZodString>;
|
|
29
30
|
flags: z.ZodArray<z.ZodEnum<["noContacts", "noRenewalDate", "noQuote", "noFinanceContact", "sentRecently"]>, "many">;
|
|
@@ -37,6 +38,7 @@ export declare const allCallables: {
|
|
|
37
38
|
flags: ("noContacts" | "noRenewalDate" | "noQuote" | "noFinanceContact" | "sentRecently")[];
|
|
38
39
|
contacts: number;
|
|
39
40
|
params: Record<string, string>;
|
|
41
|
+
products: ("employerEvents" | "wex" | "destinations")[];
|
|
40
42
|
suggested: boolean;
|
|
41
43
|
reason?: string | undefined;
|
|
42
44
|
lastSent?: string | undefined;
|
|
@@ -47,6 +49,7 @@ export declare const allCallables: {
|
|
|
47
49
|
flags: ("noContacts" | "noRenewalDate" | "noQuote" | "noFinanceContact" | "sentRecently")[];
|
|
48
50
|
contacts: number;
|
|
49
51
|
params: Record<string, string>;
|
|
52
|
+
products: ("employerEvents" | "wex" | "destinations")[];
|
|
50
53
|
suggested: boolean;
|
|
51
54
|
reason?: string | undefined;
|
|
52
55
|
lastSent?: string | undefined;
|
|
@@ -59,6 +62,7 @@ export declare const allCallables: {
|
|
|
59
62
|
flags: ("noContacts" | "noRenewalDate" | "noQuote" | "noFinanceContact" | "sentRecently")[];
|
|
60
63
|
contacts: number;
|
|
61
64
|
params: Record<string, string>;
|
|
65
|
+
products: ("employerEvents" | "wex" | "destinations")[];
|
|
62
66
|
suggested: boolean;
|
|
63
67
|
reason?: string | undefined;
|
|
64
68
|
lastSent?: string | undefined;
|
|
@@ -71,6 +75,7 @@ export declare const allCallables: {
|
|
|
71
75
|
flags: ("noContacts" | "noRenewalDate" | "noQuote" | "noFinanceContact" | "sentRecently")[];
|
|
72
76
|
contacts: number;
|
|
73
77
|
params: Record<string, string>;
|
|
78
|
+
products: ("employerEvents" | "wex" | "destinations")[];
|
|
74
79
|
suggested: boolean;
|
|
75
80
|
reason?: string | undefined;
|
|
76
81
|
lastSent?: string | undefined;
|
|
@@ -7999,6 +8004,7 @@ export declare const callableGroups: {
|
|
|
7999
8004
|
oId: z.ZodString;
|
|
8000
8005
|
name: z.ZodString;
|
|
8001
8006
|
package: z.ZodString;
|
|
8007
|
+
products: z.ZodArray<z.ZodEnum<["wex", "employerEvents", "destinations"]>, "many">;
|
|
8002
8008
|
suggested: z.ZodBoolean;
|
|
8003
8009
|
reason: z.ZodOptional<z.ZodString>;
|
|
8004
8010
|
flags: z.ZodArray<z.ZodEnum<["noContacts", "noRenewalDate", "noQuote", "noFinanceContact", "sentRecently"]>, "many">;
|
|
@@ -8012,6 +8018,7 @@ export declare const callableGroups: {
|
|
|
8012
8018
|
flags: ("noContacts" | "noRenewalDate" | "noQuote" | "noFinanceContact" | "sentRecently")[];
|
|
8013
8019
|
contacts: number;
|
|
8014
8020
|
params: Record<string, string>;
|
|
8021
|
+
products: ("employerEvents" | "wex" | "destinations")[];
|
|
8015
8022
|
suggested: boolean;
|
|
8016
8023
|
reason?: string | undefined;
|
|
8017
8024
|
lastSent?: string | undefined;
|
|
@@ -8022,6 +8029,7 @@ export declare const callableGroups: {
|
|
|
8022
8029
|
flags: ("noContacts" | "noRenewalDate" | "noQuote" | "noFinanceContact" | "sentRecently")[];
|
|
8023
8030
|
contacts: number;
|
|
8024
8031
|
params: Record<string, string>;
|
|
8032
|
+
products: ("employerEvents" | "wex" | "destinations")[];
|
|
8025
8033
|
suggested: boolean;
|
|
8026
8034
|
reason?: string | undefined;
|
|
8027
8035
|
lastSent?: string | undefined;
|
|
@@ -8034,6 +8042,7 @@ export declare const callableGroups: {
|
|
|
8034
8042
|
flags: ("noContacts" | "noRenewalDate" | "noQuote" | "noFinanceContact" | "sentRecently")[];
|
|
8035
8043
|
contacts: number;
|
|
8036
8044
|
params: Record<string, string>;
|
|
8045
|
+
products: ("employerEvents" | "wex" | "destinations")[];
|
|
8037
8046
|
suggested: boolean;
|
|
8038
8047
|
reason?: string | undefined;
|
|
8039
8048
|
lastSent?: string | undefined;
|
|
@@ -8046,6 +8055,7 @@ export declare const callableGroups: {
|
|
|
8046
8055
|
flags: ("noContacts" | "noRenewalDate" | "noQuote" | "noFinanceContact" | "sentRecently")[];
|
|
8047
8056
|
contacts: number;
|
|
8048
8057
|
params: Record<string, string>;
|
|
8058
|
+
products: ("employerEvents" | "wex" | "destinations")[];
|
|
8049
8059
|
suggested: boolean;
|
|
8050
8060
|
reason?: string | undefined;
|
|
8051
8061
|
lastSent?: string | undefined;
|
package/package.json
CHANGED
|
@@ -3,7 +3,13 @@ jest.mock("./firebase/firebaseQuery", () => ({__esModule: true, default: class {
|
|
|
3
3
|
|
|
4
4
|
import {InstituteData} from "./typeDefinitions";
|
|
5
5
|
import {resolveProducts} from "./productResolver";
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
BULK_ENGAGEMENT_PACKAGE_LABELS,
|
|
8
|
+
BULK_ENGAGEMENT_PRODUCTS,
|
|
9
|
+
BULK_ENGAGEMENT_PRODUCT_LABELS,
|
|
10
|
+
bulkEngagementSuggestion,
|
|
11
|
+
matchesBulkFilters,
|
|
12
|
+
} from "./bulkEngagement";
|
|
7
13
|
|
|
8
14
|
const school = (renewalDate?: string, overrides: Partial<InstituteData> = {}): InstituteData => ({
|
|
9
15
|
name: "Calder Park Academy",
|
|
@@ -70,3 +76,50 @@ describe("bulk engagement suggestions", () => {
|
|
|
70
76
|
expect(suggest("engagementPickFeatures", school(), "2026-11-04", {nextOnboardingTemplate: "engagementPlanYear"}).suggested).toBe(false);
|
|
71
77
|
});
|
|
72
78
|
});
|
|
79
|
+
|
|
80
|
+
describe("matchesBulkFilters", () => {
|
|
81
|
+
const trust = {package: "institutes-two", products: ["wex", "destinations"]};
|
|
82
|
+
const hub = {package: "careersHub", products: ["employerEvents"]};
|
|
83
|
+
const none = {package: "institutes-one", products: []};
|
|
84
|
+
|
|
85
|
+
it("matches everything when nothing is ticked", () => {
|
|
86
|
+
[trust, hub, none].forEach((s) => expect(matchesBulkFilters(s, {packages: [], products: []})).toBe(true));
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it("matches a package that is one of those ticked", () => {
|
|
90
|
+
const packages = ["institutes-two", "careersHub"];
|
|
91
|
+
expect(matchesBulkFilters(trust, {packages, products: []})).toBe(true);
|
|
92
|
+
expect(matchesBulkFilters(hub, {packages, products: []})).toBe(true);
|
|
93
|
+
expect(matchesBulkFilters(none, {packages, products: []})).toBe(false);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it("matches a school with any of the products ticked, not all of them", () => {
|
|
97
|
+
expect(matchesBulkFilters(trust, {packages: [], products: ["destinations", "employerEvents"]})).toBe(true);
|
|
98
|
+
expect(matchesBulkFilters(trust, {packages: [], products: ["employerEvents"]})).toBe(false);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it("never matches a school with no products once a product is ticked", () => {
|
|
102
|
+
expect(matchesBulkFilters(none, {packages: [], products: ["wex"]})).toBe(false);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
it("needs both filters to pass", () => {
|
|
106
|
+
expect(matchesBulkFilters(trust, {packages: ["institutes-two"], products: ["wex"]})).toBe(true);
|
|
107
|
+
expect(matchesBulkFilters(trust, {packages: ["careersHub"], products: ["wex"]})).toBe(false);
|
|
108
|
+
expect(matchesBulkFilters(trust, {packages: ["institutes-two"], products: ["employerEvents"]})).toBe(false);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it("labels every package and product in sentence case", () => {
|
|
112
|
+
expect(BULK_ENGAGEMENT_PACKAGE_LABELS).toEqual({
|
|
113
|
+
"institutes-one": "School",
|
|
114
|
+
"institutes-two": "Trust",
|
|
115
|
+
"careersHub": "Careers hub",
|
|
116
|
+
"careersSchool": "Hub school",
|
|
117
|
+
});
|
|
118
|
+
expect(BULK_ENGAGEMENT_PRODUCTS.map((p) => BULK_ENGAGEMENT_PRODUCT_LABELS[p])).toEqual(["Work experience", "Employer events", "Destinations"]);
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
it("offers products that resolveProducts sets", () => {
|
|
122
|
+
const products = resolveProducts({package: "careersHub", workExperience: true});
|
|
123
|
+
expect(BULK_ENGAGEMENT_PRODUCTS.filter((p) => products[p])).toEqual(["employerEvents"]);
|
|
124
|
+
});
|
|
125
|
+
});
|
package/src/bulkEngagement.ts
CHANGED
|
@@ -25,6 +25,28 @@ export const BULK_ENGAGEMENT_FLAG_LABELS: Record<BulkEngagementFlag, string> = {
|
|
|
25
25
|
/** Flags that stop a school being sent the email at all. */
|
|
26
26
|
export const BULK_ENGAGEMENT_BLOCKING_FLAGS: BulkEngagementFlag[] = ["noContacts"];
|
|
27
27
|
|
|
28
|
+
/** The account types the send popup filters by, and what it calls them. */
|
|
29
|
+
export const BULK_ENGAGEMENT_PACKAGE_LABELS: {[pkg: string]: string} = {
|
|
30
|
+
"institutes-one": "School",
|
|
31
|
+
"institutes-two": "Trust",
|
|
32
|
+
"careersHub": "Careers hub",
|
|
33
|
+
"careersSchool": "Hub school",
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/** The products the send popup filters by. Flags on ResolvedProducts. */
|
|
37
|
+
export type BulkEngagementProduct = "wex"|"employerEvents"|"destinations";
|
|
38
|
+
|
|
39
|
+
export const BULK_ENGAGEMENT_PRODUCTS: BulkEngagementProduct[] = ["wex", "employerEvents", "destinations"];
|
|
40
|
+
|
|
41
|
+
export const BULK_ENGAGEMENT_PRODUCT_LABELS: Record<BulkEngagementProduct, string> = {
|
|
42
|
+
wex: "Work experience",
|
|
43
|
+
employerEvents: "Employer events",
|
|
44
|
+
destinations: "Destinations",
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/** What the admin has ticked in the send popup's filters. Empty means any. */
|
|
48
|
+
export type BulkEngagementFilters = {packages: string[], products: string[]};
|
|
49
|
+
|
|
28
50
|
/** A school that had this email this recently isn't suggested it again. */
|
|
29
51
|
export const RECENTLY_SENT_DAYS = 60;
|
|
30
52
|
|
|
@@ -98,3 +120,19 @@ export const bulkEngagementSuggestion = (templateKey: string, school: BulkEngage
|
|
|
98
120
|
if (days === undefined || days < window[0] || days > window[1]) return none;
|
|
99
121
|
return {suggested: true, reason: `Renews in ${days} days`, flags};
|
|
100
122
|
};
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Whether a school passes the send popup's filters: its package is one of
|
|
126
|
+
* those ticked, and it has any of the products ticked. An empty filter
|
|
127
|
+
* matches everything.
|
|
128
|
+
*
|
|
129
|
+
* @param {object} school the school's package and products.
|
|
130
|
+
* @param {BulkEngagementFilters} filters what is ticked.
|
|
131
|
+
* @return {boolean} whether the school matches.
|
|
132
|
+
*/
|
|
133
|
+
export const matchesBulkFilters = (
|
|
134
|
+
school: {package: string, products: string[]},
|
|
135
|
+
{packages, products}: BulkEngagementFilters,
|
|
136
|
+
): boolean =>
|
|
137
|
+
(!packages.length || packages.includes(school.package)) &&
|
|
138
|
+
(!products.length || products.some((p) => school.products.includes(p)));
|
|
@@ -11,6 +11,7 @@ import {CallableGroup, optionalField} from "./types";
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
const flag = z.enum(["noContacts", "noRenewalDate", "noQuote", "noFinanceContact", "sentRecently"]);
|
|
14
|
+
const product = z.enum(["wex", "employerEvents", "destinations"]);
|
|
14
15
|
|
|
15
16
|
export const engagementCallables = {
|
|
16
17
|
"bulkEngagement-getBulkEngagementSchools": {
|
|
@@ -23,6 +24,8 @@ export const engagementCallables = {
|
|
|
23
24
|
oId: z.string(),
|
|
24
25
|
name: z.string(),
|
|
25
26
|
package: z.string(),
|
|
27
|
+
/** The products the admin can filter this school by. */
|
|
28
|
+
products: z.array(product),
|
|
26
29
|
suggested: z.boolean(),
|
|
27
30
|
reason: z.string().optional(),
|
|
28
31
|
flags: z.array(flag),
|