@heycater/qualification-funnel 1.11.0 → 1.13.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 +134 -109
- 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_v12_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_v12_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_v12_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_v12_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_v12_started", properties);
|
|
10151
10151
|
}
|
|
10152
10152
|
function serializeAnswerValue(value) {
|
|
10153
10153
|
if (value === void 0) return null;
|
|
@@ -10172,21 +10172,56 @@ 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 sessionKey = `
|
|
10181
|
+
const steps2 = ((_a2 = qual.steps) == null ? void 0 : _a2.filter((s3) => !s3.disabled)) || [];
|
|
10182
|
+
const serviceType = funnelContextRef.current.service_type || answerOf("service_type") || "";
|
|
10183
|
+
const sessionKey = `qf_v12_started_${funnelContextRef.current.session_id}_${serviceType}`;
|
|
10184
|
+
const trackedStepsKey = `qf_v12_tracked_steps_${funnelContextRef.current.session_id}_${serviceType}`;
|
|
10185
|
+
let isFirstTracking = false;
|
|
10183
10186
|
if (typeof sessionStorage !== "undefined") {
|
|
10184
10187
|
const hasStarted = sessionStorage.getItem(sessionKey);
|
|
10185
10188
|
if (!hasStarted) {
|
|
10189
|
+
isFirstTracking = true;
|
|
10186
10190
|
sessionStorage.setItem(sessionKey, "true");
|
|
10191
|
+
sessionStorage.setItem(trackedStepsKey, "[]");
|
|
10187
10192
|
trackStarted(funnelContextRef.current, currentStepId);
|
|
10188
10193
|
}
|
|
10189
10194
|
}
|
|
10195
|
+
let trackedSteps = [];
|
|
10196
|
+
if (typeof sessionStorage !== "undefined") {
|
|
10197
|
+
try {
|
|
10198
|
+
trackedSteps = JSON.parse(sessionStorage.getItem(trackedStepsKey) || "[]");
|
|
10199
|
+
} catch {
|
|
10200
|
+
trackedSteps = [];
|
|
10201
|
+
}
|
|
10202
|
+
}
|
|
10203
|
+
if (isFirstTracking && stepIndex > 0) {
|
|
10204
|
+
for (let i2 = 0; i2 < stepIndex; i2++) {
|
|
10205
|
+
const skippedStep = steps2[i2];
|
|
10206
|
+
if (!skippedStep || trackedSteps.includes(skippedStep.id)) continue;
|
|
10207
|
+
const skippedSchemaStep = SCHEMA_STEPS[skippedStep.id];
|
|
10208
|
+
const skippedQuestions = (skippedSchemaStep == null ? void 0 : skippedSchemaStep.questions) || [];
|
|
10209
|
+
skippedQuestions.forEach((question, qIdx) => {
|
|
10210
|
+
const value = answerOf(question.id);
|
|
10211
|
+
trackAnswerSelected(funnelContextRef.current, {
|
|
10212
|
+
step_id: skippedStep.id,
|
|
10213
|
+
step_index: i2,
|
|
10214
|
+
question_id: question.id,
|
|
10215
|
+
answer_value: serializeAnswerValue(value),
|
|
10216
|
+
is_last_question: qIdx === skippedQuestions.length - 1
|
|
10217
|
+
});
|
|
10218
|
+
});
|
|
10219
|
+
trackedSteps.push(skippedStep.id);
|
|
10220
|
+
}
|
|
10221
|
+
}
|
|
10222
|
+
if (trackedSteps.includes(step2.id)) return;
|
|
10223
|
+
const schemaStep = SCHEMA_STEPS[step2.id];
|
|
10224
|
+
const questions2 = (schemaStep == null ? void 0 : schemaStep.questions) || [];
|
|
10190
10225
|
questions2.forEach((question, questionIndex) => {
|
|
10191
10226
|
const currentValue = answerOf(question.id);
|
|
10192
10227
|
const isLastQuestion = questionIndex === questions2.length - 1;
|
|
@@ -10207,6 +10242,10 @@ function TrackingProvider({
|
|
|
10207
10242
|
is_last_question: isLastQuestion
|
|
10208
10243
|
});
|
|
10209
10244
|
});
|
|
10245
|
+
trackedSteps.push(step2.id);
|
|
10246
|
+
if (typeof sessionStorage !== "undefined") {
|
|
10247
|
+
sessionStorage.setItem(trackedStepsKey, JSON.stringify(trackedSteps));
|
|
10248
|
+
}
|
|
10210
10249
|
}, [funnelContextRef, currentStepId, state, updateContext, answerOf]);
|
|
10211
10250
|
const trackAnswer = useCallback(
|
|
10212
10251
|
(questionId, value) => {
|
|
@@ -12329,7 +12368,7 @@ var objectInspect = function inspect_(obj, options, depth, seen) {
|
|
|
12329
12368
|
var ys = arrObjKeys(obj, inspect2);
|
|
12330
12369
|
var isPlainObject2 = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
|
|
12331
12370
|
var protoTag = obj instanceof Object ? "" : "null prototype";
|
|
12332
|
-
var stringTag2 = !isPlainObject2 && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? "Object" : "";
|
|
12371
|
+
var stringTag2 = !isPlainObject2 && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr$1(obj), 8, -1) : protoTag ? "Object" : "";
|
|
12333
12372
|
var constructorTag = isPlainObject2 || typeof obj.constructor !== "function" ? "" : obj.constructor.name ? obj.constructor.name + " " : "";
|
|
12334
12373
|
var tag = constructorTag + (stringTag2 || protoTag ? "[" + $join.call($concat$1.call([], stringTag2 || [], protoTag || []), ": ") + "] " : "");
|
|
12335
12374
|
if (ys.length === 0) {
|
|
@@ -12354,25 +12393,25 @@ function canTrustToString(obj) {
|
|
|
12354
12393
|
return !toStringTag || !(typeof obj === "object" && (toStringTag in obj || typeof obj[toStringTag] !== "undefined"));
|
|
12355
12394
|
}
|
|
12356
12395
|
function isArray$3(obj) {
|
|
12357
|
-
return toStr(obj) === "[object Array]" && canTrustToString(obj);
|
|
12396
|
+
return toStr$1(obj) === "[object Array]" && canTrustToString(obj);
|
|
12358
12397
|
}
|
|
12359
12398
|
function isDate(obj) {
|
|
12360
|
-
return toStr(obj) === "[object Date]" && canTrustToString(obj);
|
|
12399
|
+
return toStr$1(obj) === "[object Date]" && canTrustToString(obj);
|
|
12361
12400
|
}
|
|
12362
12401
|
function isRegExp$1(obj) {
|
|
12363
|
-
return toStr(obj) === "[object RegExp]" && canTrustToString(obj);
|
|
12402
|
+
return toStr$1(obj) === "[object RegExp]" && canTrustToString(obj);
|
|
12364
12403
|
}
|
|
12365
12404
|
function isError(obj) {
|
|
12366
|
-
return toStr(obj) === "[object Error]" && canTrustToString(obj);
|
|
12405
|
+
return toStr$1(obj) === "[object Error]" && canTrustToString(obj);
|
|
12367
12406
|
}
|
|
12368
12407
|
function isString(obj) {
|
|
12369
|
-
return toStr(obj) === "[object String]" && canTrustToString(obj);
|
|
12408
|
+
return toStr$1(obj) === "[object String]" && canTrustToString(obj);
|
|
12370
12409
|
}
|
|
12371
12410
|
function isNumber(obj) {
|
|
12372
|
-
return toStr(obj) === "[object Number]" && canTrustToString(obj);
|
|
12411
|
+
return toStr$1(obj) === "[object Number]" && canTrustToString(obj);
|
|
12373
12412
|
}
|
|
12374
12413
|
function isBoolean(obj) {
|
|
12375
|
-
return toStr(obj) === "[object Boolean]" && canTrustToString(obj);
|
|
12414
|
+
return toStr$1(obj) === "[object Boolean]" && canTrustToString(obj);
|
|
12376
12415
|
}
|
|
12377
12416
|
function isSymbol(obj) {
|
|
12378
12417
|
if (hasShammedSymbols) {
|
|
@@ -12408,7 +12447,7 @@ var hasOwn$1 = Object.prototype.hasOwnProperty || function(key) {
|
|
|
12408
12447
|
function has$4(obj, key) {
|
|
12409
12448
|
return hasOwn$1.call(obj, key);
|
|
12410
12449
|
}
|
|
12411
|
-
function toStr(obj) {
|
|
12450
|
+
function toStr$1(obj) {
|
|
12412
12451
|
return objectToString.call(obj);
|
|
12413
12452
|
}
|
|
12414
12453
|
function nameOf(f) {
|
|
@@ -12717,7 +12756,7 @@ var syntax = SyntaxError;
|
|
|
12717
12756
|
var uri = URIError;
|
|
12718
12757
|
var abs$1 = Math.abs;
|
|
12719
12758
|
var floor$1 = Math.floor;
|
|
12720
|
-
var max$
|
|
12759
|
+
var max$2 = Math.max;
|
|
12721
12760
|
var min$1 = Math.min;
|
|
12722
12761
|
var pow$1 = Math.pow;
|
|
12723
12762
|
var round$2 = Math.round;
|
|
@@ -12846,91 +12885,77 @@ function requireObject_getPrototypeOf() {
|
|
|
12846
12885
|
Object_getPrototypeOf = $Object2.getPrototypeOf || null;
|
|
12847
12886
|
return Object_getPrototypeOf;
|
|
12848
12887
|
}
|
|
12849
|
-
var
|
|
12850
|
-
var
|
|
12851
|
-
|
|
12852
|
-
|
|
12853
|
-
|
|
12854
|
-
var
|
|
12855
|
-
var
|
|
12856
|
-
|
|
12857
|
-
|
|
12858
|
-
var
|
|
12859
|
-
|
|
12860
|
-
|
|
12861
|
-
|
|
12862
|
-
|
|
12863
|
-
|
|
12864
|
-
|
|
12865
|
-
|
|
12866
|
-
|
|
12867
|
-
}
|
|
12868
|
-
|
|
12869
|
-
|
|
12870
|
-
|
|
12871
|
-
|
|
12872
|
-
|
|
12873
|
-
|
|
12874
|
-
|
|
12875
|
-
|
|
12876
|
-
var str = "";
|
|
12877
|
-
for (var i2 = 0; i2 < arr.length; i2 += 1) {
|
|
12878
|
-
str += arr[i2];
|
|
12879
|
-
if (i2 + 1 < arr.length) {
|
|
12880
|
-
str += joiner;
|
|
12881
|
-
}
|
|
12888
|
+
var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
|
|
12889
|
+
var toStr = Object.prototype.toString;
|
|
12890
|
+
var max$1 = Math.max;
|
|
12891
|
+
var funcType = "[object Function]";
|
|
12892
|
+
var concatty = function concatty2(a3, b2) {
|
|
12893
|
+
var arr = [];
|
|
12894
|
+
for (var i2 = 0; i2 < a3.length; i2 += 1) {
|
|
12895
|
+
arr[i2] = a3[i2];
|
|
12896
|
+
}
|
|
12897
|
+
for (var j = 0; j < b2.length; j += 1) {
|
|
12898
|
+
arr[j + a3.length] = b2[j];
|
|
12899
|
+
}
|
|
12900
|
+
return arr;
|
|
12901
|
+
};
|
|
12902
|
+
var slicy = function slicy2(arrLike, offset2) {
|
|
12903
|
+
var arr = [];
|
|
12904
|
+
for (var i2 = offset2, j = 0; i2 < arrLike.length; i2 += 1, j += 1) {
|
|
12905
|
+
arr[j] = arrLike[i2];
|
|
12906
|
+
}
|
|
12907
|
+
return arr;
|
|
12908
|
+
};
|
|
12909
|
+
var joiny = function(arr, joiner) {
|
|
12910
|
+
var str = "";
|
|
12911
|
+
for (var i2 = 0; i2 < arr.length; i2 += 1) {
|
|
12912
|
+
str += arr[i2];
|
|
12913
|
+
if (i2 + 1 < arr.length) {
|
|
12914
|
+
str += joiner;
|
|
12882
12915
|
}
|
|
12883
|
-
|
|
12884
|
-
|
|
12885
|
-
|
|
12886
|
-
|
|
12887
|
-
|
|
12888
|
-
|
|
12889
|
-
|
|
12890
|
-
|
|
12891
|
-
|
|
12892
|
-
|
|
12893
|
-
|
|
12894
|
-
|
|
12895
|
-
|
|
12896
|
-
|
|
12897
|
-
);
|
|
12898
|
-
if (Object(result) === result) {
|
|
12899
|
-
return result;
|
|
12900
|
-
}
|
|
12901
|
-
return this;
|
|
12902
|
-
}
|
|
12903
|
-
return target.apply(
|
|
12904
|
-
that,
|
|
12916
|
+
}
|
|
12917
|
+
return str;
|
|
12918
|
+
};
|
|
12919
|
+
var implementation$1 = function bind(that) {
|
|
12920
|
+
var target = this;
|
|
12921
|
+
if (typeof target !== "function" || toStr.apply(target) !== funcType) {
|
|
12922
|
+
throw new TypeError(ERROR_MESSAGE + target);
|
|
12923
|
+
}
|
|
12924
|
+
var args = slicy(arguments, 1);
|
|
12925
|
+
var bound;
|
|
12926
|
+
var binder = function() {
|
|
12927
|
+
if (this instanceof bound) {
|
|
12928
|
+
var result = target.apply(
|
|
12929
|
+
this,
|
|
12905
12930
|
concatty(args, arguments)
|
|
12906
12931
|
);
|
|
12907
|
-
|
|
12908
|
-
|
|
12909
|
-
|
|
12910
|
-
|
|
12911
|
-
boundArgs[i2] = "$" + i2;
|
|
12912
|
-
}
|
|
12913
|
-
bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
|
|
12914
|
-
if (target.prototype) {
|
|
12915
|
-
var Empty = function Empty2() {
|
|
12916
|
-
};
|
|
12917
|
-
Empty.prototype = target.prototype;
|
|
12918
|
-
bound.prototype = new Empty();
|
|
12919
|
-
Empty.prototype = null;
|
|
12932
|
+
if (Object(result) === result) {
|
|
12933
|
+
return result;
|
|
12934
|
+
}
|
|
12935
|
+
return this;
|
|
12920
12936
|
}
|
|
12921
|
-
return
|
|
12937
|
+
return target.apply(
|
|
12938
|
+
that,
|
|
12939
|
+
concatty(args, arguments)
|
|
12940
|
+
);
|
|
12922
12941
|
};
|
|
12923
|
-
|
|
12924
|
-
|
|
12925
|
-
var
|
|
12926
|
-
|
|
12927
|
-
|
|
12928
|
-
|
|
12929
|
-
|
|
12930
|
-
|
|
12931
|
-
|
|
12932
|
-
|
|
12933
|
-
|
|
12942
|
+
var boundLength = max$1(0, target.length - args.length);
|
|
12943
|
+
var boundArgs = [];
|
|
12944
|
+
for (var i2 = 0; i2 < boundLength; i2++) {
|
|
12945
|
+
boundArgs[i2] = "$" + i2;
|
|
12946
|
+
}
|
|
12947
|
+
bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
|
|
12948
|
+
if (target.prototype) {
|
|
12949
|
+
var Empty = function Empty2() {
|
|
12950
|
+
};
|
|
12951
|
+
Empty.prototype = target.prototype;
|
|
12952
|
+
bound.prototype = new Empty();
|
|
12953
|
+
Empty.prototype = null;
|
|
12954
|
+
}
|
|
12955
|
+
return bound;
|
|
12956
|
+
};
|
|
12957
|
+
var implementation = implementation$1;
|
|
12958
|
+
var functionBind = Function.prototype.bind || implementation;
|
|
12934
12959
|
var functionCall = Function.prototype.call;
|
|
12935
12960
|
var functionApply;
|
|
12936
12961
|
var hasRequiredFunctionApply;
|
|
@@ -12941,12 +12966,12 @@ function requireFunctionApply() {
|
|
|
12941
12966
|
return functionApply;
|
|
12942
12967
|
}
|
|
12943
12968
|
var reflectApply = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
|
|
12944
|
-
var bind$2 =
|
|
12969
|
+
var bind$2 = functionBind;
|
|
12945
12970
|
var $apply$1 = requireFunctionApply();
|
|
12946
12971
|
var $call$2 = functionCall;
|
|
12947
12972
|
var $reflectApply = reflectApply;
|
|
12948
12973
|
var actualApply = $reflectApply || bind$2.call($call$2, $apply$1);
|
|
12949
|
-
var bind$1 =
|
|
12974
|
+
var bind$1 = functionBind;
|
|
12950
12975
|
var $TypeError$4 = type;
|
|
12951
12976
|
var $call$1 = functionCall;
|
|
12952
12977
|
var $actualApply = actualApply;
|
|
@@ -13014,8 +13039,8 @@ function requireHasown() {
|
|
|
13014
13039
|
hasRequiredHasown = 1;
|
|
13015
13040
|
var call = Function.prototype.call;
|
|
13016
13041
|
var $hasOwn = Object.prototype.hasOwnProperty;
|
|
13017
|
-
var
|
|
13018
|
-
hasown =
|
|
13042
|
+
var bind3 = functionBind;
|
|
13043
|
+
hasown = bind3.call(call, $hasOwn);
|
|
13019
13044
|
return hasown;
|
|
13020
13045
|
}
|
|
13021
13046
|
var undefined$1;
|
|
@@ -13029,7 +13054,7 @@ var $TypeError$3 = type;
|
|
|
13029
13054
|
var $URIError = uri;
|
|
13030
13055
|
var abs = abs$1;
|
|
13031
13056
|
var floor = floor$1;
|
|
13032
|
-
var max = max$
|
|
13057
|
+
var max = max$2;
|
|
13033
13058
|
var min = min$1;
|
|
13034
13059
|
var pow = pow$1;
|
|
13035
13060
|
var round$1 = round$2;
|
|
@@ -13234,13 +13259,13 @@ var LEGACY_ALIASES = {
|
|
|
13234
13259
|
"%WeakMapPrototype%": ["WeakMap", "prototype"],
|
|
13235
13260
|
"%WeakSetPrototype%": ["WeakSet", "prototype"]
|
|
13236
13261
|
};
|
|
13237
|
-
var
|
|
13262
|
+
var bind2 = functionBind;
|
|
13238
13263
|
var hasOwn = requireHasown();
|
|
13239
|
-
var $concat =
|
|
13240
|
-
var $spliceApply =
|
|
13241
|
-
var $replace =
|
|
13242
|
-
var $strSlice =
|
|
13243
|
-
var $exec =
|
|
13264
|
+
var $concat = bind2.call($call, Array.prototype.concat);
|
|
13265
|
+
var $spliceApply = bind2.call($apply, Array.prototype.splice);
|
|
13266
|
+
var $replace = bind2.call($call, String.prototype.replace);
|
|
13267
|
+
var $strSlice = bind2.call($call, String.prototype.slice);
|
|
13268
|
+
var $exec = bind2.call($call, RegExp.prototype.exec);
|
|
13244
13269
|
var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
|
|
13245
13270
|
var reEscapeChar = /\\(\\)?/g;
|
|
13246
13271
|
var stringToPath = function stringToPath2(string2) {
|