@simplybusiness/services 0.1.5 → 0.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - b09026e: Add analytics event to Headline component
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [c2f1d0a]
12
+ - @simplybusiness/mobius@4.15.0
13
+
14
+ ## 0.1.6
15
+
16
+ ### Patch Changes
17
+
18
+ - f2ca54a: Chore: Bump services package to release new event definition
19
+
3
20
  ## 0.1.5
4
21
 
5
22
  ### Patch Changes
@@ -14,17 +14,26 @@ _export(exports, {
14
14
  },
15
15
  qcpPageEvents: function() {
16
16
  return qcpPageEvents;
17
+ },
18
+ thankYouPageEvents: function() {
19
+ return thankYouPageEvents;
17
20
  }
18
21
  });
19
22
  const _base = require("./base");
20
23
  const _qcp = require("./qcp");
24
+ const _thankYou = require("./thankYou");
21
25
  const eventDefinitions = [
22
26
  ..._base.baseEventDefinitions,
23
- ..._qcp.qcpEventDefinitions
27
+ ..._qcp.qcpEventDefinitions,
28
+ ..._thankYou.thankYouEventDefinitions
24
29
  ];
25
30
  const qcpPageEvents = [
26
31
  ..._base.baseEventDefinitions,
27
32
  ..._qcp.qcpEventDefinitions
33
+ ];
34
+ const thankYouPageEvents = [
35
+ ..._base.baseEventDefinitions,
36
+ ..._thankYou.thankYouEventDefinitions
28
37
  ]; // Create a new export for each kind of page below
29
38
  // containing just the subset needed for that page
30
39
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/snowplow/event-definitions/index.ts"],"sourcesContent":["import { baseEventDefinitions } from \"./base\";\nimport { qcpEventDefinitions } from \"./qcp\";\n\n// All events (keep up to date with new files)\nexport const eventDefinitions = [\n ...baseEventDefinitions,\n ...qcpEventDefinitions,\n];\n\nexport const qcpPageEvents = [...baseEventDefinitions, ...qcpEventDefinitions];\n\n// Create a new export for each kind of page below\n// containing just the subset needed for that page\n"],"names":["eventDefinitions","qcpPageEvents","baseEventDefinitions","qcpEventDefinitions"],"mappings":";;;;;;;;;;;IAIaA,gBAAgB;eAAhBA;;IAKAC,aAAa;eAAbA;;;sBATwB;qBACD;AAG7B,MAAMD,mBAAmB;OAC3BE,0BAAoB;OACpBC,wBAAmB;CACvB;AAEM,MAAMF,gBAAgB;OAAIC,0BAAoB;OAAKC,wBAAmB;CAAC,EAE9E,kDAAkD;CAClD,kDAAkD"}
1
+ {"version":3,"sources":["../../../../src/snowplow/event-definitions/index.ts"],"sourcesContent":["import { baseEventDefinitions } from \"./base\";\nimport { qcpEventDefinitions } from \"./qcp\";\nimport { thankYouEventDefinitions } from \"./thankYou\";\n\n// All events (keep up to date with new files)\nexport const eventDefinitions = [\n ...baseEventDefinitions,\n ...qcpEventDefinitions,\n ...thankYouEventDefinitions,\n];\n\nexport const qcpPageEvents = [...baseEventDefinitions, ...qcpEventDefinitions];\n\nexport const thankYouPageEvents = [\n ...baseEventDefinitions,\n ...thankYouEventDefinitions,\n];\n\n// Create a new export for each kind of page below\n// containing just the subset needed for that page\n"],"names":["eventDefinitions","qcpPageEvents","thankYouPageEvents","baseEventDefinitions","qcpEventDefinitions","thankYouEventDefinitions"],"mappings":";;;;;;;;;;;IAKaA,gBAAgB;eAAhBA;;IAMAC,aAAa;eAAbA;;IAEAC,kBAAkB;eAAlBA;;;sBAbwB;qBACD;0BACK;AAGlC,MAAMF,mBAAmB;OAC3BG,0BAAoB;OACpBC,wBAAmB;OACnBC,kCAAwB;CAC5B;AAEM,MAAMJ,gBAAgB;OAAIE,0BAAoB;OAAKC,wBAAmB;CAAC;AAEvE,MAAMF,qBAAqB;OAC7BC,0BAAoB;OACpBE,kCAAwB;CAC5B,EAED,kDAAkD;CAClD,kDAAkD"}
@@ -208,6 +208,20 @@ const qcpEventDefinitions = [
208
208
  property: window.location.href
209
209
  };
210
210
  }
211
+ },
212
+ {
213
+ name: "backToApplication",
214
+ type: "unstructured",
215
+ makePayload: (params)=>{
216
+ const { journeyId, vertical } = params;
217
+ return {
218
+ schema: "iglu:com.simplybusiness/back_to_application/jsonschema/1-0-0",
219
+ data: {
220
+ journey_id: journeyId,
221
+ vertical
222
+ }
223
+ };
224
+ }
211
225
  }
212
226
  ];
213
227
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/snowplow/event-definitions/qcp.ts"],"sourcesContent":["import { snakeCase } from \"../../utils\";\nimport { EventDefinition, ParamsType } from \"../types\";\n\n/**\n * Event definitions for Snowplow\n * @type {EventDefinition[]}\n * @property {string} name - The name of the event, to use when triggering\n * @property {string} type - The type of the event (structured | unstructured)\n * @property {makePayload} makePayload\n * - Function that creates the payload for the event;\n * - Allows optional params object to be passed in\n *\n * @example\n * import { Snowplow } from \"./Snowplow\";\n * import { eventDefinitions } from \"./event-definitions\";\n *\n * const snowplow = new Snowplow();\n * snowplow.addEventHandlers(eventDefinitions);\n */\n\n// QCP page events\nexport const qcpEventDefinitions: EventDefinition[] = [\n {\n // QDP details button\n name: \"detailsClicked\",\n type: \"structured\",\n makePayload: () => ({\n category: \"comparison_cta\",\n action: \"link_click\",\n label: \"Details\",\n }),\n },\n {\n // Buy button\n name: \"selectClicked\",\n type: \"structured\",\n makePayload: () => ({\n category: \"comparison_cta\",\n action: \"link_click\",\n label: \"Select\",\n }),\n },\n {\n // Quote Details Slider Next steps button\n name: \"nextStepsClicked\",\n type: \"structured\",\n makePayload: () => ({\n category: \"quote_details_slider_next_step_cta\",\n action: \"link_click\",\n label: \"Next steps\",\n }),\n },\n {\n // Toggle deductibles accordion\n name: \"deductiblesClicked\",\n type: \"structured\",\n makePayload: () => ({\n category: \"us-qcp-react\",\n action: \"view_deductables_clicked\",\n label: \"view_deductables_clicked\",\n property: window.location.href,\n }),\n },\n {\n name: \"deductiblesClickedUk\",\n type: \"structured\",\n makePayload: params => {\n const { label, deviceType } = params as ParamsType;\n const urlFriendlyLabel = label.replace(/ /g, \"-\").toLowerCase();\n\n return {\n category: `uk-qcp-react-${deviceType}-${urlFriendlyLabel}-view-excess-toggle`,\n action: \"view_excess_clicked\",\n label,\n property: window.location.href,\n };\n },\n },\n {\n // Quote Details Slider opened\n name: \"sliderOpened\",\n type: \"structured\",\n makePayload: params => {\n const { label } = params as ParamsType;\n\n return {\n category: \"comparison_cta\",\n action: \"quote_details_slider_opened\",\n label,\n };\n },\n },\n {\n // Coverage modal opened\n name: \"coverageModalOpened\",\n type: \"structured\",\n makePayload: params => {\n const {\n category,\n product = \"extra_coverage\",\n title,\n } = params as ParamsType;\n const productLabel = snakeCase(product);\n\n return {\n category,\n action: `${productLabel}_${snakeCase(title)}_popup_opened`,\n label: productLabel,\n property: window.location.href,\n };\n },\n },\n {\n // Toggle cover select\n name: \"coverChanged\",\n type: \"unstructured\",\n makePayload: params => {\n const { name = \"\", fromValue = \"\", toValue = \"\" } = params as ParamsType;\n // Derive data\n let action = \"change\";\n\n // This logic is taken directly from Chopin without documentation:\n // If a cover has zero value, then change the action to add or remove\n if (fromValue === \"0\") {\n action = \"add\";\n }\n if (toValue === \"0\") {\n action = \"remove\";\n }\n\n return {\n schema:\n \"iglu:com.simplybusiness/comparison_page_cover_changed/jsonschema/1-0-0\",\n data: {\n name,\n action,\n from_value: fromValue,\n to_value: toValue,\n },\n };\n },\n },\n {\n name: \"ratingsModalOpened\",\n type: \"structured\",\n makePayload: params => {\n const { category, label } = params as ParamsType;\n\n return {\n category,\n action: \"insurer_rating_help_popup_triggered\",\n label,\n property: window.location.href,\n };\n },\n },\n {\n name: \"coverToggleOpened\",\n type: \"structured\",\n makePayload: () => ({\n category: \"qcp_limit_interaction\",\n label: \"limit_interaction\",\n action: \"limit_interaction_clicked\",\n property: window.location.href,\n }),\n },\n {\n name: \"paymentToggleClicked\",\n type: \"structured\",\n makePayload: params => {\n const { category, label } = params as ParamsType;\n\n return {\n category,\n action: \"button_click\",\n label,\n property: window.location.href,\n };\n },\n },\n {\n name: \"insurerDetailsAccordionClicked\",\n type: \"structured\",\n makePayload: () => ({\n category: \"quote_details_slider_insurer_details_description\",\n action: \"accordion_clicked\",\n label: \"accordion_clicked\",\n property: window.location.href,\n }),\n },\n {\n name: \"priceDetailsPopUpOpened\",\n type: \"structured\",\n makePayload: () => ({\n category: \"price_details\",\n action: \"price_details_popup_opened\",\n label: \"Price details\",\n property: window.location.href,\n }),\n },\n {\n name: \"editLimitButtonClicked\",\n type: \"structured\",\n makePayload: () => ({\n category: \"cover_limit_changes\",\n action: \"edit_limit_button_clicked\",\n label: \"Edit Limit\",\n property: window.location.href,\n }),\n },\n {\n name: \"applyButtonClicked\",\n type: \"structured\",\n makePayload: () => ({\n category: \"cover_limit_changes\",\n action: \"apply_button_clicked\",\n label: \"Apply Button Clicked\",\n property: window.location.href,\n }),\n },\n {\n name: \"coverageInfoClicked\",\n type: \"structured\",\n makePayload: params => {\n const { deviceType } = params as ParamsType;\n\n return {\n action: \"show_coverage_info_clicked\",\n category: `uk-qcp-react-${deviceType}-show-coverage-info-toggle`,\n label: \"show_coverage_info_clicked\",\n property: window.location.href,\n };\n },\n },\n];\n"],"names":["qcpEventDefinitions","name","type","makePayload","category","action","label","property","window","location","href","params","deviceType","urlFriendlyLabel","replace","toLowerCase","product","title","productLabel","snakeCase","fromValue","toValue","schema","data","from_value","to_value"],"mappings":";;;;+BAqBaA;;;eAAAA;;;uBArBa;AAqBnB,MAAMA,sBAAyC;IACpD;QACE,qBAAqB;QACrBC,MAAM;QACNC,MAAM;QACNC,aAAa,IAAO,CAAA;gBAClBC,UAAU;gBACVC,QAAQ;gBACRC,OAAO;YACT,CAAA;IACF;IACA;QACE,aAAa;QACbL,MAAM;QACNC,MAAM;QACNC,aAAa,IAAO,CAAA;gBAClBC,UAAU;gBACVC,QAAQ;gBACRC,OAAO;YACT,CAAA;IACF;IACA;QACE,yCAAyC;QACzCL,MAAM;QACNC,MAAM;QACNC,aAAa,IAAO,CAAA;gBAClBC,UAAU;gBAC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,CAAA;IACF;IACA;QACET,MAAM;QACNC,MAAM;QACNC,aAAa,IAAO,CAAA;gBAClBC,UAAU;gBACVC,QAAQ;gBACRC,OAAO;gBACPC,UAAUC,OAAOC,QAAQ,CAACC,IAAI;YAChC,CAAA;IACF;IACA;QACET,MAAM;QACNC,MAAM;QACNC,aAAaQ,CAAAA;YACX,MAAM,EAAEC,UAAU,EAAE,GAAGD;YAEvB,OAAO;gBACLN,QAAQ;gBACRD,UAAU,CAAC,aAAa,EAAEQ,WAAW,0BAA0B,CAAC;gBAChEN,OAAO;gBACPC,UAAUC,OAAOC,QAAQ,CAACC,IAAI;YAChC;QACF;IACF;CACD"}
1
+ {"version":3,"sources":["../../../../src/snowplow/event-definitions/qcp.ts"],"sourcesContent":["import { snakeCase } from \"../../utils\";\nimport { EventDefinition, ParamsType } from \"../types\";\n\n/**\n * Event definitions for Snowplow\n * @type {EventDefinition[]}\n * @property {string} name - The name of the event, to use when triggering\n * @property {string} type - The type of the event (structured | unstructured)\n * @property {makePayload} makePayload\n * - Function that creates the payload for the event;\n * - Allows optional params object to be passed in\n *\n * @example\n * import { Snowplow } from \"./Snowplow\";\n * import { eventDefinitions } from \"./event-definitions\";\n *\n * const snowplow = new Snowplow();\n * snowplow.addEventHandlers(eventDefinitions);\n */\n\n// QCP page events\nexport const qcpEventDefinitions: EventDefinition[] = [\n {\n // QDP details button\n name: \"detailsClicked\",\n type: \"structured\",\n makePayload: () => ({\n category: \"comparison_cta\",\n action: \"link_click\",\n label: \"Details\",\n }),\n },\n {\n // Buy button\n name: \"selectClicked\",\n type: \"structured\",\n makePayload: () => ({\n category: \"comparison_cta\",\n action: \"link_click\",\n label: \"Select\",\n }),\n },\n {\n // Quote Details Slider Next steps button\n name: \"nextStepsClicked\",\n type: \"structured\",\n makePayload: () => ({\n category: \"quote_details_slider_next_step_cta\",\n action: \"link_click\",\n label: \"Next steps\",\n }),\n },\n {\n // Toggle deductibles accordion\n name: \"deductiblesClicked\",\n type: \"structured\",\n makePayload: () => ({\n category: \"us-qcp-react\",\n action: \"view_deductables_clicked\",\n label: \"view_deductables_clicked\",\n property: window.location.href,\n }),\n },\n {\n name: \"deductiblesClickedUk\",\n type: \"structured\",\n makePayload: params => {\n const { label, deviceType } = params as ParamsType;\n const urlFriendlyLabel = label.replace(/ /g, \"-\").toLowerCase();\n\n return {\n category: `uk-qcp-react-${deviceType}-${urlFriendlyLabel}-view-excess-toggle`,\n action: \"view_excess_clicked\",\n label,\n property: window.location.href,\n };\n },\n },\n {\n // Quote Details Slider opened\n name: \"sliderOpened\",\n type: \"structured\",\n makePayload: params => {\n const { label } = params as ParamsType;\n\n return {\n category: \"comparison_cta\",\n action: \"quote_details_slider_opened\",\n label,\n };\n },\n },\n {\n // Coverage modal opened\n name: \"coverageModalOpened\",\n type: \"structured\",\n makePayload: params => {\n const {\n category,\n product = \"extra_coverage\",\n title,\n } = params as ParamsType;\n const productLabel = snakeCase(product);\n\n return {\n category,\n action: `${productLabel}_${snakeCase(title)}_popup_opened`,\n label: productLabel,\n property: window.location.href,\n };\n },\n },\n {\n // Toggle cover select\n name: \"coverChanged\",\n type: \"unstructured\",\n makePayload: params => {\n const { name = \"\", fromValue = \"\", toValue = \"\" } = params as ParamsType;\n // Derive data\n let action = \"change\";\n\n // This logic is taken directly from Chopin without documentation:\n // If a cover has zero value, then change the action to add or remove\n if (fromValue === \"0\") {\n action = \"add\";\n }\n if (toValue === \"0\") {\n action = \"remove\";\n }\n\n return {\n schema:\n \"iglu:com.simplybusiness/comparison_page_cover_changed/jsonschema/1-0-0\",\n data: {\n name,\n action,\n from_value: fromValue,\n to_value: toValue,\n },\n };\n },\n },\n {\n name: \"ratingsModalOpened\",\n type: \"structured\",\n makePayload: params => {\n const { category, label } = params as ParamsType;\n\n return {\n category,\n action: \"insurer_rating_help_popup_triggered\",\n label,\n property: window.location.href,\n };\n },\n },\n {\n name: \"coverToggleOpened\",\n type: \"structured\",\n makePayload: () => ({\n category: \"qcp_limit_interaction\",\n label: \"limit_interaction\",\n action: \"limit_interaction_clicked\",\n property: window.location.href,\n }),\n },\n {\n name: \"paymentToggleClicked\",\n type: \"structured\",\n makePayload: params => {\n const { category, label } = params as ParamsType;\n\n return {\n category,\n action: \"button_click\",\n label,\n property: window.location.href,\n };\n },\n },\n {\n name: \"insurerDetailsAccordionClicked\",\n type: \"structured\",\n makePayload: () => ({\n category: \"quote_details_slider_insurer_details_description\",\n action: \"accordion_clicked\",\n label: \"accordion_clicked\",\n property: window.location.href,\n }),\n },\n {\n name: \"priceDetailsPopUpOpened\",\n type: \"structured\",\n makePayload: () => ({\n category: \"price_details\",\n action: \"price_details_popup_opened\",\n label: \"Price details\",\n property: window.location.href,\n }),\n },\n {\n name: \"editLimitButtonClicked\",\n type: \"structured\",\n makePayload: () => ({\n category: \"cover_limit_changes\",\n action: \"edit_limit_button_clicked\",\n label: \"Edit Limit\",\n property: window.location.href,\n }),\n },\n {\n name: \"applyButtonClicked\",\n type: \"structured\",\n makePayload: () => ({\n category: \"cover_limit_changes\",\n action: \"apply_button_clicked\",\n label: \"Apply Button Clicked\",\n property: window.location.href,\n }),\n },\n {\n name: \"coverageInfoClicked\",\n type: \"structured\",\n makePayload: params => {\n const { deviceType } = params as ParamsType;\n\n return {\n action: \"show_coverage_info_clicked\",\n category: `uk-qcp-react-${deviceType}-show-coverage-info-toggle`,\n label: \"show_coverage_info_clicked\",\n property: window.location.href,\n };\n },\n },\n {\n name: \"backToApplication\",\n type: \"unstructured\",\n makePayload: params => {\n const { journeyId, vertical } = params as ParamsType;\n\n return {\n schema: \"iglu:com.simplybusiness/back_to_application/jsonschema/1-0-0\",\n data: {\n journey_id: journeyId,\n vertical,\n },\n };\n },\n },\n];\n"],"names":["qcpEventDefinitions","name","type","makePayload","category","action","label","property","window","location","href","params","deviceType","urlFriendlyLabel","replace","toLowerCase","product","title","productLabel","snakeCase","fromValue","toValue","schema","data","from_value","to_value","journeyId","vertical","journey_id"],"mappings":";;;;+BAqBaA;;;eAAAA;;;uB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gBACRC,OAAO;gBACPC,UAAUC,OAAOC,QAAQ,CAACC,IAAI;YAChC,CAAA;IACF;IACA;QACET,MAAM;QACNC,MAAM;QACNC,aAAa,IAAO,CAAA;gBAClBC,UAAU;gBACVC,QAAQ;gBACRC,OAAO;gBACPC,UAAUC,OAAOC,QAAQ,CAACC,IAAI;YAChC,CAAA;IACF;IACA;QACET,MAAM;QACNC,MAAM;QACNC,aAAa,IAAO,CAAA;gBAClBC,UAAU;gBACVC,QAAQ;gBACRC,OAAO;gBACPC,UAAUC,OAAOC,QAAQ,CAACC,IAAI;YAChC,CAAA;IACF;IACA;QACET,MAAM;QACNC,MAAM;QACNC,aAAa,IAAO,CAAA;gBAClBC,UAAU;gBACVC,QAAQ;gBACRC,OAAO;gBACPC,UAAUC,OAAOC,QAAQ,CAACC,IAAI;YAChC,CAAA;IACF;IACA;QACET,MAAM;QACNC,MAAM;QACNC,aAAaQ,CAAAA;YACX,MAAM,EAAEC,UAAU,EAAE,GAAGD;YAEvB,OAAO;gBACLN,QAAQ;gBACRD,UAAU,CAAC,aAAa,EAAEQ,WAAW,0BAA0B,CAAC;gBAChEN,OAAO;gBACPC,UAAUC,OAAOC,QAAQ,CAACC,IAAI;YAChC;QACF;IACF;IACA;QACET,MAAM;QACNC,MAAM;QACNC,aAAaQ,CAAAA;YACX,MAAM,EAAEe,SAAS,EAAEC,QAAQ,EAAE,GAAGhB;YAEhC,OAAO;gBACLW,QAAQ;gBACRC,MAAM;oBACJK,YAAYF;oBACZC;gBACF;YACF;QACF;IACF;CACD"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "thankYouEventDefinitions", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return thankYouEventDefinitions;
9
+ }
10
+ });
11
+ const thankYouEventDefinitions = [
12
+ {
13
+ name: "nextCoverageClicked",
14
+ type: "structured",
15
+ makePayload: (params)=>{
16
+ const { url } = params;
17
+ const eventName = "post_referral_workers_compensation_continuation_link";
18
+ return {
19
+ category: eventName,
20
+ action: "link_click",
21
+ label: eventName,
22
+ property: url
23
+ };
24
+ }
25
+ }
26
+ ];
27
+
28
+ //# sourceMappingURL=thankYou.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/snowplow/event-definitions/thankYou.ts"],"sourcesContent":["import { EventDefinition, ParamsType } from \"../types\";\n\n// ThankYou page events\nexport const thankYouEventDefinitions: EventDefinition[] = [\n {\n name: \"nextCoverageClicked\",\n type: \"structured\",\n makePayload: params => {\n const { url } = params as ParamsType;\n const eventName = \"post_referral_workers_compensation_continuation_link\";\n\n return {\n category: eventName,\n action: \"link_click\",\n label: eventName,\n property: url,\n };\n },\n },\n];\n"],"names":["thankYouEventDefinitions","name","type","makePayload","params","url","eventName","category","action","label","property"],"mappings":";;;;+BAGaA;;;eAAAA;;;AAAN,MAAMA,2BAA8C;IACzD;QACEC,MAAM;QACNC,MAAM;QACNC,aAAaC,CAAAA;YACX,MAAM,EAAEC,GAAG,EAAE,GAAGD;YAChB,MAAME,YAAY;YAElB,OAAO;gBACLC,UAAUD;gBACVE,QAAQ;gBACRC,OAAOH;gBACPI,UAAUL;YACZ;QACF;IACF;CACD"}
@@ -1,13 +1,19 @@
1
1
  import { baseEventDefinitions } from "./base";
2
2
  import { qcpEventDefinitions } from "./qcp";
3
+ import { thankYouEventDefinitions } from "./thankYou";
3
4
  // All events (keep up to date with new files)
4
5
  export const eventDefinitions = [
5
6
  ...baseEventDefinitions,
6
- ...qcpEventDefinitions
7
+ ...qcpEventDefinitions,
8
+ ...thankYouEventDefinitions
7
9
  ];
8
10
  export const qcpPageEvents = [
9
11
  ...baseEventDefinitions,
10
12
  ...qcpEventDefinitions
13
+ ];
14
+ export const thankYouPageEvents = [
15
+ ...baseEventDefinitions,
16
+ ...thankYouEventDefinitions
11
17
  ]; // Create a new export for each kind of page below
12
18
  // containing just the subset needed for that page
13
19
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/snowplow/event-definitions/index.ts"],"sourcesContent":["import { baseEventDefinitions } from \"./base\";\nimport { qcpEventDefinitions } from \"./qcp\";\n\n// All events (keep up to date with new files)\nexport const eventDefinitions = [\n ...baseEventDefinitions,\n ...qcpEventDefinitions,\n];\n\nexport const qcpPageEvents = [...baseEventDefinitions, ...qcpEventDefinitions];\n\n// Create a new export for each kind of page below\n// containing just the subset needed for that page\n"],"names":["baseEventDefinitions","qcpEventDefinitions","eventDefinitions","qcpPageEvents"],"mappings":"AAAA,SAASA,oBAAoB,QAAQ,SAAS;AAC9C,SAASC,mBAAmB,QAAQ,QAAQ;AAE5C,8CAA8C;AAC9C,OAAO,MAAMC,mBAAmB;OAC3BF;OACAC;CACJ,CAAC;AAEF,OAAO,MAAME,gBAAgB;OAAIH;OAAyBC;CAAoB,CAAC,CAE/E,kDAAkD;CAClD,kDAAkD"}
1
+ {"version":3,"sources":["../../../../src/snowplow/event-definitions/index.ts"],"sourcesContent":["import { baseEventDefinitions } from \"./base\";\nimport { qcpEventDefinitions } from \"./qcp\";\nimport { thankYouEventDefinitions } from \"./thankYou\";\n\n// All events (keep up to date with new files)\nexport const eventDefinitions = [\n ...baseEventDefinitions,\n ...qcpEventDefinitions,\n ...thankYouEventDefinitions,\n];\n\nexport const qcpPageEvents = [...baseEventDefinitions, ...qcpEventDefinitions];\n\nexport const thankYouPageEvents = [\n ...baseEventDefinitions,\n ...thankYouEventDefinitions,\n];\n\n// Create a new export for each kind of page below\n// containing just the subset needed for that page\n"],"names":["baseEventDefinitions","qcpEventDefinitions","thankYouEventDefinitions","eventDefinitions","qcpPageEvents","thankYouPageEvents"],"mappings":"AAAA,SAASA,oBAAoB,QAAQ,SAAS;AAC9C,SAASC,mBAAmB,QAAQ,QAAQ;AAC5C,SAASC,wBAAwB,QAAQ,aAAa;AAEtD,8CAA8C;AAC9C,OAAO,MAAMC,mBAAmB;OAC3BH;OACAC;OACAC;CACJ,CAAC;AAEF,OAAO,MAAME,gBAAgB;OAAIJ;OAAyBC;CAAoB,CAAC;AAE/E,OAAO,MAAMI,qBAAqB;OAC7BL;OACAE;CACJ,CAAC,CAEF,kDAAkD;CAClD,kDAAkD"}
@@ -214,6 +214,20 @@ export const qcpEventDefinitions = [
214
214
  property: window.location.href
215
215
  };
216
216
  }
217
+ },
218
+ {
219
+ name: "backToApplication",
220
+ type: "unstructured",
221
+ makePayload: (params)=>{
222
+ const { journeyId, vertical } = params;
223
+ return {
224
+ schema: "iglu:com.simplybusiness/back_to_application/jsonschema/1-0-0",
225
+ data: {
226
+ journey_id: journeyId,
227
+ vertical
228
+ }
229
+ };
230
+ }
217
231
  }
218
232
  ];
219
233
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/snowplow/event-definitions/qcp.ts"],"sourcesContent":["import { snakeCase } from \"../../utils\";\nimport { EventDefinition, ParamsType } from \"../types\";\n\n/**\n * Event definitions for Snowplow\n * @type {EventDefinition[]}\n * @property {string} name - The name of the event, to use when triggering\n * @property {string} type - The type of the event (structured | unstructured)\n * @property {makePayload} makePayload\n * - Function that creates the payload for the event;\n * - Allows optional params object to be passed in\n *\n * @example\n * import { Snowplow } from \"./Snowplow\";\n * import { eventDefinitions } from \"./event-definitions\";\n *\n * const snowplow = new Snowplow();\n * snowplow.addEventHandlers(eventDefinitions);\n */\n\n// QCP page events\nexport const qcpEventDefinitions: EventDefinition[] = [\n {\n // QDP details button\n name: \"detailsClicked\",\n type: \"structured\",\n makePayload: () => ({\n category: \"comparison_cta\",\n action: \"link_click\",\n label: \"Details\",\n }),\n },\n {\n // Buy button\n name: \"selectClicked\",\n type: \"structured\",\n makePayload: () => ({\n category: \"comparison_cta\",\n action: \"link_click\",\n label: \"Select\",\n }),\n },\n {\n // Quote Details Slider Next steps button\n name: \"nextStepsClicked\",\n type: \"structured\",\n makePayload: () => ({\n category: \"quote_details_slider_next_step_cta\",\n action: \"link_click\",\n label: \"Next steps\",\n }),\n },\n {\n // Toggle deductibles accordion\n name: \"deductiblesClicked\",\n type: \"structured\",\n makePayload: () => ({\n category: \"us-qcp-react\",\n action: \"view_deductables_clicked\",\n label: \"view_deductables_clicked\",\n property: window.location.href,\n }),\n },\n {\n name: \"deductiblesClickedUk\",\n type: \"structured\",\n makePayload: params => {\n const { label, deviceType } = params as ParamsType;\n const urlFriendlyLabel = label.replace(/ /g, \"-\").toLowerCase();\n\n return {\n category: `uk-qcp-react-${deviceType}-${urlFriendlyLabel}-view-excess-toggle`,\n action: \"view_excess_clicked\",\n label,\n property: window.location.href,\n };\n },\n },\n {\n // Quote Details Slider opened\n name: \"sliderOpened\",\n type: \"structured\",\n makePayload: params => {\n const { label } = params as ParamsType;\n\n return {\n category: \"comparison_cta\",\n action: \"quote_details_slider_opened\",\n label,\n };\n },\n },\n {\n // Coverage modal opened\n name: \"coverageModalOpened\",\n type: \"structured\",\n makePayload: params => {\n const {\n category,\n product = \"extra_coverage\",\n title,\n } = params as ParamsType;\n const productLabel = snakeCase(product);\n\n return {\n category,\n action: `${productLabel}_${snakeCase(title)}_popup_opened`,\n label: productLabel,\n property: window.location.href,\n };\n },\n },\n {\n // Toggle cover select\n name: \"coverChanged\",\n type: \"unstructured\",\n makePayload: params => {\n const { name = \"\", fromValue = \"\", toValue = \"\" } = params as ParamsType;\n // Derive data\n let action = \"change\";\n\n // This logic is taken directly from Chopin without documentation:\n // If a cover has zero value, then change the action to add or remove\n if (fromValue === \"0\") {\n action = \"add\";\n }\n if (toValue === \"0\") {\n action = \"remove\";\n }\n\n return {\n schema:\n \"iglu:com.simplybusiness/comparison_page_cover_changed/jsonschema/1-0-0\",\n data: {\n name,\n action,\n from_value: fromValue,\n to_value: toValue,\n },\n };\n },\n },\n {\n name: \"ratingsModalOpened\",\n type: \"structured\",\n makePayload: params => {\n const { category, label } = params as ParamsType;\n\n return {\n category,\n action: \"insurer_rating_help_popup_triggered\",\n label,\n property: window.location.href,\n };\n },\n },\n {\n name: \"coverToggleOpened\",\n type: \"structured\",\n makePayload: () => ({\n category: \"qcp_limit_interaction\",\n label: \"limit_interaction\",\n action: \"limit_interaction_clicked\",\n property: window.location.href,\n }),\n },\n {\n name: \"paymentToggleClicked\",\n type: \"structured\",\n makePayload: params => {\n const { category, label } = params as ParamsType;\n\n return {\n category,\n action: \"button_click\",\n label,\n property: window.location.href,\n };\n },\n },\n {\n name: \"insurerDetailsAccordionClicked\",\n type: \"structured\",\n makePayload: () => ({\n category: \"quote_details_slider_insurer_details_description\",\n action: \"accordion_clicked\",\n label: \"accordion_clicked\",\n property: window.location.href,\n }),\n },\n {\n name: \"priceDetailsPopUpOpened\",\n type: \"structured\",\n makePayload: () => ({\n category: \"price_details\",\n action: \"price_details_popup_opened\",\n label: \"Price details\",\n property: window.location.href,\n }),\n },\n {\n name: \"editLimitButtonClicked\",\n type: \"structured\",\n makePayload: () => ({\n category: \"cover_limit_changes\",\n action: \"edit_limit_button_clicked\",\n label: \"Edit Limit\",\n property: window.location.href,\n }),\n },\n {\n name: \"applyButtonClicked\",\n type: \"structured\",\n makePayload: () => ({\n category: \"cover_limit_changes\",\n action: \"apply_button_clicked\",\n label: \"Apply Button Clicked\",\n property: window.location.href,\n }),\n },\n {\n name: \"coverageInfoClicked\",\n type: \"structured\",\n makePayload: params => {\n const { deviceType } = params as ParamsType;\n\n return {\n action: \"show_coverage_info_clicked\",\n category: `uk-qcp-react-${deviceType}-show-coverage-info-toggle`,\n label: \"show_coverage_info_clicked\",\n property: window.location.href,\n };\n },\n },\n];\n"],"names":["snakeCase","qcpEventDefinitions","name","type","makePayload","category","action","label","property","window","location","href","params","deviceType","urlFriendlyLabel","replace","toLowerCase","product","title","productLabel","fromValue","toValue","schema","data","from_value","to_value"],"mappings":"AAAA,SAASA,SAAS,QAAQ,cAAc;AAGxC;;;;;;;;;;;;;;;CAeC,GAED,kBAAkB;AAClB,OAAO,MAAMC,sBAAyC;IACpD;QACE,qBAAqB;QACrBC,MAAM;QACNC,MAAM;QACNC,aAAa,IAAO,CAAA;gBAClBC,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UAAU;gBACVC,QAAQ;gBACRC,OAAO;gBACPC,UAAUC,OAAOC,QAAQ,CAACC,IAAI;YAChC,CAAA;IACF;IACA;QACET,MAAM;QACNC,MAAM;QACNC,aAAa,IAAO,CAAA;gBAClBC,UAAU;gBACVC,QAAQ;gBACRC,OAAO;gBACPC,UAAUC,OAAOC,QAAQ,CAACC,IAAI;YAChC,CAAA;IACF;IACA;QACET,MAAM;QACNC,MAAM;QACNC,aAAa,IAAO,CAAA;gBAClBC,UAAU;gBACVC,QAAQ;gBACRC,OAAO;gBACPC,UAAUC,OAAOC,QAAQ,CAACC,IAAI;YAChC,CAAA;IACF;IACA;QACET,MAAM;QACNC,MAAM;QACNC,aAAaQ,CAAAA;YACX,MAAM,EAAEC,UAAU,EAAE,GAAGD;YAEvB,OAAO;gBACLN,QAAQ;gBACRD,UAAU,CAAC,aAAa,EAAEQ,WAAW,0BAA0B,CAAC;gBAChEN,OAAO;gBACPC,UAAUC,OAAOC,QAAQ,CAACC,IAAI;YAChC;QACF;IACF;CACD,CAAC"}
1
+ {"version":3,"sources":["../../../../src/snowplow/event-definitions/qcp.ts"],"sourcesContent":["import { snakeCase } from \"../../utils\";\nimport { EventDefinition, ParamsType } from \"../types\";\n\n/**\n * Event definitions for Snowplow\n * @type {EventDefinition[]}\n * @property {string} name - The name of the event, to use when triggering\n * @property {string} type - The type of the event (structured | unstructured)\n * @property {makePayload} makePayload\n * - Function that creates the payload for the event;\n * - Allows optional params object to be passed in\n *\n * @example\n * import { Snowplow } from \"./Snowplow\";\n * import { eventDefinitions } from \"./event-definitions\";\n *\n * const snowplow = new Snowplow();\n * snowplow.addEventHandlers(eventDefinitions);\n */\n\n// QCP page events\nexport const qcpEventDefinitions: EventDefinition[] = [\n {\n // QDP details button\n name: \"detailsClicked\",\n type: \"structured\",\n makePayload: () => ({\n category: \"comparison_cta\",\n action: \"link_click\",\n label: \"Details\",\n }),\n },\n {\n // Buy button\n name: \"selectClicked\",\n type: \"structured\",\n makePayload: () => ({\n category: \"comparison_cta\",\n action: \"link_click\",\n label: \"Select\",\n }),\n },\n {\n // Quote Details Slider Next steps button\n name: \"nextStepsClicked\",\n type: \"structured\",\n makePayload: () => ({\n category: \"quote_details_slider_next_step_cta\",\n action: \"link_click\",\n label: \"Next steps\",\n }),\n },\n {\n // Toggle deductibles accordion\n name: \"deductiblesClicked\",\n type: \"structured\",\n makePayload: () => ({\n category: \"us-qcp-react\",\n action: \"view_deductables_clicked\",\n label: \"view_deductables_clicked\",\n property: window.location.href,\n }),\n },\n {\n name: \"deductiblesClickedUk\",\n type: \"structured\",\n makePayload: params => {\n const { label, deviceType } = params as ParamsType;\n const urlFriendlyLabel = label.replace(/ /g, \"-\").toLowerCase();\n\n return {\n category: `uk-qcp-react-${deviceType}-${urlFriendlyLabel}-view-excess-toggle`,\n action: \"view_excess_clicked\",\n label,\n property: window.location.href,\n };\n },\n },\n {\n // Quote Details Slider opened\n name: \"sliderOpened\",\n type: \"structured\",\n makePayload: params => {\n const { label } = params as ParamsType;\n\n return {\n category: \"comparison_cta\",\n action: \"quote_details_slider_opened\",\n label,\n };\n },\n },\n {\n // Coverage modal opened\n name: \"coverageModalOpened\",\n type: \"structured\",\n makePayload: params => {\n const {\n category,\n product = \"extra_coverage\",\n title,\n } = params as ParamsType;\n const productLabel = snakeCase(product);\n\n return {\n category,\n action: `${productLabel}_${snakeCase(title)}_popup_opened`,\n label: productLabel,\n property: window.location.href,\n };\n },\n },\n {\n // Toggle cover select\n name: \"coverChanged\",\n type: \"unstructured\",\n makePayload: params => {\n const { name = \"\", fromValue = \"\", toValue = \"\" } = params as ParamsType;\n // Derive data\n let action = \"change\";\n\n // This logic is taken directly from Chopin without documentation:\n // If a cover has zero value, then change the action to add or remove\n if (fromValue === \"0\") {\n action = \"add\";\n }\n if (toValue === \"0\") {\n action = \"remove\";\n }\n\n return {\n schema:\n \"iglu:com.simplybusiness/comparison_page_cover_changed/jsonschema/1-0-0\",\n data: {\n name,\n action,\n from_value: fromValue,\n to_value: toValue,\n },\n };\n },\n },\n {\n name: \"ratingsModalOpened\",\n type: \"structured\",\n makePayload: params => {\n const { category, label } = params as ParamsType;\n\n return {\n category,\n action: \"insurer_rating_help_popup_triggered\",\n label,\n property: window.location.href,\n };\n },\n },\n {\n name: \"coverToggleOpened\",\n type: \"structured\",\n makePayload: () => ({\n category: \"qcp_limit_interaction\",\n label: \"limit_interaction\",\n action: \"limit_interaction_clicked\",\n property: window.location.href,\n }),\n },\n {\n name: \"paymentToggleClicked\",\n type: \"structured\",\n makePayload: params => {\n const { category, label } = params as ParamsType;\n\n return {\n category,\n action: \"button_click\",\n label,\n property: window.location.href,\n };\n },\n },\n {\n name: \"insurerDetailsAccordionClicked\",\n type: \"structured\",\n makePayload: () => ({\n category: \"quote_details_slider_insurer_details_description\",\n action: \"accordion_clicked\",\n label: \"accordion_clicked\",\n property: window.location.href,\n }),\n },\n {\n name: \"priceDetailsPopUpOpened\",\n type: \"structured\",\n makePayload: () => ({\n category: \"price_details\",\n action: \"price_details_popup_opened\",\n label: \"Price details\",\n property: window.location.href,\n }),\n },\n {\n name: \"editLimitButtonClicked\",\n type: \"structured\",\n makePayload: () => ({\n category: \"cover_limit_changes\",\n action: \"edit_limit_button_clicked\",\n label: \"Edit Limit\",\n property: window.location.href,\n }),\n },\n {\n name: \"applyButtonClicked\",\n type: \"structured\",\n makePayload: () => ({\n category: \"cover_limit_changes\",\n action: \"apply_button_clicked\",\n label: \"Apply Button Clicked\",\n property: window.location.href,\n }),\n },\n {\n name: \"coverageInfoClicked\",\n type: \"structured\",\n makePayload: params => {\n const { deviceType } = params as ParamsType;\n\n return {\n action: \"show_coverage_info_clicked\",\n category: `uk-qcp-react-${deviceType}-show-coverage-info-toggle`,\n label: \"show_coverage_info_clicked\",\n property: window.location.href,\n };\n },\n },\n {\n name: \"backToApplication\",\n type: \"unstructured\",\n makePayload: params => {\n const { journeyId, vertical } = params as ParamsType;\n\n return {\n schema: \"iglu:com.simplybusiness/back_to_application/jsonschema/1-0-0\",\n data: {\n journey_id: journeyId,\n vertical,\n },\n };\n },\n },\n];\n"],"names":["snakeCase","qcpEventDefinitions","name","type","makePayload","category","action","label","property","window","location","href","params","deviceType","urlFriendlyLabel","replace","toLowerCase","product","title","productLabel","fromValue","toValue","schema","data","from_value","to_value","journeyId","vertical","journey_id"],"mappings":"AAAA,SAASA,SAAS,QAAQ,cAAc;AAGxC;;;;;;;;;;;;;;;CAeC,GAED,kBAAkB;AAClB,OAAO,MAAMC,sBAAyC;IACpD;QACE,qBAAqB;QACrBC,MAAM;QACNC,MAAM;QACNC,aAAa,IAAO,CAAA;gBAClBC,UAAU;gBACVC,QAAQ;gBACRC,OAAO;YACT,CAAA;IACF;IACA;QACE,aAAa;QACbL,MAAM;QACNC,MAAM;QACNC,aAAa,IAAO,CAAA;gBAClBC,UAAU;gBACVC,QAAQ;gBACRC,OAAO;YACT,CAAA;IACF;IACA;QACE,yCAAyC;QACzCL,MAAM;QACNC,MAAM;QACNC,aAAa,IAAO,CAAA;gBAClBC,UAAU;gBACVC,QAAQ;gBACRC,OAAO;YACT,CAAA;IACF;IACA;QACE,+BAA+B;QAC/BL,MAAM;QACNC,MAAM;QACNC,aAAa,IAAO,CAAA;gBAClBC,UAAU;gBACVC,QAAQ;gBACRC,OAAO;gBACPC,UAAUC,OAAOC,QAAQ,CAACC,IAAI;YAChC,CAAA;IACF;IACA;QACET,MAAM;QACNC,MAAM;QACNC,aAAaQ,CAAAA;YACX,MAAM,EAAEL,KAAK,EAAEM,UAAU,EAAE,GAAGD;YAC9B,MAAME,mBAAmBP,MAAMQ,OAAO,CAAC,MAAM,KAAKC,WAAW;YAE7D,OAAO;gBACLX,UAAU,CAAC,aAAa,EAAEQ,WAAW,CAAC,EAAEC,iBAAiB,mBAAmB,CAAC;gBAC7ER,QAAQ;gBACRC;gBACAC,UAAUC,OAAOC,QAAQ,CAACC,IAAI;YAChC;QACF;IACF;IACA;QACE,8BAA8B;QAC9BT,MAAM;QACNC,MAAM;QAC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,19 @@
1
+ // ThankYou page events
2
+ export const thankYouEventDefinitions = [
3
+ {
4
+ name: "nextCoverageClicked",
5
+ type: "structured",
6
+ makePayload: (params)=>{
7
+ const { url } = params;
8
+ const eventName = "post_referral_workers_compensation_continuation_link";
9
+ return {
10
+ category: eventName,
11
+ action: "link_click",
12
+ label: eventName,
13
+ property: url
14
+ };
15
+ }
16
+ }
17
+ ];
18
+
19
+ //# sourceMappingURL=thankYou.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/snowplow/event-definitions/thankYou.ts"],"sourcesContent":["import { EventDefinition, ParamsType } from \"../types\";\n\n// ThankYou page events\nexport const thankYouEventDefinitions: EventDefinition[] = [\n {\n name: \"nextCoverageClicked\",\n type: \"structured\",\n makePayload: params => {\n const { url } = params as ParamsType;\n const eventName = \"post_referral_workers_compensation_continuation_link\";\n\n return {\n category: eventName,\n action: \"link_click\",\n label: eventName,\n property: url,\n };\n },\n },\n];\n"],"names":["thankYouEventDefinitions","name","type","makePayload","params","url","eventName","category","action","label","property"],"mappings":"AAEA,uBAAuB;AACvB,OAAO,MAAMA,2BAA8C;IACzD;QACEC,MAAM;QACNC,MAAM;QACNC,aAAaC,CAAAA;YACX,MAAM,EAAEC,GAAG,EAAE,GAAGD;YAChB,MAAME,YAAY;YAElB,OAAO;gBACLC,UAAUD;gBACVE,QAAQ;gBACRC,OAAOH;gBACPI,UAAUL;YACZ;QACF;IACF;CACD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/snowplow/types.ts"],"sourcesContent":["import {\n EventMethod,\n SelfDescribingJson,\n StructuredEvent,\n} from \"@snowplow/browser-tracker\";\n\ntype BaseConfig = {\n appId: string;\n avalancheCollector: string;\n eventMethod: EventMethod;\n trackPageView: boolean;\n includeGAContext: boolean;\n uid?: string;\n postPath?: string;\n};\n\nexport type EnvConfig = BaseConfig & {\n cookieDomain: Record<string, string>;\n};\n\nexport type TrackingProps = BaseConfig & {\n eventMethod: EventMethod;\n cookieDomain?: string;\n};\n\nexport type ChannelContext = {\n schema: string;\n data: Record<string, string | number>;\n};\n\nexport type ChannelContexts = Record<string, ChannelContext>;\n\nexport type ArrayOneOrMore<T> = [T, ...T[]];\n\nexport type ParamsType = Record<\n | \"label\"\n | \"deviceType\"\n | \"category\"\n | \"product\"\n | \"title\"\n | \"label\"\n | \"name\"\n | \"fromValue\"\n | \"toValue\",\n string\n>;\n\nexport type EventDefinition = {\n name: string;\n type: \"structured\" | \"unstructured\";\n makePayload: (\n params?: Record<string, unknown>,\n ) => StructuredEvent | SelfDescribingJson<Record<string, unknown>>;\n};\n\nexport interface PageDataProps\n extends Partial<\n Record<\n \"scripts\",\n Array<{\n metadata: { name: string };\n props?: Record<string, unknown>;\n }>\n >\n > {}\n"],"names":[],"mappings":"AAuDA,WASM"}
1
+ {"version":3,"sources":["../../../src/snowplow/types.ts"],"sourcesContent":["import {\n EventMethod,\n SelfDescribingJson,\n StructuredEvent,\n} from \"@snowplow/browser-tracker\";\n\ntype BaseConfig = {\n appId: string;\n avalancheCollector: string;\n eventMethod: EventMethod;\n trackPageView: boolean;\n includeGAContext: boolean;\n uid?: string;\n postPath?: string;\n};\n\nexport type EnvConfig = BaseConfig & {\n cookieDomain: Record<string, string>;\n};\n\nexport type TrackingProps = BaseConfig & {\n eventMethod: EventMethod;\n cookieDomain?: string;\n};\n\nexport type ChannelContext = {\n schema: string;\n data: Record<string, string | number>;\n};\n\nexport type ChannelContexts = Record<string, ChannelContext>;\n\nexport type ArrayOneOrMore<T> = [T, ...T[]];\n\nexport type ParamsType = Record<\n | \"label\"\n | \"deviceType\"\n | \"category\"\n | \"product\"\n | \"title\"\n | \"label\"\n | \"name\"\n | \"fromValue\"\n | \"toValue\"\n | \"url\"\n | \"journeyId\"\n | \"vertical\",\n string\n>;\n\nexport type EventDefinition = {\n name: string;\n type: \"structured\" | \"unstructured\";\n makePayload: (\n params?: Record<string, unknown>,\n ) => StructuredEvent | SelfDescribingJson<Record<string, unknown>>;\n};\n\nexport interface PageDataProps\n extends Partial<\n Record<\n \"scripts\",\n Array<{\n metadata: { name: string };\n props?: Record<string, unknown>;\n }>\n >\n > {}\n"],"names":[],"mappings":"AA0DA,WASM"}
@@ -1,2 +1,3 @@
1
1
  export declare const eventDefinitions: import("..").EventDefinition[];
2
2
  export declare const qcpPageEvents: import("..").EventDefinition[];
3
+ export declare const thankYouPageEvents: import("..").EventDefinition[];
@@ -0,0 +1,2 @@
1
+ import { EventDefinition } from "../types";
2
+ export declare const thankYouEventDefinitions: EventDefinition[];
@@ -21,7 +21,7 @@ export type ChannelContext = {
21
21
  };
22
22
  export type ChannelContexts = Record<string, ChannelContext>;
23
23
  export type ArrayOneOrMore<T> = [T, ...T[]];
24
- export type ParamsType = Record<"label" | "deviceType" | "category" | "product" | "title" | "label" | "name" | "fromValue" | "toValue", string>;
24
+ export type ParamsType = Record<"label" | "deviceType" | "category" | "product" | "title" | "label" | "name" | "fromValue" | "toValue" | "url" | "journeyId" | "vertical", string>;
25
25
  export type EventDefinition = {
26
26
  name: string;
27
27
  type: "structured" | "unstructured";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@simplybusiness/services",
3
3
  "license": "UNLICENSED",
4
- "version": "0.1.5",
4
+ "version": "0.2.0",
5
5
  "description": "Internal library for services",
6
6
  "repository": {
7
7
  "type": "git",
@@ -76,7 +76,7 @@
76
76
  },
77
77
  "dependencies": {
78
78
  "@airbrake/browser": "^2.1.8",
79
- "@simplybusiness/mobius": "^4.14.1",
79
+ "@simplybusiness/mobius": "^4.15.0",
80
80
  "@snowplow/browser-tracker": "^3.24.2",
81
81
  "classnames": "^2.5.1"
82
82
  },
@@ -1,13 +1,20 @@
1
1
  import { baseEventDefinitions } from "./base";
2
2
  import { qcpEventDefinitions } from "./qcp";
3
+ import { thankYouEventDefinitions } from "./thankYou";
3
4
 
4
5
  // All events (keep up to date with new files)
5
6
  export const eventDefinitions = [
6
7
  ...baseEventDefinitions,
7
8
  ...qcpEventDefinitions,
9
+ ...thankYouEventDefinitions,
8
10
  ];
9
11
 
10
12
  export const qcpPageEvents = [...baseEventDefinitions, ...qcpEventDefinitions];
11
13
 
14
+ export const thankYouPageEvents = [
15
+ ...baseEventDefinitions,
16
+ ...thankYouEventDefinitions,
17
+ ];
18
+
12
19
  // Create a new export for each kind of page below
13
20
  // containing just the subset needed for that page
@@ -232,4 +232,19 @@ export const qcpEventDefinitions: EventDefinition[] = [
232
232
  };
233
233
  },
234
234
  },
235
+ {
236
+ name: "backToApplication",
237
+ type: "unstructured",
238
+ makePayload: params => {
239
+ const { journeyId, vertical } = params as ParamsType;
240
+
241
+ return {
242
+ schema: "iglu:com.simplybusiness/back_to_application/jsonschema/1-0-0",
243
+ data: {
244
+ journey_id: journeyId,
245
+ vertical,
246
+ },
247
+ };
248
+ },
249
+ },
235
250
  ];
@@ -0,0 +1,20 @@
1
+ import { EventDefinition, ParamsType } from "../types";
2
+
3
+ // ThankYou page events
4
+ export const thankYouEventDefinitions: EventDefinition[] = [
5
+ {
6
+ name: "nextCoverageClicked",
7
+ type: "structured",
8
+ makePayload: params => {
9
+ const { url } = params as ParamsType;
10
+ const eventName = "post_referral_workers_compensation_continuation_link";
11
+
12
+ return {
13
+ category: eventName,
14
+ action: "link_click",
15
+ label: eventName,
16
+ property: url,
17
+ };
18
+ },
19
+ },
20
+ ];
@@ -41,7 +41,10 @@ export type ParamsType = Record<
41
41
  | "label"
42
42
  | "name"
43
43
  | "fromValue"
44
- | "toValue",
44
+ | "toValue"
45
+ | "url"
46
+ | "journeyId"
47
+ | "vertical",
45
48
  string
46
49
  >;
47
50