@heycater/qualification-funnel 1.11.0 → 1.12.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 +96 -96
- package/dist/index.cjs.js +102 -102
- package/dist/index.esm.js +57 -12
- 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_v11_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_v11_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_v11_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_v11_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_v11_started", properties);
|
|
10151
10151
|
}
|
|
10152
10152
|
function serializeAnswerValue(value) {
|
|
10153
10153
|
if (value === void 0) return null;
|
|
@@ -10172,21 +10172,55 @@ function TrackingProvider({
|
|
|
10172
10172
|
}) {
|
|
10173
10173
|
const { state, answerOf } = useQualification();
|
|
10174
10174
|
const trackStepCompletion = useCallback(() => {
|
|
10175
|
+
var _a2;
|
|
10175
10176
|
if (!("qualification" in state)) return;
|
|
10176
10177
|
const qual = state.qualification;
|
|
10177
10178
|
if (!("step" in qual)) return;
|
|
10178
10179
|
const step2 = qual.step;
|
|
10179
10180
|
const stepIndex = qual.stepIndex;
|
|
10180
|
-
const
|
|
10181
|
-
const
|
|
10182
|
-
const
|
|
10181
|
+
const steps2 = ((_a2 = qual.steps) == null ? void 0 : _a2.filter((s3) => !s3.disabled)) || [];
|
|
10182
|
+
const sessionKey = `qf_v11_started_${funnelContextRef.current.session_id}`;
|
|
10183
|
+
const trackedStepsKey = `qf_v11_tracked_steps_${funnelContextRef.current.session_id}`;
|
|
10184
|
+
let isFirstTracking = false;
|
|
10183
10185
|
if (typeof sessionStorage !== "undefined") {
|
|
10184
10186
|
const hasStarted = sessionStorage.getItem(sessionKey);
|
|
10185
10187
|
if (!hasStarted) {
|
|
10188
|
+
isFirstTracking = true;
|
|
10186
10189
|
sessionStorage.setItem(sessionKey, "true");
|
|
10190
|
+
sessionStorage.setItem(trackedStepsKey, "[]");
|
|
10187
10191
|
trackStarted(funnelContextRef.current, currentStepId);
|
|
10188
10192
|
}
|
|
10189
10193
|
}
|
|
10194
|
+
let trackedSteps = [];
|
|
10195
|
+
if (typeof sessionStorage !== "undefined") {
|
|
10196
|
+
try {
|
|
10197
|
+
trackedSteps = JSON.parse(sessionStorage.getItem(trackedStepsKey) || "[]");
|
|
10198
|
+
} catch {
|
|
10199
|
+
trackedSteps = [];
|
|
10200
|
+
}
|
|
10201
|
+
}
|
|
10202
|
+
if (isFirstTracking && stepIndex > 0) {
|
|
10203
|
+
for (let i2 = 0; i2 < stepIndex; i2++) {
|
|
10204
|
+
const skippedStep = steps2[i2];
|
|
10205
|
+
if (!skippedStep || trackedSteps.includes(skippedStep.id)) continue;
|
|
10206
|
+
const skippedSchemaStep = SCHEMA_STEPS[skippedStep.id];
|
|
10207
|
+
const skippedQuestions = (skippedSchemaStep == null ? void 0 : skippedSchemaStep.questions) || [];
|
|
10208
|
+
skippedQuestions.forEach((question, qIdx) => {
|
|
10209
|
+
const value = answerOf(question.id);
|
|
10210
|
+
trackAnswerSelected(funnelContextRef.current, {
|
|
10211
|
+
step_id: skippedStep.id,
|
|
10212
|
+
step_index: i2,
|
|
10213
|
+
question_id: question.id,
|
|
10214
|
+
answer_value: serializeAnswerValue(value),
|
|
10215
|
+
is_last_question: qIdx === skippedQuestions.length - 1
|
|
10216
|
+
});
|
|
10217
|
+
});
|
|
10218
|
+
trackedSteps.push(skippedStep.id);
|
|
10219
|
+
}
|
|
10220
|
+
}
|
|
10221
|
+
if (trackedSteps.includes(step2.id)) return;
|
|
10222
|
+
const schemaStep = SCHEMA_STEPS[step2.id];
|
|
10223
|
+
const questions2 = (schemaStep == null ? void 0 : schemaStep.questions) || [];
|
|
10190
10224
|
questions2.forEach((question, questionIndex) => {
|
|
10191
10225
|
const currentValue = answerOf(question.id);
|
|
10192
10226
|
const isLastQuestion = questionIndex === questions2.length - 1;
|
|
@@ -10207,6 +10241,10 @@ function TrackingProvider({
|
|
|
10207
10241
|
is_last_question: isLastQuestion
|
|
10208
10242
|
});
|
|
10209
10243
|
});
|
|
10244
|
+
trackedSteps.push(step2.id);
|
|
10245
|
+
if (typeof sessionStorage !== "undefined") {
|
|
10246
|
+
sessionStorage.setItem(trackedStepsKey, JSON.stringify(trackedSteps));
|
|
10247
|
+
}
|
|
10210
10248
|
}, [funnelContextRef, currentStepId, state, updateContext, answerOf]);
|
|
10211
10249
|
const trackAnswer = useCallback(
|
|
10212
10250
|
(questionId, value) => {
|
|
@@ -12931,7 +12969,14 @@ function requireFunctionBind() {
|
|
|
12931
12969
|
functionBind = Function.prototype.bind || implementation2;
|
|
12932
12970
|
return functionBind;
|
|
12933
12971
|
}
|
|
12934
|
-
var functionCall
|
|
12972
|
+
var functionCall;
|
|
12973
|
+
var hasRequiredFunctionCall;
|
|
12974
|
+
function requireFunctionCall() {
|
|
12975
|
+
if (hasRequiredFunctionCall) return functionCall;
|
|
12976
|
+
hasRequiredFunctionCall = 1;
|
|
12977
|
+
functionCall = Function.prototype.call;
|
|
12978
|
+
return functionCall;
|
|
12979
|
+
}
|
|
12935
12980
|
var functionApply;
|
|
12936
12981
|
var hasRequiredFunctionApply;
|
|
12937
12982
|
function requireFunctionApply() {
|
|
@@ -12943,12 +12988,12 @@ function requireFunctionApply() {
|
|
|
12943
12988
|
var reflectApply = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
|
|
12944
12989
|
var bind$2 = requireFunctionBind();
|
|
12945
12990
|
var $apply$1 = requireFunctionApply();
|
|
12946
|
-
var $call$2 =
|
|
12991
|
+
var $call$2 = requireFunctionCall();
|
|
12947
12992
|
var $reflectApply = reflectApply;
|
|
12948
12993
|
var actualApply = $reflectApply || bind$2.call($call$2, $apply$1);
|
|
12949
12994
|
var bind$1 = requireFunctionBind();
|
|
12950
12995
|
var $TypeError$4 = type;
|
|
12951
|
-
var $call$1 =
|
|
12996
|
+
var $call$1 = requireFunctionCall();
|
|
12952
12997
|
var $actualApply = actualApply;
|
|
12953
12998
|
var callBindApplyHelpers = function callBindBasic(args) {
|
|
12954
12999
|
if (args.length < 1 || typeof args[0] !== "function") {
|
|
@@ -13063,7 +13108,7 @@ var getProto = requireGetProto();
|
|
|
13063
13108
|
var $ObjectGPO = requireObject_getPrototypeOf();
|
|
13064
13109
|
var $ReflectGPO = requireReflect_getPrototypeOf();
|
|
13065
13110
|
var $apply = requireFunctionApply();
|
|
13066
|
-
var $call =
|
|
13111
|
+
var $call = requireFunctionCall();
|
|
13067
13112
|
var needsEval = {};
|
|
13068
13113
|
var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array);
|
|
13069
13114
|
var INTRINSICS = {
|