@simplybusiness/services 2.1.0 → 2.2.0

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.
@@ -5,5 +5,5 @@ export type GetAirbrakeOptions = {
5
5
  forceSend?: boolean;
6
6
  };
7
7
  export declare function getAirbrake(options?: GetAirbrakeOptions): {
8
- notify: jest.Mock<any, any, any> | ((...data: any[]) => void);
8
+ notify: (...data: any[]) => void;
9
9
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@simplybusiness/services",
3
3
  "license": "UNLICENSED",
4
- "version": "2.1.0",
4
+ "version": "2.2.0",
5
5
  "description": "Internal library for services",
6
6
  "repository": {
7
7
  "type": "git",
@@ -12,7 +12,7 @@ const notifierInstances = new Map<number, Notifier>();
12
12
  const fakeAirbrake = {
13
13
  notify:
14
14
  globalThis.process?.env?.NODE_ENV === "test"
15
- ? jest.fn()
15
+ ? () => {}
16
16
  : console.error.bind(console),
17
17
  };
18
18
 
@@ -130,4 +130,42 @@ describe("coverageSelectionEventDefinitions", () => {
130
130
  expect("data" in result && result.data.vertical).toBe("");
131
131
  });
132
132
  });
133
+
134
+ describe("learnMoreModalOpened", () => {
135
+ it("should create correct structured event payload", () => {
136
+ const params = {
137
+ product: "general_liability",
138
+ };
139
+
140
+ const result = findEventByName(
141
+ coverageSelectionEventDefinitions,
142
+ "learnMoreModalOpened",
143
+ ).makePayload(params);
144
+
145
+ expect(result).toEqual({
146
+ category: "coverage_selection",
147
+ action: "learn_more_modal_opened",
148
+ label: "general_liability",
149
+ property: window.location.href,
150
+ });
151
+ });
152
+
153
+ it("should handle different product IDs", () => {
154
+ const params = {
155
+ product: "business_owners_policy",
156
+ };
157
+
158
+ const result = findEventByName(
159
+ coverageSelectionEventDefinitions,
160
+ "learnMoreModalOpened",
161
+ ).makePayload(params);
162
+
163
+ expect(result).toEqual({
164
+ category: "coverage_selection",
165
+ action: "learn_more_modal_opened",
166
+ label: "business_owners_policy",
167
+ property: window.location.href,
168
+ });
169
+ });
170
+ });
133
171
  });
@@ -33,4 +33,18 @@ export const coverageSelectionEventDefinitions: EventDefinition[] = [
33
33
  };
34
34
  },
35
35
  },
36
+ {
37
+ name: "learnMoreModalOpened",
38
+ type: "structured",
39
+ makePayload: params => {
40
+ const { product } = params as ParamsType & { product: string };
41
+
42
+ return {
43
+ category: "coverage_selection",
44
+ action: "learn_more_modal_opened",
45
+ label: product,
46
+ property: window.location.href,
47
+ };
48
+ },
49
+ },
36
50
  ];