@simplybusiness/services 0.21.5 → 0.22.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 +21 -0
- package/dist/cjs/index.js +1198 -17
- package/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/esm/index.js +1193 -4
- package/package.json +7 -6
- package/src/snowplow/event-definitions/intervention.ts +2 -2
- package/dist/cjs/address-lookup/index.js +0 -98
- package/dist/cjs/address-lookup/index.js.map +0 -1
- package/dist/cjs/address-lookup/types.js +0 -7
- package/dist/cjs/address-lookup/types.js.map +0 -1
- package/dist/cjs/airbrake/index.js +0 -45
- package/dist/cjs/airbrake/index.js.map +0 -1
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/mocks/eventDefinitions.js +0 -90
- package/dist/cjs/mocks/eventDefinitions.js.map +0 -1
- package/dist/cjs/mocks/scripts-mock.js +0 -59
- package/dist/cjs/mocks/scripts-mock.js.map +0 -1
- package/dist/cjs/mocks/snowplowBrowserTrackerMock.js +0 -7
- package/dist/cjs/mocks/snowplowBrowserTrackerMock.js.map +0 -1
- package/dist/cjs/snowplow/Snowplow.js +0 -174
- package/dist/cjs/snowplow/Snowplow.js.map +0 -1
- package/dist/cjs/snowplow/SnowplowContext.js +0 -61
- package/dist/cjs/snowplow/SnowplowContext.js.map +0 -1
- package/dist/cjs/snowplow/constants.js +0 -13
- package/dist/cjs/snowplow/constants.js.map +0 -1
- package/dist/cjs/snowplow/contexts.js +0 -68
- package/dist/cjs/snowplow/contexts.js.map +0 -1
- package/dist/cjs/snowplow/event-definitions/base.js +0 -56
- package/dist/cjs/snowplow/event-definitions/base.js.map +0 -1
- package/dist/cjs/snowplow/event-definitions/index.js +0 -65
- package/dist/cjs/snowplow/event-definitions/index.js.map +0 -1
- package/dist/cjs/snowplow/event-definitions/intervention.js +0 -33
- package/dist/cjs/snowplow/event-definitions/intervention.js.map +0 -1
- package/dist/cjs/snowplow/event-definitions/personalised_cover.js +0 -122
- package/dist/cjs/snowplow/event-definitions/personalised_cover.js.map +0 -1
- package/dist/cjs/snowplow/event-definitions/qcp.js +0 -348
- package/dist/cjs/snowplow/event-definitions/qcp.js.map +0 -1
- package/dist/cjs/snowplow/event-definitions/questionnaire.js +0 -115
- package/dist/cjs/snowplow/event-definitions/questionnaire.js.map +0 -1
- package/dist/cjs/snowplow/event-definitions/redaction.js +0 -154
- package/dist/cjs/snowplow/event-definitions/redaction.js.map +0 -1
- package/dist/cjs/snowplow/event-definitions/referral.js +0 -37
- package/dist/cjs/snowplow/event-definitions/referral.js.map +0 -1
- package/dist/cjs/snowplow/getSnowplowConfig.js +0 -16
- package/dist/cjs/snowplow/getSnowplowConfig.js.map +0 -1
- package/dist/cjs/snowplow/index.js +0 -25
- package/dist/cjs/snowplow/index.js.map +0 -1
- package/dist/cjs/snowplow/types.js +0 -6
- package/dist/cjs/snowplow/types.js.map +0 -1
- package/dist/cjs/utils/index.js +0 -21
- package/dist/cjs/utils/index.js.map +0 -1
- package/dist/cjs/utils/isObject.js +0 -15
- package/dist/cjs/utils/isObject.js.map +0 -1
- package/dist/cjs/utils/testUtils.js +0 -43
- package/dist/cjs/utils/testUtils.js.map +0 -1
- package/dist/cjs/utils/text.js +0 -45
- package/dist/cjs/utils/text.js.map +0 -1
- package/dist/esm/address-lookup/index.js +0 -88
- package/dist/esm/address-lookup/index.js.map +0 -1
- package/dist/esm/address-lookup/types.js +0 -5
- package/dist/esm/address-lookup/types.js.map +0 -1
- package/dist/esm/airbrake/index.js +0 -35
- package/dist/esm/airbrake/index.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/mocks/eventDefinitions.js +0 -80
- package/dist/esm/mocks/eventDefinitions.js.map +0 -1
- package/dist/esm/mocks/scripts-mock.js +0 -49
- package/dist/esm/mocks/scripts-mock.js.map +0 -1
- package/dist/esm/mocks/snowplowBrowserTrackerMock.js +0 -6
- package/dist/esm/mocks/snowplowBrowserTrackerMock.js.map +0 -1
- package/dist/esm/snowplow/Snowplow.js +0 -169
- package/dist/esm/snowplow/Snowplow.js.map +0 -1
- package/dist/esm/snowplow/SnowplowContext.js +0 -43
- package/dist/esm/snowplow/SnowplowContext.js.map +0 -1
- package/dist/esm/snowplow/constants.js +0 -3
- package/dist/esm/snowplow/constants.js.map +0 -1
- package/dist/esm/snowplow/contexts.js +0 -47
- package/dist/esm/snowplow/contexts.js.map +0 -1
- package/dist/esm/snowplow/event-definitions/base.js +0 -66
- package/dist/esm/snowplow/event-definitions/base.js.map +0 -1
- package/dist/esm/snowplow/event-definitions/index.js +0 -36
- package/dist/esm/snowplow/event-definitions/index.js.map +0 -1
- package/dist/esm/snowplow/event-definitions/intervention.js +0 -23
- package/dist/esm/snowplow/event-definitions/intervention.js.map +0 -1
- package/dist/esm/snowplow/event-definitions/personalised_cover.js +0 -131
- package/dist/esm/snowplow/event-definitions/personalised_cover.js.map +0 -1
- package/dist/esm/snowplow/event-definitions/qcp.js +0 -339
- package/dist/esm/snowplow/event-definitions/qcp.js.map +0 -1
- package/dist/esm/snowplow/event-definitions/questionnaire.js +0 -106
- package/dist/esm/snowplow/event-definitions/questionnaire.js.map +0 -1
- package/dist/esm/snowplow/event-definitions/redaction.js +0 -144
- package/dist/esm/snowplow/event-definitions/redaction.js.map +0 -1
- package/dist/esm/snowplow/event-definitions/referral.js +0 -28
- package/dist/esm/snowplow/event-definitions/referral.js.map +0 -1
- package/dist/esm/snowplow/getSnowplowConfig.js +0 -7
- package/dist/esm/snowplow/getSnowplowConfig.js.map +0 -1
- package/dist/esm/snowplow/index.js +0 -8
- package/dist/esm/snowplow/index.js.map +0 -1
- package/dist/esm/snowplow/types.js +0 -3
- package/dist/esm/snowplow/types.js.map +0 -1
- package/dist/esm/utils/index.js +0 -4
- package/dist/esm/utils/index.js.map +0 -1
- package/dist/esm/utils/isObject.js +0 -5
- package/dist/esm/utils/isObject.js.map +0 -1
- package/dist/esm/utils/testUtils.js +0 -26
- package/dist/esm/utils/testUtils.js.map +0 -1
- package/dist/esm/utils/text.js +0 -25
- package/dist/esm/utils/text.js.map +0 -1
|
@@ -1,348 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "qcpEventDefinitions", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return qcpEventDefinitions;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _utils = require("../../utils");
|
|
12
|
-
const qcpEventDefinitions = [
|
|
13
|
-
{
|
|
14
|
-
// QDP details button
|
|
15
|
-
name: "detailsClicked",
|
|
16
|
-
type: "structured",
|
|
17
|
-
makePayload: ()=>({
|
|
18
|
-
category: "comparison_cta",
|
|
19
|
-
action: "link_click",
|
|
20
|
-
label: "Details"
|
|
21
|
-
})
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
// Buy button
|
|
25
|
-
name: "selectClicked",
|
|
26
|
-
type: "structured",
|
|
27
|
-
makePayload: ()=>({
|
|
28
|
-
category: "comparison_cta",
|
|
29
|
-
action: "link_click",
|
|
30
|
-
label: "Buy"
|
|
31
|
-
})
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
// Quote Details Slider Next steps button
|
|
35
|
-
name: "nextStepsClicked",
|
|
36
|
-
type: "structured",
|
|
37
|
-
makePayload: ()=>({
|
|
38
|
-
category: "quote_details_slider_next_step_cta",
|
|
39
|
-
action: "link_click",
|
|
40
|
-
label: "Next steps"
|
|
41
|
-
})
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
// Toggle deductibles accordion
|
|
45
|
-
name: "deductiblesClicked",
|
|
46
|
-
type: "structured",
|
|
47
|
-
makePayload: ()=>({
|
|
48
|
-
category: "us-qcp-react",
|
|
49
|
-
action: "view_deductables_clicked",
|
|
50
|
-
label: "view_deductables_clicked",
|
|
51
|
-
property: window.location.href
|
|
52
|
-
})
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
name: "deductiblesClickedUk",
|
|
56
|
-
type: "structured",
|
|
57
|
-
makePayload: (params)=>{
|
|
58
|
-
const { label, deviceType } = params;
|
|
59
|
-
const urlFriendlyLabel = label.replace(/ /g, "-").toLowerCase();
|
|
60
|
-
return {
|
|
61
|
-
category: `uk-qcp-react-${deviceType}-${urlFriendlyLabel}-view-excess-toggle`,
|
|
62
|
-
action: "view_excess_clicked",
|
|
63
|
-
label,
|
|
64
|
-
property: window.location.href
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
// Quote Details Slider opened
|
|
70
|
-
name: "sliderOpened",
|
|
71
|
-
type: "structured",
|
|
72
|
-
makePayload: (params)=>{
|
|
73
|
-
const { label } = params;
|
|
74
|
-
return {
|
|
75
|
-
category: "comparison_cta",
|
|
76
|
-
action: "quote_details_slider_opened",
|
|
77
|
-
label
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
// Coverage modal opened
|
|
83
|
-
name: "coverageModalOpened",
|
|
84
|
-
type: "structured",
|
|
85
|
-
makePayload: (params)=>{
|
|
86
|
-
const { category, product = "extra_coverage", title } = params;
|
|
87
|
-
const productLabel = (0, _utils.snakeCase)(product);
|
|
88
|
-
return {
|
|
89
|
-
category,
|
|
90
|
-
action: `${productLabel}_${(0, _utils.snakeCase)(title)}_popup_opened`,
|
|
91
|
-
label: productLabel,
|
|
92
|
-
property: window.location.href
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
// Toggle cover select
|
|
98
|
-
name: "coverChanged",
|
|
99
|
-
type: "unstructured",
|
|
100
|
-
makePayload: (params)=>{
|
|
101
|
-
const { name = "", fromValue = "", toValue = "" } = params;
|
|
102
|
-
// Derive data
|
|
103
|
-
let action = "change";
|
|
104
|
-
// This logic is taken directly from Chopin without documentation:
|
|
105
|
-
// If a cover has zero value, then change the action to add or remove
|
|
106
|
-
if (fromValue === "0") {
|
|
107
|
-
action = "add";
|
|
108
|
-
}
|
|
109
|
-
if (toValue === "0") {
|
|
110
|
-
action = "remove";
|
|
111
|
-
}
|
|
112
|
-
return {
|
|
113
|
-
schema: "iglu:com.simplybusiness/comparison_page_cover_changed/jsonschema/1-0-0",
|
|
114
|
-
data: {
|
|
115
|
-
name,
|
|
116
|
-
action,
|
|
117
|
-
from_value: fromValue,
|
|
118
|
-
to_value: toValue
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
},
|
|
122
|
-
contexts: [
|
|
123
|
-
"distributionChannelContext"
|
|
124
|
-
]
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
name: "ratingsModalOpened",
|
|
128
|
-
type: "structured",
|
|
129
|
-
makePayload: (params)=>{
|
|
130
|
-
const { category, label } = params;
|
|
131
|
-
return {
|
|
132
|
-
category,
|
|
133
|
-
action: "insurer_rating_help_popup_triggered",
|
|
134
|
-
label,
|
|
135
|
-
property: window.location.href
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
name: "coverToggleOpened",
|
|
141
|
-
type: "structured",
|
|
142
|
-
makePayload: ()=>({
|
|
143
|
-
category: "qcp_limit_interaction",
|
|
144
|
-
label: "limit_interaction",
|
|
145
|
-
action: "limit_interaction_clicked",
|
|
146
|
-
property: window.location.href
|
|
147
|
-
})
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
name: "paymentToggleClicked",
|
|
151
|
-
type: "structured",
|
|
152
|
-
makePayload: (params)=>{
|
|
153
|
-
const { category, label } = params;
|
|
154
|
-
return {
|
|
155
|
-
category,
|
|
156
|
-
action: "button_click",
|
|
157
|
-
label,
|
|
158
|
-
property: window.location.href
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
name: "insurerDetailsAccordionClicked",
|
|
164
|
-
type: "structured",
|
|
165
|
-
makePayload: ()=>({
|
|
166
|
-
category: "quote_details_slider_insurer_details_description",
|
|
167
|
-
action: "accordion_clicked",
|
|
168
|
-
label: "accordion_clicked",
|
|
169
|
-
property: window.location.href
|
|
170
|
-
})
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
name: "priceDetailsPopUpOpened",
|
|
174
|
-
type: "structured",
|
|
175
|
-
makePayload: ()=>({
|
|
176
|
-
category: "price_details",
|
|
177
|
-
action: "price_details_popup_opened",
|
|
178
|
-
label: "Price details",
|
|
179
|
-
property: window.location.href
|
|
180
|
-
})
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
name: "editLimitButtonClicked",
|
|
184
|
-
type: "structured",
|
|
185
|
-
makePayload: ()=>({
|
|
186
|
-
category: "cover_limit_changes",
|
|
187
|
-
action: "edit_limit_button_clicked",
|
|
188
|
-
label: "Edit Limit",
|
|
189
|
-
property: window.location.href
|
|
190
|
-
})
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
name: "applyButtonClicked",
|
|
194
|
-
type: "structured",
|
|
195
|
-
makePayload: ()=>({
|
|
196
|
-
category: "cover_limit_changes",
|
|
197
|
-
action: "apply_button_clicked",
|
|
198
|
-
label: "Apply Button Clicked",
|
|
199
|
-
property: window.location.href
|
|
200
|
-
})
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
name: "coverageInfoClicked",
|
|
204
|
-
type: "structured",
|
|
205
|
-
makePayload: (params)=>{
|
|
206
|
-
const { deviceType } = params;
|
|
207
|
-
return {
|
|
208
|
-
action: "show_coverage_info_clicked",
|
|
209
|
-
category: `uk-qcp-react-${deviceType}-show-coverage-info-toggle`,
|
|
210
|
-
label: "show_coverage_info_clicked",
|
|
211
|
-
property: window.location.href
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
name: "backToApplication",
|
|
217
|
-
type: "unstructured",
|
|
218
|
-
makePayload: (params)=>{
|
|
219
|
-
const { journeyId, vertical } = params;
|
|
220
|
-
return {
|
|
221
|
-
schema: "iglu:com.simplybusiness/qcp_back_to_application/jsonschema/1-0-0",
|
|
222
|
-
data: {
|
|
223
|
-
journey_id: journeyId,
|
|
224
|
-
vertical
|
|
225
|
-
}
|
|
226
|
-
};
|
|
227
|
-
},
|
|
228
|
-
contexts: [
|
|
229
|
-
"serviceChannelContext"
|
|
230
|
-
]
|
|
231
|
-
},
|
|
232
|
-
{
|
|
233
|
-
name: "helpChatLinkClicked",
|
|
234
|
-
type: "structured",
|
|
235
|
-
makePayload: ()=>({
|
|
236
|
-
category: "help chat for question",
|
|
237
|
-
action: "help_chat_for_question_clicked",
|
|
238
|
-
property: window.location.href
|
|
239
|
-
})
|
|
240
|
-
},
|
|
241
|
-
// No quotes referral
|
|
242
|
-
{
|
|
243
|
-
name: "coverOptionsLinkClicked",
|
|
244
|
-
type: "structured",
|
|
245
|
-
makePayload: ()=>({
|
|
246
|
-
category: "uk-qcp-react-cover-options-link",
|
|
247
|
-
action: "cover_options_link_clicked",
|
|
248
|
-
label: "cover_options_link_clicked",
|
|
249
|
-
property: window.location.href
|
|
250
|
-
})
|
|
251
|
-
},
|
|
252
|
-
{
|
|
253
|
-
name: "referralReasonsVariantBCoverOptionsLinkClicked",
|
|
254
|
-
type: "structured",
|
|
255
|
-
makePayload: ()=>({
|
|
256
|
-
category: "uk-24-12-qcp-mvt-referral-reasons",
|
|
257
|
-
action: "cover_options_link_clicked_variant_b",
|
|
258
|
-
label: "cover_options_link_clicked_variant_b",
|
|
259
|
-
property: window.location.href
|
|
260
|
-
})
|
|
261
|
-
},
|
|
262
|
-
{
|
|
263
|
-
name: "referralReasonsVariantCCoverOptionsLinkClicked",
|
|
264
|
-
type: "structured",
|
|
265
|
-
makePayload: ()=>({
|
|
266
|
-
category: "uk-24-12-qcp-mvt-referral-reasons",
|
|
267
|
-
action: "cover_options_link_clicked_variant_c",
|
|
268
|
-
label: "cover_options_link_clicked_variant_c",
|
|
269
|
-
property: window.location.href
|
|
270
|
-
})
|
|
271
|
-
},
|
|
272
|
-
{
|
|
273
|
-
name: "phoneNumberLinkClicked",
|
|
274
|
-
type: "structured",
|
|
275
|
-
makePayload: ()=>({
|
|
276
|
-
category: "uk-qcp-react-phone-number-link",
|
|
277
|
-
action: "phone_number_link_clicked",
|
|
278
|
-
label: "phone_number_link_clicked",
|
|
279
|
-
property: window.location.href
|
|
280
|
-
})
|
|
281
|
-
},
|
|
282
|
-
{
|
|
283
|
-
name: "stickyFooterClick",
|
|
284
|
-
type: "structured",
|
|
285
|
-
makePayload: ()=>({
|
|
286
|
-
category: "marketing",
|
|
287
|
-
action: "link-click",
|
|
288
|
-
label: "sticky_footer_button",
|
|
289
|
-
property: window.location.href
|
|
290
|
-
})
|
|
291
|
-
},
|
|
292
|
-
{
|
|
293
|
-
name: "linkClicked",
|
|
294
|
-
type: "unstructured",
|
|
295
|
-
makePayload: (params)=>{
|
|
296
|
-
const { targetUrl, elementContent } = params;
|
|
297
|
-
return {
|
|
298
|
-
schema: "iglu:com.snowplowanalytics.snowplow/link_click/jsonschema/1-0-1",
|
|
299
|
-
data: {
|
|
300
|
-
targetUrl,
|
|
301
|
-
elementContent
|
|
302
|
-
}
|
|
303
|
-
};
|
|
304
|
-
}
|
|
305
|
-
},
|
|
306
|
-
{
|
|
307
|
-
name: "qcpUpsellAccordionClicked",
|
|
308
|
-
type: "structured",
|
|
309
|
-
makePayload: (params)=>({
|
|
310
|
-
category: "us-qcp-upsells",
|
|
311
|
-
action: "accordion_clicked_qcp",
|
|
312
|
-
label: params === null || params === void 0 ? void 0 : params.label,
|
|
313
|
-
property: window.location.href
|
|
314
|
-
})
|
|
315
|
-
},
|
|
316
|
-
{
|
|
317
|
-
name: "qdsUpsellAccordionClicked",
|
|
318
|
-
type: "structured",
|
|
319
|
-
makePayload: (params)=>({
|
|
320
|
-
category: "us-qcp-upsells",
|
|
321
|
-
action: "accordion_clicked_slider",
|
|
322
|
-
label: params === null || params === void 0 ? void 0 : params.label,
|
|
323
|
-
property: window.location.href
|
|
324
|
-
})
|
|
325
|
-
},
|
|
326
|
-
{
|
|
327
|
-
name: "qcpUpsellTooltipHelperClicked",
|
|
328
|
-
type: "structured",
|
|
329
|
-
makePayload: (params)=>({
|
|
330
|
-
category: "us-qcp-upsells",
|
|
331
|
-
action: "tooltip_helper_clicked_qcp",
|
|
332
|
-
label: params === null || params === void 0 ? void 0 : params.label,
|
|
333
|
-
property: window.location.href
|
|
334
|
-
})
|
|
335
|
-
},
|
|
336
|
-
{
|
|
337
|
-
name: "qdsUpsellTooltipHelperClicked",
|
|
338
|
-
type: "structured",
|
|
339
|
-
makePayload: (params)=>({
|
|
340
|
-
category: "us-qcp-upsells",
|
|
341
|
-
action: "tooltip_helper_clicked_slider",
|
|
342
|
-
label: params === null || params === void 0 ? void 0 : params.label,
|
|
343
|
-
property: window.location.href
|
|
344
|
-
})
|
|
345
|
-
}
|
|
346
|
-
];
|
|
347
|
-
|
|
348
|
-
//# sourceMappingURL=qcp.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/snowplow/event-definitions/qcp.ts"],"sourcesContent":["import { snakeCase } from \"../../utils\";\nimport { EventDefinition, LinkType, ParamsType } from \"../types\";\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: \"Buy\",\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 contexts: [\"distributionChannelContext\"],\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:\n \"iglu:com.simplybusiness/qcp_back_to_application/jsonschema/1-0-0\",\n data: {\n journey_id: journeyId,\n vertical,\n },\n };\n },\n contexts: [\"serviceChannelContext\"],\n },\n {\n name: \"helpChatLinkClicked\",\n type: \"structured\",\n makePayload: () => ({\n category: \"help chat for question\",\n action: \"help_chat_for_question_clicked\",\n property: window.location.href,\n }),\n },\n // No quotes referral\n {\n name: \"coverOptionsLinkClicked\",\n type: \"structured\",\n makePayload: () => ({\n category: \"uk-qcp-react-cover-options-link\",\n action: \"cover_options_link_clicked\",\n label: \"cover_options_link_clicked\",\n property: window.location.href,\n }),\n },\n {\n name: \"referralReasonsVariantBCoverOptionsLinkClicked\",\n type: \"structured\",\n makePayload: () => ({\n category: \"uk-24-12-qcp-mvt-referral-reasons\",\n action: \"cover_options_link_clicked_variant_b\",\n label: \"cover_options_link_clicked_variant_b\",\n property: window.location.href,\n }),\n },\n {\n name: \"referralReasonsVariantCCoverOptionsLinkClicked\",\n type: \"structured\",\n makePayload: () => ({\n category: \"uk-24-12-qcp-mvt-referral-reasons\",\n action: \"cover_options_link_clicked_variant_c\",\n label: \"cover_options_link_clicked_variant_c\",\n property: window.location.href,\n }),\n },\n {\n name: \"phoneNumberLinkClicked\",\n type: \"structured\",\n makePayload: () => ({\n category: \"uk-qcp-react-phone-number-link\",\n action: \"phone_number_link_clicked\",\n label: \"phone_number_link_clicked\",\n property: window.location.href,\n }),\n },\n {\n name: \"stickyFooterClick\",\n type: \"structured\",\n makePayload: () => ({\n category: \"marketing\",\n action: \"link-click\",\n label: \"sticky_footer_button\",\n property: window.location.href,\n }),\n },\n {\n name: \"linkClicked\",\n type: \"unstructured\",\n makePayload: params => {\n const { targetUrl, elementContent } = params as LinkType;\n\n return {\n schema:\n \"iglu:com.snowplowanalytics.snowplow/link_click/jsonschema/1-0-1\",\n data: {\n targetUrl,\n elementContent,\n },\n };\n },\n },\n {\n name: \"qcpUpsellAccordionClicked\",\n type: \"structured\",\n makePayload: params => ({\n category: \"us-qcp-upsells\",\n action: \"accordion_clicked_qcp\",\n label: params?.label as string,\n property: window.location.href,\n }),\n },\n {\n name: \"qdsUpsellAccordionClicked\",\n type: \"structured\",\n makePayload: params => ({\n category: \"us-qcp-upsells\",\n action: \"accordion_clicked_slider\",\n label: params?.label as string,\n property: window.location.href,\n }),\n },\n {\n name: \"qcpUpsellTooltipHelperClicked\",\n type: \"structured\",\n makePayload: params => ({\n category: \"us-qcp-upsells\",\n action: \"tooltip_helper_clicked_qcp\",\n label: params?.label as string,\n property: window.location.href,\n }),\n },\n {\n name: \"qdsUpsellTooltipHelperClicked\",\n type: \"structured\",\n makePayload: params => ({\n category: \"us-qcp-upsells\",\n action: \"tooltip_helper_clicked_slider\",\n label: params?.label as string,\n property: window.location.href,\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","contexts","journeyId","vertical","journey_id","targetUrl","elementContent"],"mappings":";;;;+BAIaA;;;eAAAA;;;uBAJa;AAInB,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;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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B;YAEtC,OAAO;gBACLW,QACE;gBACFC,MAAM;oBACJO;oBACAC;gBACF;YACF;QACF;IACF;IACA;QACE9B,MAAM;QACNC,MAAM;QACNC,aAAaQ,CAAAA,SAAW,CAAA;gBACtBP,UAAU;gBACVC,QAAQ;gBACRC,KAAK,EAAEK,mBAAAA,6BAAAA,OAAQL,KAAK;gBACpBC,UAAUC,OAAOC,QAAQ,CAACC,IAAI;YAChC,CAAA;IACF;IACA;QACET,MAAM;QACNC,MAAM;QACNC,aAAaQ,CAAAA,SAAW,CAAA;gBACtBP,UAAU;gBACVC,QAAQ;gBACRC,KAAK,EAAEK,mBAAAA,6BAAAA,OAAQL,KAAK;gBACpBC,UAAUC,OAAOC,QAAQ,CAACC,IAAI;YAChC,CAAA;IACF;IACA;QACET,MAAM;QACNC,MAAM;QACNC,aAAaQ,CAAAA,SAAW,CAAA;gBACtBP,UAAU;gBACVC,QAAQ;gBACRC,KAAK,EAAEK,mBAAAA,6BAAAA,OAAQL,KAAK;gBACpBC,UAAUC,OAAOC,QAAQ,CAACC,IAAI;YAChC,CAAA;IACF;IACA;QACET,MAAM;QACNC,MAAM;QACNC,aAAaQ,CAAAA,SAAW,CAAA;gBACtBP,UAAU;gBACVC,QAAQ;gBACRC,KAAK,EAAEK,mBAAAA,6BAAAA,OAAQL,KAAK;gBACpBC,UAAUC,OAAOC,QAAQ,CAACC,IAAI;YAChC,CAAA;IACF;CACD"}
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "questionnaireEventDefinitions", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return questionnaireEventDefinitions;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _constants = require("../constants");
|
|
12
|
-
const _redaction = require("./redaction");
|
|
13
|
-
const questionnaireEventDefinitions = [
|
|
14
|
-
{
|
|
15
|
-
name: "questionAnswered",
|
|
16
|
-
type: "unstructured",
|
|
17
|
-
makePayload: (params)=>{
|
|
18
|
-
const { section, context } = params;
|
|
19
|
-
const { question, answer } = (0, _redaction.redact)(params);
|
|
20
|
-
// Flatten the answer to a delimited string
|
|
21
|
-
const flatAnswer = Array.isArray(answer) ? answer.join(_constants.DELIMITER) : answer;
|
|
22
|
-
return {
|
|
23
|
-
schema: "iglu:com.simplybusiness/form_question_answered/jsonschema/1-0-3",
|
|
24
|
-
data: {
|
|
25
|
-
site: context.site,
|
|
26
|
-
page_index: 1,
|
|
27
|
-
page_name: "quick_to_quote",
|
|
28
|
-
submitted_from: "quick_to_quote_experiment",
|
|
29
|
-
section_name: section,
|
|
30
|
-
question,
|
|
31
|
-
answer: flatAnswer,
|
|
32
|
-
vertical: context.vertical
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
name: "primaryDetailSelected",
|
|
39
|
-
type: "unstructured",
|
|
40
|
-
makePayload: (params)=>{
|
|
41
|
-
const { context, answer, vertical } = params;
|
|
42
|
-
const { site } = context;
|
|
43
|
-
let verticalName = vertical || context.vertical;
|
|
44
|
-
if (verticalName.toLowerCase().indexOf("landlord") > -1) {
|
|
45
|
-
verticalName = answer === "residential" ? "Landlord" : "Commercial landlord";
|
|
46
|
-
}
|
|
47
|
-
return {
|
|
48
|
-
schema: "iglu:com.simplybusiness/primary_detail_selected/jsonschema/1-3-0",
|
|
49
|
-
data: {
|
|
50
|
-
site,
|
|
51
|
-
vertical: verticalName,
|
|
52
|
-
primary_detail: answer
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
},
|
|
56
|
-
contexts: [
|
|
57
|
-
"distributionChannelContext"
|
|
58
|
-
]
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
name: "helpTextOpened",
|
|
62
|
-
type: "unstructured",
|
|
63
|
-
makePayload: (params)=>{
|
|
64
|
-
const { primaryText, label, context, helpText } = params;
|
|
65
|
-
return {
|
|
66
|
-
schema: "iglu:com.simplybusiness/help_text_opened/jsonschema/1-1-0",
|
|
67
|
-
data: {
|
|
68
|
-
vertical: context.vertical,
|
|
69
|
-
site: context.site,
|
|
70
|
-
primary_text: primaryText,
|
|
71
|
-
help_text: helpText,
|
|
72
|
-
label,
|
|
73
|
-
page_name: "quick_to_quote"
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
name: "assumptionsButtonClicked",
|
|
80
|
-
type: "structured",
|
|
81
|
-
makePayload: (params)=>{
|
|
82
|
-
const { source, presentationGroup } = params;
|
|
83
|
-
return {
|
|
84
|
-
action: source,
|
|
85
|
-
category: presentationGroup
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
name: "navButtonClicked",
|
|
91
|
-
type: "structured",
|
|
92
|
-
makePayload: (params)=>{
|
|
93
|
-
const { label, category } = params;
|
|
94
|
-
return {
|
|
95
|
-
label,
|
|
96
|
-
action: "link_click",
|
|
97
|
-
category
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
name: "manualAddressClicked",
|
|
103
|
-
type: "structured",
|
|
104
|
-
makePayload: (params)=>{
|
|
105
|
-
const { category } = params;
|
|
106
|
-
return {
|
|
107
|
-
action: "link_click",
|
|
108
|
-
category,
|
|
109
|
-
label: "Enter address manually"
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
];
|
|
114
|
-
|
|
115
|
-
//# sourceMappingURL=questionnaire.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/snowplow/event-definitions/questionnaire.ts"],"sourcesContent":["import { DELIMITER } from \"../constants\";\nimport { EventDefinition, ParamsType } from \"../types\";\nimport { redact } from \"./redaction\";\n\n// Questionnaire events\nexport const questionnaireEventDefinitions: EventDefinition[] = [\n {\n name: \"questionAnswered\",\n type: \"unstructured\",\n makePayload: params => {\n const { section, context } = params as ParamsType;\n const { question, answer } = redact(params as ParamsType);\n // Flatten the answer to a delimited string\n const flatAnswer = Array.isArray(answer)\n ? answer.join(DELIMITER)\n : answer;\n\n return {\n schema:\n \"iglu:com.simplybusiness/form_question_answered/jsonschema/1-0-3\",\n data: {\n site: context.site,\n page_index: 1,\n page_name: \"quick_to_quote\",\n submitted_from: \"quick_to_quote_experiment\",\n section_name: section,\n question,\n answer: flatAnswer,\n vertical: context.vertical,\n },\n };\n },\n },\n {\n name: \"primaryDetailSelected\",\n type: \"unstructured\",\n makePayload: params => {\n const { context, answer, vertical } = params as ParamsType;\n const { site } = context;\n let verticalName = vertical || context.vertical;\n\n if (verticalName.toLowerCase().indexOf(\"landlord\") > -1) {\n verticalName =\n answer === \"residential\" ? \"Landlord\" : \"Commercial landlord\";\n }\n\n return {\n schema:\n \"iglu:com.simplybusiness/primary_detail_selected/jsonschema/1-3-0\",\n data: {\n site,\n vertical: verticalName,\n primary_detail: answer,\n },\n };\n },\n contexts: [\"distributionChannelContext\"],\n },\n {\n name: \"helpTextOpened\",\n type: \"unstructured\",\n makePayload: params => {\n const { primaryText, label, context, helpText } = params as ParamsType;\n\n return {\n schema: \"iglu:com.simplybusiness/help_text_opened/jsonschema/1-1-0\",\n data: {\n vertical: context.vertical,\n site: context.site,\n primary_text: primaryText,\n help_text: helpText,\n label,\n page_name: \"quick_to_quote\",\n },\n };\n },\n },\n {\n name: \"assumptionsButtonClicked\",\n type: \"structured\",\n makePayload: params => {\n const { source, presentationGroup } = params as ParamsType;\n\n return {\n action: source,\n category: presentationGroup,\n };\n },\n },\n {\n name: \"navButtonClicked\",\n type: \"structured\",\n makePayload: params => {\n const { label, category } = params as ParamsType;\n\n return {\n label,\n action: \"link_click\",\n category,\n };\n },\n },\n {\n name: \"manualAddressClicked\",\n type: \"structured\",\n makePayload: params => {\n const { category } = params as ParamsType;\n\n return {\n action: \"link_click\",\n category,\n label: \"Enter address manually\",\n };\n },\n },\n];\n"],"names":["questionnaireEventDefinitions","name","type","makePayload","params","section","context","question","answer","redact","flatAnswer","Array","isArray","join","DELIMITER","schema","data","site","page_index","page_name","submitted_from","section_name","vertical","verticalName","toLowerCase","indexOf","primary_detail","contexts","primaryText","label","helpText","primary_text","help_text","source","presentationGroup","action","category"],"mappings":";;;;+BAKaA;;;eAAAA;;;2BALa;2BAEH;AAGhB,MAAMA,gCAAmD;IAC9D;QACEC,MAAM;QACNC,MAAM;QACNC,aAAaC,CAAAA;YACX,MAAM,EAAEC,OAAO,EAAEC,OAAO,EAAE,GAAGF;YAC7B,MAAM,EAAEG,QAAQ,EAAEC,MAAM,EAAE,GAAGC,IAAAA,iBAAM,EAACL;YACpC,2CAA2C;YAC3C,MAAMM,aAAaC,MAAMC,OAAO,CAACJ,UAC7BA,OAAOK,IAAI,CAACC,oBAAS,IACrBN;YAEJ,OAAO;gBACLO,QACE;gBACFC,MAAM;oBACJC,MAAMX,QAAQW,IAAI;oBAClBC,YAAY;oBACZC,WAAW;oBACXC,gBAAgB;oBAChBC,cAAchB;oBACdE;oBACAC,QAAQE;oBACRY,UAAUhB,QAAQgB,QAAQ;gBAC5B;YACF;QACF;IACF;IACA;QACErB,MAAM;QACNC,MAAM;QACNC,aAAaC,CAAAA;YACX,MAAM,EAAEE,OAAO,EAAEE,MAAM,EAAEc,QAAQ,EAAE,GAAGlB;YACtC,MAAM,EAAEa,IAAI,EAAE,GAAGX;YACjB,IAAIiB,eAAeD,YAAYhB,QAAQgB,QAAQ;YAE/C,IAAIC,aAAaC,WAAW,GAAGC,OAAO,CAAC,cAAc,CAAC,GAAG;gBACvDF,eACEf,WAAW,gBAAgB,aAAa;YAC5C;YAEA,OAAO;gBACLO,QACE;gBACFC,MAAM;oBACJC;oBACAK,UAAUC;oBACVG,gBAAgBlB;gBAClB;YACF;QACF;QACAmB,UAAU;YAAC;SAA6B;IAC1C;IACA;QACE1B,MAAM;QACNC,MAAM;QACNC,aAAaC,CAAAA;YACX,MAAM,EAAEwB,WAAW,EAAEC,KAAK,EAAEvB,OAAO,EAAEwB,QAAQ,EAAE,GAAG1B;YAElD,OAAO;gBACLW,QAAQ;gBACRC,MAAM;oBACJM,UAAUhB,QAAQgB,QAAQ;oBAC1BL,MAAMX,QAAQW,IAAI;oBAClBc,cAAcH;oBACdI,WAAWF;oBACXD;oBACAV,WAAW;gBACb;YACF;QACF;IACF;IACA;QACElB,MAAM;QACNC,MAAM;QACNC,aAAaC,CAAAA;YACX,MAAM,EAAE6B,MAAM,EAAEC,iBAAiB,EAAE,GAAG9B;YAEtC,OAAO;gBACL+B,QAAQF;gBACRG,UAAUF;YACZ;QACF;IACF;IACA;QACEjC,MAAM;QACNC,MAAM;QACNC,aAAaC,CAAAA;YACX,MAAM,EAAEyB,KAAK,EAAEO,QAAQ,EAAE,GAAGhC;YAE5B,OAAO;gBACLyB;gBACAM,QAAQ;gBACRC;YACF;QACF;IACF;IACA;QACEnC,MAAM;QACNC,MAAM;QACNC,aAAaC,CAAAA;YACX,MAAM,EAAEgC,QAAQ,EAAE,GAAGhC;YAErB,OAAO;gBACL+B,QAAQ;gBACRC;gBACAP,OAAO;YACT;QACF;IACF;CACD"}
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "redact", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return redact;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const PII_ANSWER = [
|
|
12
|
-
"customer_title",
|
|
13
|
-
"customer_first_name",
|
|
14
|
-
"customer_last_name",
|
|
15
|
-
"customer_email_address",
|
|
16
|
-
"preapp_email_address",
|
|
17
|
-
"customer_telephone_number",
|
|
18
|
-
"customer_alternative_telephone_number",
|
|
19
|
-
"uk_address_lookup",
|
|
20
|
-
"uk_correspondence_address_lookup",
|
|
21
|
-
"customer_address_1_pre_quote",
|
|
22
|
-
"customer_address_2_pre_quote",
|
|
23
|
-
"customer_town_pre_quote",
|
|
24
|
-
"customer_postcode_pre_quote",
|
|
25
|
-
"customer_address_1",
|
|
26
|
-
"customer_address_2",
|
|
27
|
-
"customer_town",
|
|
28
|
-
"customer_postcode",
|
|
29
|
-
"address_1_pre_quote",
|
|
30
|
-
"address_2_pre_quote",
|
|
31
|
-
"uk_postcode_pre_quote",
|
|
32
|
-
"town_pre_quote",
|
|
33
|
-
"owner_first_name",
|
|
34
|
-
"owner_last_name",
|
|
35
|
-
"beneficiary_first_name",
|
|
36
|
-
"beneficiary_last_name",
|
|
37
|
-
"gender",
|
|
38
|
-
"dynamic_ssn_fein",
|
|
39
|
-
"ssn",
|
|
40
|
-
"fein",
|
|
41
|
-
"sof_county_court_judgement_online_yes",
|
|
42
|
-
"sof_county_court_judgement_online_no",
|
|
43
|
-
"sof_ccj_count",
|
|
44
|
-
"sof_ccj_value",
|
|
45
|
-
"sof_ccj_date",
|
|
46
|
-
"sof_court_judgement_yes",
|
|
47
|
-
"sof_court_judgement_no",
|
|
48
|
-
"ccj_date",
|
|
49
|
-
"sof_single_ccj_no",
|
|
50
|
-
"sof_single_ccj_yes",
|
|
51
|
-
"sof_ccj_yes",
|
|
52
|
-
"sof_ccj_no",
|
|
53
|
-
"ccj_count",
|
|
54
|
-
"sof_bankrupt_yes",
|
|
55
|
-
"sof_bankrupt_no",
|
|
56
|
-
"sof_multiple_bankruptcies_yes",
|
|
57
|
-
"sof_multiple_bankruptcies_no",
|
|
58
|
-
"bankruptcy_date",
|
|
59
|
-
"sof_single_bankruptcy_no",
|
|
60
|
-
"sof_single_bankruptcy_yes",
|
|
61
|
-
"sof_bankruptcy_yes",
|
|
62
|
-
"sof_bankruptcy_no",
|
|
63
|
-
"bankruptcy_discharged",
|
|
64
|
-
"sof_liquidation_yes",
|
|
65
|
-
"sof_liquidation_no",
|
|
66
|
-
"sof_multiple_liquidations",
|
|
67
|
-
"liquidation_date",
|
|
68
|
-
"sof_criminal_offence_yes",
|
|
69
|
-
"sof_criminal_offence_no",
|
|
70
|
-
"sof_criminal_yes",
|
|
71
|
-
"sof_criminal_no",
|
|
72
|
-
"hcp_date_of_birth_1",
|
|
73
|
-
"hcp_date_of_birth_2",
|
|
74
|
-
"hcp_date_of_birth_3",
|
|
75
|
-
"hcp_date_of_birth_4",
|
|
76
|
-
"hcp_date_of_birth_5",
|
|
77
|
-
"hcp_date_of_birth_6",
|
|
78
|
-
"hcp_date_of_birth_7",
|
|
79
|
-
"hcp_date_of_birth_8",
|
|
80
|
-
"hcp_date_of_birth_9",
|
|
81
|
-
"hcp_date_of_birth_10",
|
|
82
|
-
"sof_previous_claims_yes",
|
|
83
|
-
"sof_previous_claims_no",
|
|
84
|
-
"sof_claims_yes",
|
|
85
|
-
"sof_claims_no",
|
|
86
|
-
"sof_property_claims_in_the_last_5_years_yes",
|
|
87
|
-
"sof_property_claims_in_the_last_5_years_no",
|
|
88
|
-
"sof_property_claims_in_the_last_0_to_4_years_yes",
|
|
89
|
-
"sof_property_claims_in_the_last_0_to_4_years_no",
|
|
90
|
-
"claim_count",
|
|
91
|
-
"sof_number_of_claims",
|
|
92
|
-
"number_of_claims_in_last_5_years",
|
|
93
|
-
"number_of_claims_in_time_owned",
|
|
94
|
-
"date_of_incident_1",
|
|
95
|
-
"date_of_incident_2",
|
|
96
|
-
"date_of_incident_3",
|
|
97
|
-
"date_of_incident_4",
|
|
98
|
-
"date_of_incident_5",
|
|
99
|
-
"type_of_incident_1",
|
|
100
|
-
"type_of_incident_2",
|
|
101
|
-
"type_of_incident_3",
|
|
102
|
-
"type_of_incident_4",
|
|
103
|
-
"type_of_incident_5",
|
|
104
|
-
"incident_value_1",
|
|
105
|
-
"incident_value_2",
|
|
106
|
-
"incident_value_3",
|
|
107
|
-
"incident_value_4",
|
|
108
|
-
"incident_value_5",
|
|
109
|
-
"sof_pollution_disease_claims_yes",
|
|
110
|
-
"sof_pollution_disease_claims_no",
|
|
111
|
-
"sof_potential_claims_yes",
|
|
112
|
-
"sof_potential_claims_no",
|
|
113
|
-
"sof_previous_circumstances_yes",
|
|
114
|
-
"sof_previous_circumstances_no",
|
|
115
|
-
"sof_possible_claims_yes",
|
|
116
|
-
"sof_possible_claims_no",
|
|
117
|
-
"date_of_possible_incident",
|
|
118
|
-
"type_of_possible_incident",
|
|
119
|
-
"possible_incident_value",
|
|
120
|
-
"sof_property_claims_yes",
|
|
121
|
-
"sof_property_claims_no",
|
|
122
|
-
"sof_liability_claims_yes",
|
|
123
|
-
"sof_liability_claims_no",
|
|
124
|
-
"van_registration",
|
|
125
|
-
"sof_disqualified_director_yes",
|
|
126
|
-
"sof_disqualified_director_no",
|
|
127
|
-
"sof_insurance_refused_yes",
|
|
128
|
-
"sof_insurance_refused_no",
|
|
129
|
-
"sof_insurance_declined_yes",
|
|
130
|
-
"sof_insurance_declined_no",
|
|
131
|
-
"insurance_refused"
|
|
132
|
-
];
|
|
133
|
-
const RADIO_ANSWER_FROM_QUESTIONS = [
|
|
134
|
-
"have_secondary_trade_yes",
|
|
135
|
-
"have_secondary_trade_no"
|
|
136
|
-
];
|
|
137
|
-
const ANSWER_SUFFIX_PATTERN = /_(yes|no)$/;
|
|
138
|
-
const redact = (params)=>{
|
|
139
|
-
let { question, answer } = params;
|
|
140
|
-
const piiAnswer = new Set(PII_ANSWER);
|
|
141
|
-
const radioAnswerFromQuestions = new Set(RADIO_ANSWER_FROM_QUESTIONS);
|
|
142
|
-
if (piiAnswer.has(question)) {
|
|
143
|
-
answer = "REDACTED";
|
|
144
|
-
question = question === null || question === void 0 ? void 0 : question.replace(ANSWER_SUFFIX_PATTERN, "");
|
|
145
|
-
} else if (radioAnswerFromQuestions.has(question)) {
|
|
146
|
-
question = question === null || question === void 0 ? void 0 : question.replace(ANSWER_SUFFIX_PATTERN, "");
|
|
147
|
-
}
|
|
148
|
-
return {
|
|
149
|
-
question,
|
|
150
|
-
answer
|
|
151
|
-
};
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
//# sourceMappingURL=redaction.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/snowplow/event-definitions/redaction.ts"],"sourcesContent":["import { ParamsType } from \"../types\";\n\nconst PII_ANSWER = [\n \"customer_title\",\n \"customer_first_name\",\n \"customer_last_name\",\n \"customer_email_address\",\n \"preapp_email_address\",\n \"customer_telephone_number\",\n \"customer_alternative_telephone_number\",\n \"uk_address_lookup\",\n \"uk_correspondence_address_lookup\",\n \"customer_address_1_pre_quote\",\n \"customer_address_2_pre_quote\",\n \"customer_town_pre_quote\",\n \"customer_postcode_pre_quote\",\n \"customer_address_1\",\n \"customer_address_2\",\n \"customer_town\",\n \"customer_postcode\",\n \"address_1_pre_quote\",\n \"address_2_pre_quote\",\n \"uk_postcode_pre_quote\",\n \"town_pre_quote\",\n \"owner_first_name\",\n \"owner_last_name\",\n \"beneficiary_first_name\",\n \"beneficiary_last_name\",\n \"gender\",\n \"dynamic_ssn_fein\",\n \"ssn\",\n \"fein\",\n \"sof_county_court_judgement_online_yes\",\n \"sof_county_court_judgement_online_no\",\n \"sof_ccj_count\",\n \"sof_ccj_value\",\n \"sof_ccj_date\",\n \"sof_court_judgement_yes\",\n \"sof_court_judgement_no\",\n \"ccj_date\",\n \"sof_single_ccj_no\",\n \"sof_single_ccj_yes\",\n \"sof_ccj_yes\",\n \"sof_ccj_no\",\n \"ccj_count\",\n \"sof_bankrupt_yes\",\n \"sof_bankrupt_no\",\n \"sof_multiple_bankruptcies_yes\",\n \"sof_multiple_bankruptcies_no\",\n \"bankruptcy_date\",\n \"sof_single_bankruptcy_no\",\n \"sof_single_bankruptcy_yes\",\n \"sof_bankruptcy_yes\",\n \"sof_bankruptcy_no\",\n \"bankruptcy_discharged\",\n \"sof_liquidation_yes\",\n \"sof_liquidation_no\",\n \"sof_multiple_liquidations\",\n \"liquidation_date\",\n \"sof_criminal_offence_yes\",\n \"sof_criminal_offence_no\",\n \"sof_criminal_yes\",\n \"sof_criminal_no\",\n \"hcp_date_of_birth_1\",\n \"hcp_date_of_birth_2\",\n \"hcp_date_of_birth_3\",\n \"hcp_date_of_birth_4\",\n \"hcp_date_of_birth_5\",\n \"hcp_date_of_birth_6\",\n \"hcp_date_of_birth_7\",\n \"hcp_date_of_birth_8\",\n \"hcp_date_of_birth_9\",\n \"hcp_date_of_birth_10\",\n \"sof_previous_claims_yes\",\n \"sof_previous_claims_no\",\n \"sof_claims_yes\",\n \"sof_claims_no\",\n \"sof_property_claims_in_the_last_5_years_yes\",\n \"sof_property_claims_in_the_last_5_years_no\",\n \"sof_property_claims_in_the_last_0_to_4_years_yes\",\n \"sof_property_claims_in_the_last_0_to_4_years_no\",\n \"claim_count\",\n \"sof_number_of_claims\",\n \"number_of_claims_in_last_5_years\",\n \"number_of_claims_in_time_owned\",\n \"date_of_incident_1\",\n \"date_of_incident_2\",\n \"date_of_incident_3\",\n \"date_of_incident_4\",\n \"date_of_incident_5\",\n \"type_of_incident_1\",\n \"type_of_incident_2\",\n \"type_of_incident_3\",\n \"type_of_incident_4\",\n \"type_of_incident_5\",\n \"incident_value_1\",\n \"incident_value_2\",\n \"incident_value_3\",\n \"incident_value_4\",\n \"incident_value_5\",\n \"sof_pollution_disease_claims_yes\",\n \"sof_pollution_disease_claims_no\",\n \"sof_potential_claims_yes\",\n \"sof_potential_claims_no\",\n \"sof_previous_circumstances_yes\",\n \"sof_previous_circumstances_no\",\n \"sof_possible_claims_yes\",\n \"sof_possible_claims_no\",\n \"date_of_possible_incident\",\n \"type_of_possible_incident\",\n \"possible_incident_value\",\n \"sof_property_claims_yes\",\n \"sof_property_claims_no\",\n \"sof_liability_claims_yes\",\n \"sof_liability_claims_no\",\n \"van_registration\",\n \"sof_disqualified_director_yes\",\n \"sof_disqualified_director_no\",\n \"sof_insurance_refused_yes\",\n \"sof_insurance_refused_no\",\n \"sof_insurance_declined_yes\",\n \"sof_insurance_declined_no\",\n \"insurance_refused\",\n];\n\nconst RADIO_ANSWER_FROM_QUESTIONS = [\n \"have_secondary_trade_yes\",\n \"have_secondary_trade_no\",\n];\n\nconst ANSWER_SUFFIX_PATTERN = /_(yes|no)$/;\n\nexport const redact = (params: ParamsType) => {\n let { question, answer } = params as ParamsType;\n\n const piiAnswer = new Set(PII_ANSWER);\n const radioAnswerFromQuestions = new Set(RADIO_ANSWER_FROM_QUESTIONS);\n\n if (piiAnswer.has(question)) {\n answer = \"REDACTED\";\n question = question?.replace(ANSWER_SUFFIX_PATTERN, \"\");\n } else if (radioAnswerFromQuestions.has(question)) {\n question = question?.replace(ANSWER_SUFFIX_PATTERN, \"\");\n }\n return { question, answer };\n};\n"],"names":["redact","PII_ANSWER","RADIO_ANSWER_FROM_QUESTIONS","ANSWER_SUFFIX_PATTERN","params","question","answer","piiAnswer","Set","radioAnswerFromQuestions","has","replace"],"mappings":";;;;+BAoIaA;;;eAAAA;;;AAlIb,MAAMC,aAAa;IACjB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAED,MAAMC,8BAA8B;IAClC;IACA;CACD;AAED,MAAMC,wBAAwB;AAEvB,MAAMH,SAAS,CAACI;IACrB,IAAI,EAAEC,QAAQ,EAAEC,MAAM,EAAE,GAAGF;IAE3B,MAAMG,YAAY,IAAIC,IAAIP;IAC1B,MAAMQ,2BAA2B,IAAID,IAAIN;IAEzC,IAAIK,UAAUG,GAAG,CAACL,WAAW;QAC3BC,SAAS;QACTD,WAAWA,qBAAAA,+BAAAA,SAAUM,OAAO,CAACR,uBAAuB;IACtD,OAAO,IAAIM,yBAAyBC,GAAG,CAACL,WAAW;QACjDA,WAAWA,qBAAAA,+BAAAA,SAAUM,OAAO,CAACR,uBAAuB;IACtD;IACA,OAAO;QAAEE;QAAUC;IAAO;AAC5B"}
|