@heycater/qualification-funnel 1.9.0 → 1.10.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/dist/heycater-funnel.iife.js +49 -49
- package/dist/index.cjs.js +102 -102
- package/dist/index.esm.js +7 -31
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -10085,7 +10085,7 @@ function trackAnswerSelected(context, answer) {
|
|
|
10085
10085
|
if (context.city) {
|
|
10086
10086
|
properties.city = context.city;
|
|
10087
10087
|
}
|
|
10088
|
-
captureEvent("
|
|
10088
|
+
captureEvent("qf_v9_answer_selected", properties);
|
|
10089
10089
|
}
|
|
10090
10090
|
function trackFormSubmitted(context, metadata) {
|
|
10091
10091
|
if (!context.session_id) {
|
|
@@ -10103,7 +10103,7 @@ function trackFormSubmitted(context, metadata) {
|
|
|
10103
10103
|
if (context.city) {
|
|
10104
10104
|
properties.city = context.city;
|
|
10105
10105
|
}
|
|
10106
|
-
captureEvent("
|
|
10106
|
+
captureEvent("qf_v9_form_submitted", properties);
|
|
10107
10107
|
}
|
|
10108
10108
|
function trackCompleted(context) {
|
|
10109
10109
|
if (!context.session_id) {
|
|
@@ -10120,7 +10120,7 @@ function trackCompleted(context) {
|
|
|
10120
10120
|
if (context.city) {
|
|
10121
10121
|
properties.city = context.city;
|
|
10122
10122
|
}
|
|
10123
|
-
captureEvent("
|
|
10123
|
+
captureEvent("qf_v9_completed", properties);
|
|
10124
10124
|
}
|
|
10125
10125
|
function trackAbandoned(context, lastStep) {
|
|
10126
10126
|
if (!context.session_id) {
|
|
@@ -10139,7 +10139,7 @@ function trackAbandoned(context, lastStep) {
|
|
|
10139
10139
|
if (context.city) {
|
|
10140
10140
|
properties.city = context.city;
|
|
10141
10141
|
}
|
|
10142
|
-
captureEvent("
|
|
10142
|
+
captureEvent("qf_v9_abandoned", properties);
|
|
10143
10143
|
}
|
|
10144
10144
|
function trackStarted(context, initialStepId) {
|
|
10145
10145
|
const properties = {
|
|
@@ -10147,7 +10147,7 @@ function trackStarted(context, initialStepId) {
|
|
|
10147
10147
|
session_id: context.session_id,
|
|
10148
10148
|
initial_step: initialStepId
|
|
10149
10149
|
};
|
|
10150
|
-
captureEvent("
|
|
10150
|
+
captureEvent("qf_v9_started", properties);
|
|
10151
10151
|
}
|
|
10152
10152
|
const TrackingContext = createContext(null);
|
|
10153
10153
|
function TrackingProvider({
|
|
@@ -10165,7 +10165,7 @@ function TrackingProvider({
|
|
|
10165
10165
|
const stepIndex = qual.stepIndex;
|
|
10166
10166
|
const schemaStep = SCHEMA_STEPS[step2.id];
|
|
10167
10167
|
const questions2 = (schemaStep == null ? void 0 : schemaStep.questions) || [];
|
|
10168
|
-
const sessionKey = `
|
|
10168
|
+
const sessionKey = `qf_v9_started_${funnelContextRef.current.session_id}`;
|
|
10169
10169
|
if (typeof sessionStorage !== "undefined") {
|
|
10170
10170
|
const hasStarted = sessionStorage.getItem(sessionKey);
|
|
10171
10171
|
if (!hasStarted) {
|
|
@@ -10196,23 +10196,6 @@ function TrackingProvider({
|
|
|
10196
10196
|
}, [funnelContextRef, currentStepId, state, updateContext, answerOf]);
|
|
10197
10197
|
const trackAnswer = useCallback(
|
|
10198
10198
|
(questionId, value) => {
|
|
10199
|
-
if (!("qualification" in state)) return;
|
|
10200
|
-
const qual = state.qualification;
|
|
10201
|
-
if (!("step" in qual)) return;
|
|
10202
|
-
const step2 = qual.step;
|
|
10203
|
-
const stepIndex = qual.stepIndex;
|
|
10204
|
-
const schemaStep = SCHEMA_STEPS[step2.id];
|
|
10205
|
-
const questions2 = (schemaStep == null ? void 0 : schemaStep.questions) || [];
|
|
10206
|
-
const questionIndex = questions2.findIndex((q2) => q2.id === questionId);
|
|
10207
|
-
const isLastQuestion = questionIndex === questions2.length - 1;
|
|
10208
|
-
const sessionKey = `qf_v8_started_${funnelContextRef.current.session_id}`;
|
|
10209
|
-
if (typeof sessionStorage !== "undefined") {
|
|
10210
|
-
const hasStarted = sessionStorage.getItem(sessionKey);
|
|
10211
|
-
if (!hasStarted) {
|
|
10212
|
-
sessionStorage.setItem(sessionKey, "true");
|
|
10213
|
-
trackStarted(funnelContextRef.current, currentStepId);
|
|
10214
|
-
}
|
|
10215
|
-
}
|
|
10216
10199
|
if (questionId === "service_type" && isValidServiceType(value)) {
|
|
10217
10200
|
const stepOrder = getStepOrderForServiceType(value);
|
|
10218
10201
|
delete funnelContextRef.current.city;
|
|
@@ -10223,15 +10206,8 @@ function TrackingProvider({
|
|
|
10223
10206
|
} else if (questionId === "city") {
|
|
10224
10207
|
updateContext({ city: value });
|
|
10225
10208
|
}
|
|
10226
|
-
trackAnswerSelected(funnelContextRef.current, {
|
|
10227
|
-
step_id: step2.id,
|
|
10228
|
-
step_index: stepIndex,
|
|
10229
|
-
question_id: questionId,
|
|
10230
|
-
answer_value: value,
|
|
10231
|
-
is_last_question: isLastQuestion
|
|
10232
|
-
});
|
|
10233
10209
|
},
|
|
10234
|
-
[funnelContextRef,
|
|
10210
|
+
[funnelContextRef, updateContext]
|
|
10235
10211
|
);
|
|
10236
10212
|
return /* @__PURE__ */ jsx(TrackingContext.Provider, { value: { funnelContextRef, currentStepId, trackAnswer, trackStepCompletion }, children });
|
|
10237
10213
|
}
|