@heycater/qualification-funnel 1.9.0 → 1.11.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 +106 -106
- package/dist/index.esm.js +26 -43
- 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_v10_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_v10_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_v10_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_v10_abandoned", properties);
|
|
10143
10143
|
}
|
|
10144
10144
|
function trackStarted(context, initialStepId) {
|
|
10145
10145
|
const properties = {
|
|
@@ -10147,7 +10147,21 @@ function trackStarted(context, initialStepId) {
|
|
|
10147
10147
|
session_id: context.session_id,
|
|
10148
10148
|
initial_step: initialStepId
|
|
10149
10149
|
};
|
|
10150
|
-
captureEvent("
|
|
10150
|
+
captureEvent("qf_v10_started", properties);
|
|
10151
|
+
}
|
|
10152
|
+
function serializeAnswerValue(value) {
|
|
10153
|
+
if (value === void 0) return null;
|
|
10154
|
+
if (value === null) return null;
|
|
10155
|
+
if (value instanceof Date) {
|
|
10156
|
+
return format(value, "yyyy-MM-dd");
|
|
10157
|
+
}
|
|
10158
|
+
if (typeof value === "object" && !Array.isArray(value) && Object.keys(value).length === 0) {
|
|
10159
|
+
return null;
|
|
10160
|
+
}
|
|
10161
|
+
if (Array.isArray(value)) {
|
|
10162
|
+
return value;
|
|
10163
|
+
}
|
|
10164
|
+
return value;
|
|
10151
10165
|
}
|
|
10152
10166
|
const TrackingContext = createContext(null);
|
|
10153
10167
|
function TrackingProvider({
|
|
@@ -10165,7 +10179,7 @@ function TrackingProvider({
|
|
|
10165
10179
|
const stepIndex = qual.stepIndex;
|
|
10166
10180
|
const schemaStep = SCHEMA_STEPS[step2.id];
|
|
10167
10181
|
const questions2 = (schemaStep == null ? void 0 : schemaStep.questions) || [];
|
|
10168
|
-
const sessionKey = `
|
|
10182
|
+
const sessionKey = `qf_v10_started_${funnelContextRef.current.session_id}`;
|
|
10169
10183
|
if (typeof sessionStorage !== "undefined") {
|
|
10170
10184
|
const hasStarted = sessionStorage.getItem(sessionKey);
|
|
10171
10185
|
if (!hasStarted) {
|
|
@@ -10189,30 +10203,13 @@ function TrackingProvider({
|
|
|
10189
10203
|
step_id: step2.id,
|
|
10190
10204
|
step_index: stepIndex,
|
|
10191
10205
|
question_id: question.id,
|
|
10192
|
-
answer_value: currentValue
|
|
10206
|
+
answer_value: serializeAnswerValue(currentValue),
|
|
10193
10207
|
is_last_question: isLastQuestion
|
|
10194
10208
|
});
|
|
10195
10209
|
});
|
|
10196
10210
|
}, [funnelContextRef, currentStepId, state, updateContext, answerOf]);
|
|
10197
10211
|
const trackAnswer = useCallback(
|
|
10198
10212
|
(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
10213
|
if (questionId === "service_type" && isValidServiceType(value)) {
|
|
10217
10214
|
const stepOrder = getStepOrderForServiceType(value);
|
|
10218
10215
|
delete funnelContextRef.current.city;
|
|
@@ -10223,15 +10220,8 @@ function TrackingProvider({
|
|
|
10223
10220
|
} else if (questionId === "city") {
|
|
10224
10221
|
updateContext({ city: value });
|
|
10225
10222
|
}
|
|
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
10223
|
},
|
|
10234
|
-
[funnelContextRef,
|
|
10224
|
+
[funnelContextRef, updateContext]
|
|
10235
10225
|
);
|
|
10236
10226
|
return /* @__PURE__ */ jsx(TrackingContext.Provider, { value: { funnelContextRef, currentStepId, trackAnswer, trackStepCompletion }, children });
|
|
10237
10227
|
}
|
|
@@ -12941,14 +12931,7 @@ function requireFunctionBind() {
|
|
|
12941
12931
|
functionBind = Function.prototype.bind || implementation2;
|
|
12942
12932
|
return functionBind;
|
|
12943
12933
|
}
|
|
12944
|
-
var functionCall;
|
|
12945
|
-
var hasRequiredFunctionCall;
|
|
12946
|
-
function requireFunctionCall() {
|
|
12947
|
-
if (hasRequiredFunctionCall) return functionCall;
|
|
12948
|
-
hasRequiredFunctionCall = 1;
|
|
12949
|
-
functionCall = Function.prototype.call;
|
|
12950
|
-
return functionCall;
|
|
12951
|
-
}
|
|
12934
|
+
var functionCall = Function.prototype.call;
|
|
12952
12935
|
var functionApply;
|
|
12953
12936
|
var hasRequiredFunctionApply;
|
|
12954
12937
|
function requireFunctionApply() {
|
|
@@ -12960,12 +12943,12 @@ function requireFunctionApply() {
|
|
|
12960
12943
|
var reflectApply = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
|
|
12961
12944
|
var bind$2 = requireFunctionBind();
|
|
12962
12945
|
var $apply$1 = requireFunctionApply();
|
|
12963
|
-
var $call$2 =
|
|
12946
|
+
var $call$2 = functionCall;
|
|
12964
12947
|
var $reflectApply = reflectApply;
|
|
12965
12948
|
var actualApply = $reflectApply || bind$2.call($call$2, $apply$1);
|
|
12966
12949
|
var bind$1 = requireFunctionBind();
|
|
12967
12950
|
var $TypeError$4 = type;
|
|
12968
|
-
var $call$1 =
|
|
12951
|
+
var $call$1 = functionCall;
|
|
12969
12952
|
var $actualApply = actualApply;
|
|
12970
12953
|
var callBindApplyHelpers = function callBindBasic(args) {
|
|
12971
12954
|
if (args.length < 1 || typeof args[0] !== "function") {
|
|
@@ -13080,7 +13063,7 @@ var getProto = requireGetProto();
|
|
|
13080
13063
|
var $ObjectGPO = requireObject_getPrototypeOf();
|
|
13081
13064
|
var $ReflectGPO = requireReflect_getPrototypeOf();
|
|
13082
13065
|
var $apply = requireFunctionApply();
|
|
13083
|
-
var $call =
|
|
13066
|
+
var $call = functionCall;
|
|
13084
13067
|
var needsEval = {};
|
|
13085
13068
|
var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array);
|
|
13086
13069
|
var INTRINSICS = {
|