@simplybusiness/services 1.2.8 → 1.2.10

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.
@@ -1,9 +1,9 @@
1
1
  import { baseEventDefinitions } from "./base";
2
- import { qcpEventDefinitions } from "./qcp";
3
- import { referralEventDefinitions } from "./referral";
4
2
  import { interventionEventDefinitions } from "./intervention";
5
- import { questionnaireEventDefinitions } from "./questionnaire";
6
3
  import { personalisedCoverEventDefinitions } from "./personalised_cover";
4
+ import { qcpEventDefinitions } from "./qcp";
5
+ import { questionnaireEventDefinitions } from "./questionnaire/questionnaire";
6
+ import { referralEventDefinitions } from "./referral";
7
7
 
8
8
  // All events (keep up to date with new files)
9
9
  export const eventDefinitions = [
@@ -1,7 +1,7 @@
1
- import type { EventDefinition, ParamsType } from "../types";
2
- import { redact } from "./redaction";
3
- import { DELIMITER } from "../constants";
4
1
  import { snakeCase } from "../../utils";
2
+ import { DELIMITER } from "../constants";
3
+ import type { EventDefinition, ParamsType } from "../types";
4
+ import { redact } from "./questionnaire/redaction";
5
5
 
6
6
  /**
7
7
  * Event definitions for Snowplow
@@ -1,4 +1,4 @@
1
- import { EventDefinition } from "../types";
1
+ import { EventDefinition } from "../../types";
2
2
  import { questionnaireEventDefinitions } from "./questionnaire";
3
3
 
4
4
  const findEventByName = (eventName: string): EventDefinition => {
@@ -28,7 +28,7 @@ describe("questionnaireEventDefinitions", () => {
28
28
 
29
29
  expect(result).toEqual({
30
30
  schema:
31
- "iglu:com.simplybusiness/form_question_answered/jsonschema/1-0-3",
31
+ "iglu:com.simplybusiness/form_question_answered/jsonschema/1-0-4",
32
32
  data: {
33
33
  site: "uk",
34
34
  page_index: 1,
@@ -57,7 +57,7 @@ describe("questionnaireEventDefinitions", () => {
57
57
 
58
58
  expect(result).toEqual({
59
59
  schema:
60
- "iglu:com.simplybusiness/form_question_answered/jsonschema/1-0-3",
60
+ "iglu:com.simplybusiness/form_question_answered/jsonschema/1-0-4",
61
61
  data: {
62
62
  site: "uk",
63
63
  page_index: 1,
@@ -86,7 +86,7 @@ describe("questionnaireEventDefinitions", () => {
86
86
 
87
87
  expect(result).toEqual({
88
88
  schema:
89
- "iglu:com.simplybusiness/form_question_answered/jsonschema/1-0-3",
89
+ "iglu:com.simplybusiness/form_question_answered/jsonschema/1-0-4",
90
90
  data: {
91
91
  site: "uk",
92
92
  page_index: 1,
@@ -1,5 +1,5 @@
1
- import { DELIMITER } from "../constants";
2
- import type { EventDefinition, ParamsType } from "../types";
1
+ import { DELIMITER } from "../../constants";
2
+ import type { EventDefinition, ParamsType } from "../../types";
3
3
  import { redact } from "./redaction";
4
4
 
5
5
  // Questionnaire events
@@ -17,7 +17,7 @@ export const questionnaireEventDefinitions: EventDefinition[] = [
17
17
 
18
18
  return {
19
19
  schema:
20
- "iglu:com.simplybusiness/form_question_answered/jsonschema/1-0-3",
20
+ "iglu:com.simplybusiness/form_question_answered/jsonschema/1-0-4",
21
21
  data: {
22
22
  site: context.site,
23
23
  page_index: 1,
@@ -167,4 +167,18 @@ export const questionnaireEventDefinitions: EventDefinition[] = [
167
167
  };
168
168
  },
169
169
  },
170
+ {
171
+ name: "tradeChanged",
172
+ type: "structured",
173
+ makePayload: params => {
174
+ const { label, property } = params as ParamsType;
175
+
176
+ return {
177
+ action: "change_your_selected_profession_button_clicked",
178
+ category: "change_your_selected_profession_button",
179
+ label: `Question: ${label}`,
180
+ property, // Answer before change
181
+ };
182
+ },
183
+ },
170
184
  ];
@@ -1,4 +1,4 @@
1
- import type { ParamsType } from "../types";
1
+ import type { ParamsType } from "../../types";
2
2
 
3
3
  const PII_ANSWER = [
4
4
  "customer_title",