@heycater/qualification-funnel 1.4.13 → 1.5.1
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/dist/heycater-funnel.iife.js +96 -96
- package/dist/index.cjs.js +102 -102
- package/dist/index.esm.js +323 -273
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -10052,11 +10052,181 @@ const Adornment = styled.div`
|
|
|
10052
10052
|
top: 50%;
|
|
10053
10053
|
transform: translateY(-50%);
|
|
10054
10054
|
`;
|
|
10055
|
+
function captureEvent(eventName, properties) {
|
|
10056
|
+
if (typeof window === "undefined") return;
|
|
10057
|
+
if (window.posthog) {
|
|
10058
|
+
try {
|
|
10059
|
+
window.posthog.capture(eventName, properties);
|
|
10060
|
+
} catch (error) {
|
|
10061
|
+
console.error("[PostHog] Failed to send event:", error);
|
|
10062
|
+
}
|
|
10063
|
+
}
|
|
10064
|
+
if (window.dataLayer) {
|
|
10065
|
+
window.dataLayer.push({
|
|
10066
|
+
event: eventName,
|
|
10067
|
+
...properties
|
|
10068
|
+
});
|
|
10069
|
+
}
|
|
10070
|
+
}
|
|
10071
|
+
function trackAnswerSelected(context, answer) {
|
|
10072
|
+
const properties = {
|
|
10073
|
+
funnel_mode: context.funnel_mode,
|
|
10074
|
+
session_id: context.session_id,
|
|
10075
|
+
total_steps: context.total_steps,
|
|
10076
|
+
step_id: answer.step_id,
|
|
10077
|
+
step_index: answer.step_index,
|
|
10078
|
+
question_id: answer.question_id,
|
|
10079
|
+
answer_value: answer.answer_value,
|
|
10080
|
+
is_last_question: answer.is_last_question
|
|
10081
|
+
};
|
|
10082
|
+
if (context.service_type) {
|
|
10083
|
+
properties.service_type = context.service_type;
|
|
10084
|
+
}
|
|
10085
|
+
if (context.city) {
|
|
10086
|
+
properties.city = context.city;
|
|
10087
|
+
}
|
|
10088
|
+
captureEvent("qf_v3_answer_selected", properties);
|
|
10089
|
+
}
|
|
10090
|
+
function trackFormSubmitted(context, metadata) {
|
|
10091
|
+
if (!context.session_id) {
|
|
10092
|
+
console.warn("[Tracking] trackFormSubmitted called with empty session_id", context);
|
|
10093
|
+
}
|
|
10094
|
+
const properties = {
|
|
10095
|
+
funnel_mode: context.funnel_mode,
|
|
10096
|
+
session_id: context.session_id,
|
|
10097
|
+
total_steps: context.total_steps,
|
|
10098
|
+
...metadata
|
|
10099
|
+
};
|
|
10100
|
+
if (context.service_type) {
|
|
10101
|
+
properties.service_type = context.service_type;
|
|
10102
|
+
}
|
|
10103
|
+
if (context.city) {
|
|
10104
|
+
properties.city = context.city;
|
|
10105
|
+
}
|
|
10106
|
+
captureEvent("qf_v3_form_submitted", properties);
|
|
10107
|
+
}
|
|
10108
|
+
function trackCompleted(context) {
|
|
10109
|
+
if (!context.session_id) {
|
|
10110
|
+
console.warn("[Tracking] trackCompleted called with empty session_id", context);
|
|
10111
|
+
}
|
|
10112
|
+
const properties = {
|
|
10113
|
+
funnel_mode: context.funnel_mode,
|
|
10114
|
+
session_id: context.session_id,
|
|
10115
|
+
total_steps: context.total_steps
|
|
10116
|
+
};
|
|
10117
|
+
if (context.service_type) {
|
|
10118
|
+
properties.service_type = context.service_type;
|
|
10119
|
+
}
|
|
10120
|
+
if (context.city) {
|
|
10121
|
+
properties.city = context.city;
|
|
10122
|
+
}
|
|
10123
|
+
captureEvent("qf_v3_completed", properties);
|
|
10124
|
+
}
|
|
10125
|
+
function trackAbandoned(context, lastStep) {
|
|
10126
|
+
if (!context.session_id) {
|
|
10127
|
+
console.warn("[Tracking] trackAbandoned called with empty session_id", context);
|
|
10128
|
+
}
|
|
10129
|
+
const properties = {
|
|
10130
|
+
funnel_mode: context.funnel_mode,
|
|
10131
|
+
session_id: context.session_id,
|
|
10132
|
+
total_steps: context.total_steps,
|
|
10133
|
+
step_id: lastStep.step_id,
|
|
10134
|
+
step_index: lastStep.step_index
|
|
10135
|
+
};
|
|
10136
|
+
if (context.service_type) {
|
|
10137
|
+
properties.service_type = context.service_type;
|
|
10138
|
+
}
|
|
10139
|
+
if (context.city) {
|
|
10140
|
+
properties.city = context.city;
|
|
10141
|
+
}
|
|
10142
|
+
captureEvent("qf_v3_abandoned", properties);
|
|
10143
|
+
}
|
|
10144
|
+
function trackStarted(context, initialStepId) {
|
|
10145
|
+
const properties = {
|
|
10146
|
+
funnel_mode: context.funnel_mode,
|
|
10147
|
+
session_id: context.session_id,
|
|
10148
|
+
initial_step: initialStepId
|
|
10149
|
+
};
|
|
10150
|
+
captureEvent("qf_v3_started", properties);
|
|
10151
|
+
}
|
|
10152
|
+
const TrackingContext = createContext(null);
|
|
10153
|
+
function TrackingProvider({
|
|
10154
|
+
funnelContextRef,
|
|
10155
|
+
updateContext,
|
|
10156
|
+
currentStepId,
|
|
10157
|
+
children
|
|
10158
|
+
}) {
|
|
10159
|
+
const { state } = useQualification();
|
|
10160
|
+
const trackAnswer = useCallback(
|
|
10161
|
+
(questionId, value) => {
|
|
10162
|
+
if (!("qualification" in state)) return;
|
|
10163
|
+
const qual = state.qualification;
|
|
10164
|
+
if (!("step" in qual)) return;
|
|
10165
|
+
const step2 = qual.step;
|
|
10166
|
+
const stepIndex = qual.stepIndex;
|
|
10167
|
+
const schemaStep = SCHEMA_STEPS[step2.id];
|
|
10168
|
+
const questions2 = (schemaStep == null ? void 0 : schemaStep.questions) || [];
|
|
10169
|
+
const questionIndex = questions2.findIndex((q2) => q2.id === questionId);
|
|
10170
|
+
const isLastQuestion = questionIndex === questions2.length - 1;
|
|
10171
|
+
const sessionKey = `qf_v3_started_${funnelContextRef.current.session_id}`;
|
|
10172
|
+
if (typeof sessionStorage !== "undefined") {
|
|
10173
|
+
const hasStarted = sessionStorage.getItem(sessionKey);
|
|
10174
|
+
if (!hasStarted) {
|
|
10175
|
+
sessionStorage.setItem(sessionKey, "true");
|
|
10176
|
+
trackStarted(funnelContextRef.current, currentStepId);
|
|
10177
|
+
}
|
|
10178
|
+
}
|
|
10179
|
+
if (questionId === "service_type") {
|
|
10180
|
+
const serviceType = value;
|
|
10181
|
+
if (serviceType) {
|
|
10182
|
+
const stepOrder = getStepOrderForServiceType(serviceType);
|
|
10183
|
+
delete funnelContextRef.current.city;
|
|
10184
|
+
updateContext({
|
|
10185
|
+
service_type: serviceType,
|
|
10186
|
+
total_steps: stepOrder.length
|
|
10187
|
+
});
|
|
10188
|
+
}
|
|
10189
|
+
} else if (questionId === "city") {
|
|
10190
|
+
updateContext({ city: value });
|
|
10191
|
+
}
|
|
10192
|
+
trackAnswerSelected(funnelContextRef.current, {
|
|
10193
|
+
step_id: step2.id,
|
|
10194
|
+
step_index: stepIndex,
|
|
10195
|
+
question_id: questionId,
|
|
10196
|
+
answer_value: value,
|
|
10197
|
+
is_last_question: isLastQuestion
|
|
10198
|
+
});
|
|
10199
|
+
},
|
|
10200
|
+
[funnelContextRef, currentStepId, state, updateContext]
|
|
10201
|
+
);
|
|
10202
|
+
return /* @__PURE__ */ jsx(TrackingContext.Provider, { value: { funnelContextRef, currentStepId, trackAnswer }, children });
|
|
10203
|
+
}
|
|
10204
|
+
function useTracking() {
|
|
10205
|
+
const context = useContext(TrackingContext);
|
|
10206
|
+
if (!context) {
|
|
10207
|
+
const defaultRef = {
|
|
10208
|
+
current: {
|
|
10209
|
+
session_id: "",
|
|
10210
|
+
funnel_mode: "embedded",
|
|
10211
|
+
service_type: "",
|
|
10212
|
+
total_steps: 0
|
|
10213
|
+
}
|
|
10214
|
+
};
|
|
10215
|
+
return {
|
|
10216
|
+
funnelContextRef: defaultRef,
|
|
10217
|
+
currentStepId: "",
|
|
10218
|
+
trackAnswer: () => {
|
|
10219
|
+
}
|
|
10220
|
+
};
|
|
10221
|
+
}
|
|
10222
|
+
return context;
|
|
10223
|
+
}
|
|
10055
10224
|
function BudgetQuestionWithPeopleCount() {
|
|
10056
10225
|
var _a2, _b;
|
|
10057
10226
|
const { answerOf, errorsOf, actions } = useQualification();
|
|
10058
10227
|
const { t: t2 } = useTranslation();
|
|
10059
10228
|
const { currentUserAccount } = useCurrentUser();
|
|
10229
|
+
const { trackAnswer } = useTracking();
|
|
10060
10230
|
const isManagedAccount = (_b = (_a2 = currentUserAccount == null ? void 0 : currentUserAccount.owner) == null ? void 0 : _a2.salesforceCustomer) == null ? void 0 : _b.isManagedAccount;
|
|
10061
10231
|
const peopleCountAnswer = answerOf(questions$2.peopleCount.id);
|
|
10062
10232
|
const peopleCountErrors = errorsOf(questions$2.peopleCount.id);
|
|
@@ -10073,7 +10243,10 @@ function BudgetQuestionWithPeopleCount() {
|
|
|
10073
10243
|
id: questions$2.peopleCount.id,
|
|
10074
10244
|
value: peopleCountAnswer || 0,
|
|
10075
10245
|
error: !!(peopleCountErrors == null ? void 0 : peopleCountErrors.length),
|
|
10076
|
-
onChange: (value) =>
|
|
10246
|
+
onChange: (value) => {
|
|
10247
|
+
actions.answerQuestion(questions$2.peopleCount.id, value);
|
|
10248
|
+
trackAnswer(questions$2.peopleCount.id, value);
|
|
10249
|
+
},
|
|
10077
10250
|
autoFocus: false
|
|
10078
10251
|
}
|
|
10079
10252
|
) }),
|
|
@@ -10082,7 +10255,10 @@ function BudgetQuestionWithPeopleCount() {
|
|
|
10082
10255
|
{
|
|
10083
10256
|
questionId: questions$2.peopleCount.id,
|
|
10084
10257
|
suggestions: peopleCountQuestion.suggestions || [],
|
|
10085
|
-
onSelect: (value) =>
|
|
10258
|
+
onSelect: (value) => {
|
|
10259
|
+
actions.answerQuestion(questions$2.peopleCount.id, value);
|
|
10260
|
+
trackAnswer(questions$2.peopleCount.id, value);
|
|
10261
|
+
}
|
|
10086
10262
|
}
|
|
10087
10263
|
) }),
|
|
10088
10264
|
/* @__PURE__ */ jsx(Divider, { my: 4 }),
|
|
@@ -10100,6 +10276,7 @@ function BudgetQuestionWithPeopleCount() {
|
|
|
10100
10276
|
actions.answerQuestion(pricePerPersonQuestion.id, val, {
|
|
10101
10277
|
isManagedAccount
|
|
10102
10278
|
});
|
|
10279
|
+
trackAnswer(pricePerPersonQuestion.id, val);
|
|
10103
10280
|
}
|
|
10104
10281
|
}
|
|
10105
10282
|
) }),
|
|
@@ -10113,9 +10290,12 @@ function BudgetQuestionWithPeopleCount() {
|
|
|
10113
10290
|
autoFocus: false,
|
|
10114
10291
|
error: !!(budgetErrors == null ? void 0 : budgetErrors.length),
|
|
10115
10292
|
value: budgetAnswer ? Math.floor(budgetAnswer) : 0,
|
|
10116
|
-
onChange: (val) =>
|
|
10117
|
-
|
|
10118
|
-
|
|
10293
|
+
onChange: (val) => {
|
|
10294
|
+
actions.answerQuestion(totalBudgetQuestion.id, Math.floor(val), {
|
|
10295
|
+
isManagedAccount
|
|
10296
|
+
});
|
|
10297
|
+
trackAnswer(totalBudgetQuestion.id, Math.floor(val));
|
|
10298
|
+
}
|
|
10119
10299
|
}
|
|
10120
10300
|
),
|
|
10121
10301
|
/* @__PURE__ */ jsx(FullRowBox, { mt: 2, children: /* @__PURE__ */ jsx(ErrorWrapper, { children: pricePerPersonErrors[0] || budgetErrors[0] }) })
|
|
@@ -10245,7 +10425,12 @@ const BudgetRangeTiles = ({
|
|
|
10245
10425
|
variant = "primary"
|
|
10246
10426
|
}) => {
|
|
10247
10427
|
const { i18n } = useTranslation();
|
|
10428
|
+
const { trackAnswer } = useTracking();
|
|
10248
10429
|
const isGerman = i18n.language === "de";
|
|
10430
|
+
const handleSelect = (range2) => {
|
|
10431
|
+
onSelect(range2);
|
|
10432
|
+
trackAnswer("budget_range", range2);
|
|
10433
|
+
};
|
|
10249
10434
|
return /* @__PURE__ */ jsx(TilesWrapper, { children: BUDGET_RANGE_ITEMS.map((item) => {
|
|
10250
10435
|
const label = isGerman ? item.labelDe : item.labelEn;
|
|
10251
10436
|
return /* @__PURE__ */ jsxs(
|
|
@@ -10256,7 +10441,7 @@ const BudgetRangeTiles = ({
|
|
|
10256
10441
|
id: `tile__budget-range--${item.value}`,
|
|
10257
10442
|
onClick: (e2) => {
|
|
10258
10443
|
e2.currentTarget.blur();
|
|
10259
|
-
|
|
10444
|
+
handleSelect(item.value);
|
|
10260
10445
|
},
|
|
10261
10446
|
children: [
|
|
10262
10447
|
/* @__PURE__ */ jsx(IconWrapper$5, { children: /* @__PURE__ */ jsx(BudgetText, { children: item.display }) }),
|
|
@@ -10513,6 +10698,7 @@ function DatePickerEmbedded() {
|
|
|
10513
10698
|
var _a2, _b;
|
|
10514
10699
|
const router = useRouter();
|
|
10515
10700
|
const { answerOf, actions, state } = useQualification();
|
|
10701
|
+
const { trackAnswer } = useTracking();
|
|
10516
10702
|
const answer = answerOf("event_date");
|
|
10517
10703
|
const date2 = answer;
|
|
10518
10704
|
const activeDate = date2 ? new Date(date2) : void 0;
|
|
@@ -10549,7 +10735,10 @@ function DatePickerEmbedded() {
|
|
|
10549
10735
|
formatWeekdayName: (day, options) => format(day, "EEEEE", { locale: options == null ? void 0 : options.locale })
|
|
10550
10736
|
},
|
|
10551
10737
|
month,
|
|
10552
|
-
onDayClick: (date22) =>
|
|
10738
|
+
onDayClick: (date22) => {
|
|
10739
|
+
actions.answerQuestion("event_date", date22);
|
|
10740
|
+
trackAnswer("event_date", date22);
|
|
10741
|
+
},
|
|
10553
10742
|
selected: activeDate,
|
|
10554
10743
|
fromDate: minimumDate,
|
|
10555
10744
|
onMonthChange: setMonth,
|
|
@@ -10780,7 +10969,12 @@ const DeliveryFrequencyTiles = ({
|
|
|
10780
10969
|
variant = "primary"
|
|
10781
10970
|
}) => {
|
|
10782
10971
|
const { i18n } = useTranslation();
|
|
10972
|
+
const { trackAnswer } = useTracking();
|
|
10783
10973
|
const isGerman = i18n.language === "de";
|
|
10974
|
+
const handleSelect = (frequency) => {
|
|
10975
|
+
onSelect(frequency);
|
|
10976
|
+
trackAnswer("delivery_frequency", frequency);
|
|
10977
|
+
};
|
|
10784
10978
|
return /* @__PURE__ */ jsx(TilesWrapper, { children: DELIVERY_FREQUENCY_ITEMS.map((item) => {
|
|
10785
10979
|
const label = isGerman ? item.labelDe : item.labelEn;
|
|
10786
10980
|
const isNotSure = item.value === "not_sure";
|
|
@@ -10792,7 +10986,7 @@ const DeliveryFrequencyTiles = ({
|
|
|
10792
10986
|
id: `tile__delivery-frequency--${item.value}`,
|
|
10793
10987
|
onClick: (e2) => {
|
|
10794
10988
|
e2.currentTarget.blur();
|
|
10795
|
-
|
|
10989
|
+
handleSelect(item.value);
|
|
10796
10990
|
},
|
|
10797
10991
|
children: [
|
|
10798
10992
|
/* @__PURE__ */ jsx(IconWrapper$4, { opacity: isNotSure ? 0.4 : 1, children: isNotSure ? /* @__PURE__ */ jsx(QuestionMark, { height: "1em" }) : /* @__PURE__ */ jsx(FrequencyText, { children: getTextForFrequency(item.value) }) }),
|
|
@@ -10838,6 +11032,7 @@ SCHEMA_STEPS.dietary_restrictions;
|
|
|
10838
11032
|
const DietaryStepper = ({ question, autoFocus }) => {
|
|
10839
11033
|
const { localizedAttributeName } = useLocalizedFieldName();
|
|
10840
11034
|
const { state, actions, answerOf } = useQualification();
|
|
11035
|
+
const { trackAnswer } = useTracking();
|
|
10841
11036
|
const localizedOptions = useMemo(
|
|
10842
11037
|
() => {
|
|
10843
11038
|
var _a2, _b;
|
|
@@ -10854,6 +11049,7 @@ const DietaryStepper = ({ question, autoFocus }) => {
|
|
|
10854
11049
|
const answer = answerOf(question.id);
|
|
10855
11050
|
const handleChange = (value) => {
|
|
10856
11051
|
actions.answerQuestion(question.id, value);
|
|
11052
|
+
trackAnswer(question.id, value);
|
|
10857
11053
|
};
|
|
10858
11054
|
return /* @__PURE__ */ jsx(Box, { my: 2, children: /* @__PURE__ */ jsxs(GridWrapper$1, { children: [
|
|
10859
11055
|
/* @__PURE__ */ jsxs(
|
|
@@ -11014,175 +11210,6 @@ function FullServiceIcon(props) {
|
|
|
11014
11210
|
}
|
|
11015
11211
|
);
|
|
11016
11212
|
}
|
|
11017
|
-
function captureEvent(eventName, properties) {
|
|
11018
|
-
if (typeof window === "undefined") return;
|
|
11019
|
-
if (window.posthog) {
|
|
11020
|
-
try {
|
|
11021
|
-
window.posthog.capture(eventName, properties);
|
|
11022
|
-
} catch (error) {
|
|
11023
|
-
console.error("[PostHog] Failed to send event:", error);
|
|
11024
|
-
}
|
|
11025
|
-
}
|
|
11026
|
-
if (window.dataLayer) {
|
|
11027
|
-
window.dataLayer.push({
|
|
11028
|
-
event: eventName,
|
|
11029
|
-
...properties
|
|
11030
|
-
});
|
|
11031
|
-
}
|
|
11032
|
-
}
|
|
11033
|
-
function trackAnswerSelected(context, answer) {
|
|
11034
|
-
const properties = {
|
|
11035
|
-
funnel_mode: context.funnel_mode,
|
|
11036
|
-
session_id: context.session_id,
|
|
11037
|
-
total_steps: context.total_steps,
|
|
11038
|
-
step_id: answer.step_id,
|
|
11039
|
-
step_index: answer.step_index,
|
|
11040
|
-
question_id: answer.question_id,
|
|
11041
|
-
answer_value: answer.answer_value,
|
|
11042
|
-
is_last_question: answer.is_last_question
|
|
11043
|
-
};
|
|
11044
|
-
if (context.service_type) {
|
|
11045
|
-
properties.service_type = context.service_type;
|
|
11046
|
-
}
|
|
11047
|
-
if (context.city) {
|
|
11048
|
-
properties.city = context.city;
|
|
11049
|
-
}
|
|
11050
|
-
captureEvent("qf_v2_answer_selected", properties);
|
|
11051
|
-
}
|
|
11052
|
-
function trackFormSubmitted(context, metadata) {
|
|
11053
|
-
if (!context.session_id) {
|
|
11054
|
-
console.warn("[Tracking] trackFormSubmitted called with empty session_id", context);
|
|
11055
|
-
}
|
|
11056
|
-
const properties = {
|
|
11057
|
-
funnel_mode: context.funnel_mode,
|
|
11058
|
-
session_id: context.session_id,
|
|
11059
|
-
total_steps: context.total_steps,
|
|
11060
|
-
...metadata
|
|
11061
|
-
};
|
|
11062
|
-
if (context.service_type) {
|
|
11063
|
-
properties.service_type = context.service_type;
|
|
11064
|
-
}
|
|
11065
|
-
if (context.city) {
|
|
11066
|
-
properties.city = context.city;
|
|
11067
|
-
}
|
|
11068
|
-
captureEvent("qf_v2_form_submitted", properties);
|
|
11069
|
-
}
|
|
11070
|
-
function trackCompleted(context) {
|
|
11071
|
-
if (!context.session_id) {
|
|
11072
|
-
console.warn("[Tracking] trackCompleted called with empty session_id", context);
|
|
11073
|
-
}
|
|
11074
|
-
const properties = {
|
|
11075
|
-
funnel_mode: context.funnel_mode,
|
|
11076
|
-
session_id: context.session_id,
|
|
11077
|
-
total_steps: context.total_steps
|
|
11078
|
-
};
|
|
11079
|
-
if (context.service_type) {
|
|
11080
|
-
properties.service_type = context.service_type;
|
|
11081
|
-
}
|
|
11082
|
-
if (context.city) {
|
|
11083
|
-
properties.city = context.city;
|
|
11084
|
-
}
|
|
11085
|
-
captureEvent("qf_v2_completed", properties);
|
|
11086
|
-
}
|
|
11087
|
-
function trackAbandoned(context, lastStep) {
|
|
11088
|
-
if (!context.session_id) {
|
|
11089
|
-
console.warn("[Tracking] trackAbandoned called with empty session_id", context);
|
|
11090
|
-
}
|
|
11091
|
-
const properties = {
|
|
11092
|
-
funnel_mode: context.funnel_mode,
|
|
11093
|
-
session_id: context.session_id,
|
|
11094
|
-
total_steps: context.total_steps,
|
|
11095
|
-
step_id: lastStep.step_id,
|
|
11096
|
-
step_index: lastStep.step_index
|
|
11097
|
-
};
|
|
11098
|
-
if (context.service_type) {
|
|
11099
|
-
properties.service_type = context.service_type;
|
|
11100
|
-
}
|
|
11101
|
-
if (context.city) {
|
|
11102
|
-
properties.city = context.city;
|
|
11103
|
-
}
|
|
11104
|
-
captureEvent("qf_v2_abandoned", properties);
|
|
11105
|
-
}
|
|
11106
|
-
function trackStarted(context, initialStepId) {
|
|
11107
|
-
const properties = {
|
|
11108
|
-
funnel_mode: context.funnel_mode,
|
|
11109
|
-
session_id: context.session_id,
|
|
11110
|
-
initial_step: initialStepId
|
|
11111
|
-
};
|
|
11112
|
-
captureEvent("qf_v2_started", properties);
|
|
11113
|
-
}
|
|
11114
|
-
const TrackingContext = createContext(null);
|
|
11115
|
-
function TrackingProvider({
|
|
11116
|
-
funnelContextRef,
|
|
11117
|
-
updateContext,
|
|
11118
|
-
currentStepId,
|
|
11119
|
-
children
|
|
11120
|
-
}) {
|
|
11121
|
-
const { state } = useQualification();
|
|
11122
|
-
const trackAnswer = useCallback(
|
|
11123
|
-
(questionId, value) => {
|
|
11124
|
-
if (!("qualification" in state)) return;
|
|
11125
|
-
const qual = state.qualification;
|
|
11126
|
-
if (!("step" in qual)) return;
|
|
11127
|
-
const step2 = qual.step;
|
|
11128
|
-
const stepIndex = qual.stepIndex;
|
|
11129
|
-
const schemaStep = SCHEMA_STEPS[step2.id];
|
|
11130
|
-
const questions2 = (schemaStep == null ? void 0 : schemaStep.questions) || [];
|
|
11131
|
-
const questionIndex = questions2.findIndex((q2) => q2.id === questionId);
|
|
11132
|
-
const isLastQuestion = questionIndex === questions2.length - 1;
|
|
11133
|
-
const sessionKey = `qf_v2_started_${funnelContextRef.current.session_id}`;
|
|
11134
|
-
if (typeof sessionStorage !== "undefined") {
|
|
11135
|
-
const hasStarted = sessionStorage.getItem(sessionKey);
|
|
11136
|
-
if (!hasStarted) {
|
|
11137
|
-
sessionStorage.setItem(sessionKey, "true");
|
|
11138
|
-
trackStarted(funnelContextRef.current, currentStepId);
|
|
11139
|
-
}
|
|
11140
|
-
}
|
|
11141
|
-
if (questionId === "service_type") {
|
|
11142
|
-
const serviceType = value;
|
|
11143
|
-
if (serviceType) {
|
|
11144
|
-
const stepOrder = getStepOrderForServiceType(serviceType);
|
|
11145
|
-
delete funnelContextRef.current.city;
|
|
11146
|
-
updateContext({
|
|
11147
|
-
service_type: serviceType,
|
|
11148
|
-
total_steps: stepOrder.length
|
|
11149
|
-
});
|
|
11150
|
-
}
|
|
11151
|
-
} else if (questionId === "city") {
|
|
11152
|
-
updateContext({ city: value });
|
|
11153
|
-
}
|
|
11154
|
-
trackAnswerSelected(funnelContextRef.current, {
|
|
11155
|
-
step_id: step2.id,
|
|
11156
|
-
step_index: stepIndex,
|
|
11157
|
-
question_id: questionId,
|
|
11158
|
-
answer_value: value,
|
|
11159
|
-
is_last_question: isLastQuestion
|
|
11160
|
-
});
|
|
11161
|
-
},
|
|
11162
|
-
[funnelContextRef, currentStepId, state, updateContext]
|
|
11163
|
-
);
|
|
11164
|
-
return /* @__PURE__ */ jsx(TrackingContext.Provider, { value: { funnelContextRef, currentStepId, trackAnswer }, children });
|
|
11165
|
-
}
|
|
11166
|
-
function useTracking() {
|
|
11167
|
-
const context = useContext(TrackingContext);
|
|
11168
|
-
if (!context) {
|
|
11169
|
-
const defaultRef = {
|
|
11170
|
-
current: {
|
|
11171
|
-
session_id: "",
|
|
11172
|
-
funnel_mode: "embedded",
|
|
11173
|
-
service_type: "",
|
|
11174
|
-
total_steps: 0
|
|
11175
|
-
}
|
|
11176
|
-
};
|
|
11177
|
-
return {
|
|
11178
|
-
funnelContextRef: defaultRef,
|
|
11179
|
-
currentStepId: "",
|
|
11180
|
-
trackAnswer: () => {
|
|
11181
|
-
}
|
|
11182
|
-
};
|
|
11183
|
-
}
|
|
11184
|
-
return context;
|
|
11185
|
-
}
|
|
11186
11213
|
const tileIcons$1 = SERVICE_TYPE_ITEMS.map((item) => ({
|
|
11187
11214
|
id: item.value,
|
|
11188
11215
|
Icon: getIconForServiceType(item.value),
|
|
@@ -11502,6 +11529,11 @@ const TeamSizeInput = ({
|
|
|
11502
11529
|
suggestions,
|
|
11503
11530
|
autoFocus
|
|
11504
11531
|
}) => {
|
|
11532
|
+
const { trackAnswer } = useTracking();
|
|
11533
|
+
const handleChange = (val) => {
|
|
11534
|
+
onChange(val);
|
|
11535
|
+
trackAnswer(questionId, val);
|
|
11536
|
+
};
|
|
11505
11537
|
return /* @__PURE__ */ jsxs(Wrapper$1, { children: [
|
|
11506
11538
|
/* @__PURE__ */ jsx(Box, { mb: 3, children: /* @__PURE__ */ jsx(Typography, { as: "label", htmlFor: questionId, children: label }) }),
|
|
11507
11539
|
/* @__PURE__ */ jsx(Box, { mb: (suggestions == null ? void 0 : suggestions.length) ? 3 : 0, children: /* @__PURE__ */ jsx(
|
|
@@ -11511,7 +11543,7 @@ const TeamSizeInput = ({
|
|
|
11511
11543
|
name: questionId,
|
|
11512
11544
|
value,
|
|
11513
11545
|
error,
|
|
11514
|
-
onChange: (val) =>
|
|
11546
|
+
onChange: (val) => handleChange(Number(val)),
|
|
11515
11547
|
placeholder,
|
|
11516
11548
|
autoFocus
|
|
11517
11549
|
}
|
|
@@ -11521,7 +11553,7 @@ const TeamSizeInput = ({
|
|
|
11521
11553
|
{
|
|
11522
11554
|
questionId,
|
|
11523
11555
|
suggestions,
|
|
11524
|
-
onSelect:
|
|
11556
|
+
onSelect: handleChange
|
|
11525
11557
|
}
|
|
11526
11558
|
) : null
|
|
11527
11559
|
] });
|
|
@@ -12271,7 +12303,7 @@ var objectInspect = function inspect_(obj, options, depth, seen) {
|
|
|
12271
12303
|
var ys = arrObjKeys(obj, inspect2);
|
|
12272
12304
|
var isPlainObject2 = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
|
|
12273
12305
|
var protoTag = obj instanceof Object ? "" : "null prototype";
|
|
12274
|
-
var stringTag2 = !isPlainObject2 && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr
|
|
12306
|
+
var stringTag2 = !isPlainObject2 && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? "Object" : "";
|
|
12275
12307
|
var constructorTag = isPlainObject2 || typeof obj.constructor !== "function" ? "" : obj.constructor.name ? obj.constructor.name + " " : "";
|
|
12276
12308
|
var tag = constructorTag + (stringTag2 || protoTag ? "[" + $join.call($concat$1.call([], stringTag2 || [], protoTag || []), ": ") + "] " : "");
|
|
12277
12309
|
if (ys.length === 0) {
|
|
@@ -12296,25 +12328,25 @@ function canTrustToString(obj) {
|
|
|
12296
12328
|
return !toStringTag || !(typeof obj === "object" && (toStringTag in obj || typeof obj[toStringTag] !== "undefined"));
|
|
12297
12329
|
}
|
|
12298
12330
|
function isArray$3(obj) {
|
|
12299
|
-
return toStr
|
|
12331
|
+
return toStr(obj) === "[object Array]" && canTrustToString(obj);
|
|
12300
12332
|
}
|
|
12301
12333
|
function isDate(obj) {
|
|
12302
|
-
return toStr
|
|
12334
|
+
return toStr(obj) === "[object Date]" && canTrustToString(obj);
|
|
12303
12335
|
}
|
|
12304
12336
|
function isRegExp$1(obj) {
|
|
12305
|
-
return toStr
|
|
12337
|
+
return toStr(obj) === "[object RegExp]" && canTrustToString(obj);
|
|
12306
12338
|
}
|
|
12307
12339
|
function isError(obj) {
|
|
12308
|
-
return toStr
|
|
12340
|
+
return toStr(obj) === "[object Error]" && canTrustToString(obj);
|
|
12309
12341
|
}
|
|
12310
12342
|
function isString(obj) {
|
|
12311
|
-
return toStr
|
|
12343
|
+
return toStr(obj) === "[object String]" && canTrustToString(obj);
|
|
12312
12344
|
}
|
|
12313
12345
|
function isNumber(obj) {
|
|
12314
|
-
return toStr
|
|
12346
|
+
return toStr(obj) === "[object Number]" && canTrustToString(obj);
|
|
12315
12347
|
}
|
|
12316
12348
|
function isBoolean(obj) {
|
|
12317
|
-
return toStr
|
|
12349
|
+
return toStr(obj) === "[object Boolean]" && canTrustToString(obj);
|
|
12318
12350
|
}
|
|
12319
12351
|
function isSymbol(obj) {
|
|
12320
12352
|
if (hasShammedSymbols) {
|
|
@@ -12350,7 +12382,7 @@ var hasOwn$1 = Object.prototype.hasOwnProperty || function(key) {
|
|
|
12350
12382
|
function has$4(obj, key) {
|
|
12351
12383
|
return hasOwn$1.call(obj, key);
|
|
12352
12384
|
}
|
|
12353
|
-
function toStr
|
|
12385
|
+
function toStr(obj) {
|
|
12354
12386
|
return objectToString.call(obj);
|
|
12355
12387
|
}
|
|
12356
12388
|
function nameOf(f) {
|
|
@@ -12659,7 +12691,7 @@ var syntax = SyntaxError;
|
|
|
12659
12691
|
var uri = URIError;
|
|
12660
12692
|
var abs$1 = Math.abs;
|
|
12661
12693
|
var floor$1 = Math.floor;
|
|
12662
|
-
var max$
|
|
12694
|
+
var max$1 = Math.max;
|
|
12663
12695
|
var min$1 = Math.min;
|
|
12664
12696
|
var pow$1 = Math.pow;
|
|
12665
12697
|
var round$2 = Math.round;
|
|
@@ -12788,78 +12820,99 @@ function requireObject_getPrototypeOf() {
|
|
|
12788
12820
|
Object_getPrototypeOf = $Object2.getPrototypeOf || null;
|
|
12789
12821
|
return Object_getPrototypeOf;
|
|
12790
12822
|
}
|
|
12791
|
-
var
|
|
12792
|
-
var
|
|
12793
|
-
|
|
12794
|
-
|
|
12795
|
-
|
|
12796
|
-
var
|
|
12797
|
-
|
|
12798
|
-
|
|
12799
|
-
|
|
12800
|
-
|
|
12801
|
-
arr
|
|
12802
|
-
|
|
12803
|
-
|
|
12804
|
-
};
|
|
12805
|
-
var slicy = function slicy2(arrLike, offset2) {
|
|
12806
|
-
var arr = [];
|
|
12807
|
-
for (var i2 = offset2, j = 0; i2 < arrLike.length; i2 += 1, j += 1) {
|
|
12808
|
-
arr[j] = arrLike[i2];
|
|
12809
|
-
}
|
|
12810
|
-
return arr;
|
|
12811
|
-
};
|
|
12812
|
-
var joiny = function(arr, joiner) {
|
|
12813
|
-
var str = "";
|
|
12814
|
-
for (var i2 = 0; i2 < arr.length; i2 += 1) {
|
|
12815
|
-
str += arr[i2];
|
|
12816
|
-
if (i2 + 1 < arr.length) {
|
|
12817
|
-
str += joiner;
|
|
12823
|
+
var implementation;
|
|
12824
|
+
var hasRequiredImplementation;
|
|
12825
|
+
function requireImplementation() {
|
|
12826
|
+
if (hasRequiredImplementation) return implementation;
|
|
12827
|
+
hasRequiredImplementation = 1;
|
|
12828
|
+
var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
|
|
12829
|
+
var toStr2 = Object.prototype.toString;
|
|
12830
|
+
var max2 = Math.max;
|
|
12831
|
+
var funcType = "[object Function]";
|
|
12832
|
+
var concatty = function concatty2(a3, b2) {
|
|
12833
|
+
var arr = [];
|
|
12834
|
+
for (var i2 = 0; i2 < a3.length; i2 += 1) {
|
|
12835
|
+
arr[i2] = a3[i2];
|
|
12818
12836
|
}
|
|
12819
|
-
|
|
12820
|
-
|
|
12821
|
-
}
|
|
12822
|
-
|
|
12823
|
-
|
|
12824
|
-
|
|
12825
|
-
|
|
12826
|
-
|
|
12827
|
-
|
|
12828
|
-
|
|
12829
|
-
|
|
12830
|
-
|
|
12831
|
-
|
|
12832
|
-
|
|
12833
|
-
|
|
12834
|
-
|
|
12835
|
-
if (
|
|
12836
|
-
|
|
12837
|
+
for (var j = 0; j < b2.length; j += 1) {
|
|
12838
|
+
arr[j + a3.length] = b2[j];
|
|
12839
|
+
}
|
|
12840
|
+
return arr;
|
|
12841
|
+
};
|
|
12842
|
+
var slicy = function slicy2(arrLike, offset2) {
|
|
12843
|
+
var arr = [];
|
|
12844
|
+
for (var i2 = offset2, j = 0; i2 < arrLike.length; i2 += 1, j += 1) {
|
|
12845
|
+
arr[j] = arrLike[i2];
|
|
12846
|
+
}
|
|
12847
|
+
return arr;
|
|
12848
|
+
};
|
|
12849
|
+
var joiny = function(arr, joiner) {
|
|
12850
|
+
var str = "";
|
|
12851
|
+
for (var i2 = 0; i2 < arr.length; i2 += 1) {
|
|
12852
|
+
str += arr[i2];
|
|
12853
|
+
if (i2 + 1 < arr.length) {
|
|
12854
|
+
str += joiner;
|
|
12837
12855
|
}
|
|
12838
|
-
return this;
|
|
12839
12856
|
}
|
|
12840
|
-
return
|
|
12841
|
-
that,
|
|
12842
|
-
concatty(args, arguments)
|
|
12843
|
-
);
|
|
12857
|
+
return str;
|
|
12844
12858
|
};
|
|
12845
|
-
|
|
12846
|
-
|
|
12847
|
-
|
|
12848
|
-
|
|
12849
|
-
|
|
12850
|
-
|
|
12851
|
-
|
|
12852
|
-
var
|
|
12859
|
+
implementation = function bind2(that) {
|
|
12860
|
+
var target = this;
|
|
12861
|
+
if (typeof target !== "function" || toStr2.apply(target) !== funcType) {
|
|
12862
|
+
throw new TypeError(ERROR_MESSAGE + target);
|
|
12863
|
+
}
|
|
12864
|
+
var args = slicy(arguments, 1);
|
|
12865
|
+
var bound;
|
|
12866
|
+
var binder = function() {
|
|
12867
|
+
if (this instanceof bound) {
|
|
12868
|
+
var result = target.apply(
|
|
12869
|
+
this,
|
|
12870
|
+
concatty(args, arguments)
|
|
12871
|
+
);
|
|
12872
|
+
if (Object(result) === result) {
|
|
12873
|
+
return result;
|
|
12874
|
+
}
|
|
12875
|
+
return this;
|
|
12876
|
+
}
|
|
12877
|
+
return target.apply(
|
|
12878
|
+
that,
|
|
12879
|
+
concatty(args, arguments)
|
|
12880
|
+
);
|
|
12853
12881
|
};
|
|
12854
|
-
|
|
12855
|
-
|
|
12856
|
-
|
|
12857
|
-
|
|
12858
|
-
|
|
12859
|
-
};
|
|
12860
|
-
|
|
12861
|
-
var
|
|
12862
|
-
|
|
12882
|
+
var boundLength = max2(0, target.length - args.length);
|
|
12883
|
+
var boundArgs = [];
|
|
12884
|
+
for (var i2 = 0; i2 < boundLength; i2++) {
|
|
12885
|
+
boundArgs[i2] = "$" + i2;
|
|
12886
|
+
}
|
|
12887
|
+
bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
|
|
12888
|
+
if (target.prototype) {
|
|
12889
|
+
var Empty = function Empty2() {
|
|
12890
|
+
};
|
|
12891
|
+
Empty.prototype = target.prototype;
|
|
12892
|
+
bound.prototype = new Empty();
|
|
12893
|
+
Empty.prototype = null;
|
|
12894
|
+
}
|
|
12895
|
+
return bound;
|
|
12896
|
+
};
|
|
12897
|
+
return implementation;
|
|
12898
|
+
}
|
|
12899
|
+
var functionBind;
|
|
12900
|
+
var hasRequiredFunctionBind;
|
|
12901
|
+
function requireFunctionBind() {
|
|
12902
|
+
if (hasRequiredFunctionBind) return functionBind;
|
|
12903
|
+
hasRequiredFunctionBind = 1;
|
|
12904
|
+
var implementation2 = requireImplementation();
|
|
12905
|
+
functionBind = Function.prototype.bind || implementation2;
|
|
12906
|
+
return functionBind;
|
|
12907
|
+
}
|
|
12908
|
+
var functionCall;
|
|
12909
|
+
var hasRequiredFunctionCall;
|
|
12910
|
+
function requireFunctionCall() {
|
|
12911
|
+
if (hasRequiredFunctionCall) return functionCall;
|
|
12912
|
+
hasRequiredFunctionCall = 1;
|
|
12913
|
+
functionCall = Function.prototype.call;
|
|
12914
|
+
return functionCall;
|
|
12915
|
+
}
|
|
12863
12916
|
var functionApply;
|
|
12864
12917
|
var hasRequiredFunctionApply;
|
|
12865
12918
|
function requireFunctionApply() {
|
|
@@ -12869,14 +12922,14 @@ function requireFunctionApply() {
|
|
|
12869
12922
|
return functionApply;
|
|
12870
12923
|
}
|
|
12871
12924
|
var reflectApply = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
|
|
12872
|
-
var bind$2 =
|
|
12925
|
+
var bind$2 = requireFunctionBind();
|
|
12873
12926
|
var $apply$1 = requireFunctionApply();
|
|
12874
|
-
var $call$2 =
|
|
12927
|
+
var $call$2 = requireFunctionCall();
|
|
12875
12928
|
var $reflectApply = reflectApply;
|
|
12876
12929
|
var actualApply = $reflectApply || bind$2.call($call$2, $apply$1);
|
|
12877
|
-
var bind$1 =
|
|
12930
|
+
var bind$1 = requireFunctionBind();
|
|
12878
12931
|
var $TypeError$4 = type;
|
|
12879
|
-
var $call$1 =
|
|
12932
|
+
var $call$1 = requireFunctionCall();
|
|
12880
12933
|
var $actualApply = actualApply;
|
|
12881
12934
|
var callBindApplyHelpers = function callBindBasic(args) {
|
|
12882
12935
|
if (args.length < 1 || typeof args[0] !== "function") {
|
|
@@ -12942,8 +12995,8 @@ function requireHasown() {
|
|
|
12942
12995
|
hasRequiredHasown = 1;
|
|
12943
12996
|
var call = Function.prototype.call;
|
|
12944
12997
|
var $hasOwn = Object.prototype.hasOwnProperty;
|
|
12945
|
-
var
|
|
12946
|
-
hasown =
|
|
12998
|
+
var bind2 = requireFunctionBind();
|
|
12999
|
+
hasown = bind2.call(call, $hasOwn);
|
|
12947
13000
|
return hasown;
|
|
12948
13001
|
}
|
|
12949
13002
|
var undefined$1;
|
|
@@ -12957,7 +13010,7 @@ var $TypeError$3 = type;
|
|
|
12957
13010
|
var $URIError = uri;
|
|
12958
13011
|
var abs = abs$1;
|
|
12959
13012
|
var floor = floor$1;
|
|
12960
|
-
var max = max$
|
|
13013
|
+
var max = max$1;
|
|
12961
13014
|
var min = min$1;
|
|
12962
13015
|
var pow = pow$1;
|
|
12963
13016
|
var round$1 = round$2;
|
|
@@ -12991,7 +13044,7 @@ var getProto = requireGetProto();
|
|
|
12991
13044
|
var $ObjectGPO = requireObject_getPrototypeOf();
|
|
12992
13045
|
var $ReflectGPO = requireReflect_getPrototypeOf();
|
|
12993
13046
|
var $apply = requireFunctionApply();
|
|
12994
|
-
var $call =
|
|
13047
|
+
var $call = requireFunctionCall();
|
|
12995
13048
|
var needsEval = {};
|
|
12996
13049
|
var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array);
|
|
12997
13050
|
var INTRINSICS = {
|
|
@@ -13162,13 +13215,13 @@ var LEGACY_ALIASES = {
|
|
|
13162
13215
|
"%WeakMapPrototype%": ["WeakMap", "prototype"],
|
|
13163
13216
|
"%WeakSetPrototype%": ["WeakSet", "prototype"]
|
|
13164
13217
|
};
|
|
13165
|
-
var
|
|
13218
|
+
var bind = requireFunctionBind();
|
|
13166
13219
|
var hasOwn = requireHasown();
|
|
13167
|
-
var $concat =
|
|
13168
|
-
var $spliceApply =
|
|
13169
|
-
var $replace =
|
|
13170
|
-
var $strSlice =
|
|
13171
|
-
var $exec =
|
|
13220
|
+
var $concat = bind.call($call, Array.prototype.concat);
|
|
13221
|
+
var $spliceApply = bind.call($apply, Array.prototype.splice);
|
|
13222
|
+
var $replace = bind.call($call, String.prototype.replace);
|
|
13223
|
+
var $strSlice = bind.call($call, String.prototype.slice);
|
|
13224
|
+
var $exec = bind.call($call, RegExp.prototype.exec);
|
|
13172
13225
|
var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
|
|
13173
13226
|
var reEscapeChar = /\\(\\)?/g;
|
|
13174
13227
|
var stringToPath = function stringToPath2(string2) {
|
|
@@ -26668,9 +26721,6 @@ function RequestForm({ header = null }) {
|
|
|
26668
26721
|
if (success) {
|
|
26669
26722
|
setIsActualUkLead(isUkLead);
|
|
26670
26723
|
setShowLeadSuccess(true);
|
|
26671
|
-
trackFormSubmitted(funnelContextRef.current, {
|
|
26672
|
-
is_uk_lead: isUkLead
|
|
26673
|
-
});
|
|
26674
26724
|
trackCompleted(funnelContextRef.current);
|
|
26675
26725
|
return;
|
|
26676
26726
|
} else {
|