@heycater/qualification-funnel 1.12.0 → 1.14.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/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("qf_v11_answer_selected", properties);
10088
+ captureEvent("qf_v13_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("qf_v11_form_submitted", properties);
10106
+ captureEvent("qf_v13_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("qf_v11_completed", properties);
10123
+ captureEvent("qf_v13_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("qf_v11_abandoned", properties);
10142
+ captureEvent("qf_v13_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("qf_v11_started", properties);
10150
+ captureEvent("qf_v13_started", properties);
10151
10151
  }
10152
10152
  function serializeAnswerValue(value) {
10153
10153
  if (value === void 0) return null;
@@ -10178,9 +10178,10 @@ function TrackingProvider({
10178
10178
  if (!("step" in qual)) return;
10179
10179
  const step2 = qual.step;
10180
10180
  const stepIndex = qual.stepIndex;
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}`;
10181
+ ((_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_v13_started_${funnelContextRef.current.session_id}_${serviceType}`;
10184
+ const trackedStepsKey = `qf_v13_tracked_steps_${funnelContextRef.current.session_id}_${serviceType}`;
10184
10185
  let isFirstTracking = false;
10185
10186
  if (typeof sessionStorage !== "undefined") {
10186
10187
  const hasStarted = sessionStorage.getItem(sessionKey);
@@ -10199,23 +10200,24 @@ function TrackingProvider({
10199
10200
  trackedSteps = [];
10200
10201
  }
10201
10202
  }
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];
10203
+ if (isFirstTracking && stepIndex > 0 && isValidServiceType(serviceType)) {
10204
+ const stepOrder = getStepOrderForServiceType(serviceType);
10205
+ for (let i2 = 0; i2 < stepIndex && i2 < stepOrder.length; i2++) {
10206
+ const skippedStepId = stepOrder[i2];
10207
+ if (trackedSteps.includes(skippedStepId)) continue;
10208
+ const skippedSchemaStep = SCHEMA_STEPS[skippedStepId];
10207
10209
  const skippedQuestions = (skippedSchemaStep == null ? void 0 : skippedSchemaStep.questions) || [];
10208
10210
  skippedQuestions.forEach((question, qIdx) => {
10209
10211
  const value = answerOf(question.id);
10210
10212
  trackAnswerSelected(funnelContextRef.current, {
10211
- step_id: skippedStep.id,
10213
+ step_id: skippedStepId,
10212
10214
  step_index: i2,
10213
10215
  question_id: question.id,
10214
10216
  answer_value: serializeAnswerValue(value),
10215
10217
  is_last_question: qIdx === skippedQuestions.length - 1
10216
10218
  });
10217
10219
  });
10218
- trackedSteps.push(skippedStep.id);
10220
+ trackedSteps.push(skippedStepId);
10219
10221
  }
10220
10222
  }
10221
10223
  if (trackedSteps.includes(step2.id)) return;
@@ -11656,6 +11658,7 @@ const EmbeddedQuestion = ({
11656
11658
  var _a2, _b, _c, _d, _e;
11657
11659
  const { t: t2 } = useTranslation();
11658
11660
  const { state, actions, answerOf } = useQualification();
11661
+ const { trackStepCompletion } = useTracking();
11659
11662
  const getTitleContent = useCallback(
11660
11663
  (title2) => renderTitle ? renderTitle(title2) : title2,
11661
11664
  []
@@ -11678,6 +11681,7 @@ const EmbeddedQuestion = ({
11678
11681
  selected: answerOf("city"),
11679
11682
  onSelect: (city) => {
11680
11683
  actions.answerQuestion("city", city);
11684
+ trackStepCompletion();
11681
11685
  actions.nextStep();
11682
11686
  }
11683
11687
  }
@@ -11760,6 +11764,7 @@ const EmbeddedQuestion = ({
11760
11764
  selected: answerOf("service_type"),
11761
11765
  onSelect: (serviceType2) => {
11762
11766
  actions.answerQuestion("service_type", serviceType2);
11767
+ trackStepCompletion();
11763
11768
  actions.nextStep();
11764
11769
  }
11765
11770
  }
@@ -11801,6 +11806,7 @@ const EmbeddedQuestion = ({
11801
11806
  selected: answerOf("delivery_frequency"),
11802
11807
  onSelect: (frequency) => {
11803
11808
  actions.answerQuestion("delivery_frequency", frequency);
11809
+ trackStepCompletion();
11804
11810
  actions.nextStep();
11805
11811
  }
11806
11812
  }
@@ -11844,6 +11850,7 @@ const EmbeddedQuestion = ({
11844
11850
  selected: answerOf("budget_range"),
11845
11851
  onSelect: (range2) => {
11846
11852
  actions.answerQuestion("budget_range", range2);
11853
+ trackStepCompletion();
11847
11854
  actions.nextStep();
11848
11855
  }
11849
11856
  }
@@ -12367,7 +12374,7 @@ var objectInspect = function inspect_(obj, options, depth, seen) {
12367
12374
  var ys = arrObjKeys(obj, inspect2);
12368
12375
  var isPlainObject2 = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
12369
12376
  var protoTag = obj instanceof Object ? "" : "null prototype";
12370
- var stringTag2 = !isPlainObject2 && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? "Object" : "";
12377
+ var stringTag2 = !isPlainObject2 && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr$1(obj), 8, -1) : protoTag ? "Object" : "";
12371
12378
  var constructorTag = isPlainObject2 || typeof obj.constructor !== "function" ? "" : obj.constructor.name ? obj.constructor.name + " " : "";
12372
12379
  var tag = constructorTag + (stringTag2 || protoTag ? "[" + $join.call($concat$1.call([], stringTag2 || [], protoTag || []), ": ") + "] " : "");
12373
12380
  if (ys.length === 0) {
@@ -12392,25 +12399,25 @@ function canTrustToString(obj) {
12392
12399
  return !toStringTag || !(typeof obj === "object" && (toStringTag in obj || typeof obj[toStringTag] !== "undefined"));
12393
12400
  }
12394
12401
  function isArray$3(obj) {
12395
- return toStr(obj) === "[object Array]" && canTrustToString(obj);
12402
+ return toStr$1(obj) === "[object Array]" && canTrustToString(obj);
12396
12403
  }
12397
12404
  function isDate(obj) {
12398
- return toStr(obj) === "[object Date]" && canTrustToString(obj);
12405
+ return toStr$1(obj) === "[object Date]" && canTrustToString(obj);
12399
12406
  }
12400
12407
  function isRegExp$1(obj) {
12401
- return toStr(obj) === "[object RegExp]" && canTrustToString(obj);
12408
+ return toStr$1(obj) === "[object RegExp]" && canTrustToString(obj);
12402
12409
  }
12403
12410
  function isError(obj) {
12404
- return toStr(obj) === "[object Error]" && canTrustToString(obj);
12411
+ return toStr$1(obj) === "[object Error]" && canTrustToString(obj);
12405
12412
  }
12406
12413
  function isString(obj) {
12407
- return toStr(obj) === "[object String]" && canTrustToString(obj);
12414
+ return toStr$1(obj) === "[object String]" && canTrustToString(obj);
12408
12415
  }
12409
12416
  function isNumber(obj) {
12410
- return toStr(obj) === "[object Number]" && canTrustToString(obj);
12417
+ return toStr$1(obj) === "[object Number]" && canTrustToString(obj);
12411
12418
  }
12412
12419
  function isBoolean(obj) {
12413
- return toStr(obj) === "[object Boolean]" && canTrustToString(obj);
12420
+ return toStr$1(obj) === "[object Boolean]" && canTrustToString(obj);
12414
12421
  }
12415
12422
  function isSymbol(obj) {
12416
12423
  if (hasShammedSymbols) {
@@ -12446,7 +12453,7 @@ var hasOwn$1 = Object.prototype.hasOwnProperty || function(key) {
12446
12453
  function has$4(obj, key) {
12447
12454
  return hasOwn$1.call(obj, key);
12448
12455
  }
12449
- function toStr(obj) {
12456
+ function toStr$1(obj) {
12450
12457
  return objectToString.call(obj);
12451
12458
  }
12452
12459
  function nameOf(f) {
@@ -12755,7 +12762,7 @@ var syntax = SyntaxError;
12755
12762
  var uri = URIError;
12756
12763
  var abs$1 = Math.abs;
12757
12764
  var floor$1 = Math.floor;
12758
- var max$1 = Math.max;
12765
+ var max$2 = Math.max;
12759
12766
  var min$1 = Math.min;
12760
12767
  var pow$1 = Math.pow;
12761
12768
  var round$2 = Math.round;
@@ -12884,99 +12891,78 @@ function requireObject_getPrototypeOf() {
12884
12891
  Object_getPrototypeOf = $Object2.getPrototypeOf || null;
12885
12892
  return Object_getPrototypeOf;
12886
12893
  }
12887
- var implementation;
12888
- var hasRequiredImplementation;
12889
- function requireImplementation() {
12890
- if (hasRequiredImplementation) return implementation;
12891
- hasRequiredImplementation = 1;
12892
- var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
12893
- var toStr2 = Object.prototype.toString;
12894
- var max2 = Math.max;
12895
- var funcType = "[object Function]";
12896
- var concatty = function concatty2(a3, b2) {
12897
- var arr = [];
12898
- for (var i2 = 0; i2 < a3.length; i2 += 1) {
12899
- arr[i2] = a3[i2];
12900
- }
12901
- for (var j = 0; j < b2.length; j += 1) {
12902
- arr[j + a3.length] = b2[j];
12903
- }
12904
- return arr;
12905
- };
12906
- var slicy = function slicy2(arrLike, offset2) {
12907
- var arr = [];
12908
- for (var i2 = offset2, j = 0; i2 < arrLike.length; i2 += 1, j += 1) {
12909
- arr[j] = arrLike[i2];
12894
+ var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
12895
+ var toStr = Object.prototype.toString;
12896
+ var max$1 = Math.max;
12897
+ var funcType = "[object Function]";
12898
+ var concatty = function concatty2(a3, b2) {
12899
+ var arr = [];
12900
+ for (var i2 = 0; i2 < a3.length; i2 += 1) {
12901
+ arr[i2] = a3[i2];
12902
+ }
12903
+ for (var j = 0; j < b2.length; j += 1) {
12904
+ arr[j + a3.length] = b2[j];
12905
+ }
12906
+ return arr;
12907
+ };
12908
+ var slicy = function slicy2(arrLike, offset2) {
12909
+ var arr = [];
12910
+ for (var i2 = offset2, j = 0; i2 < arrLike.length; i2 += 1, j += 1) {
12911
+ arr[j] = arrLike[i2];
12912
+ }
12913
+ return arr;
12914
+ };
12915
+ var joiny = function(arr, joiner) {
12916
+ var str = "";
12917
+ for (var i2 = 0; i2 < arr.length; i2 += 1) {
12918
+ str += arr[i2];
12919
+ if (i2 + 1 < arr.length) {
12920
+ str += joiner;
12910
12921
  }
12911
- return arr;
12912
- };
12913
- var joiny = function(arr, joiner) {
12914
- var str = "";
12915
- for (var i2 = 0; i2 < arr.length; i2 += 1) {
12916
- str += arr[i2];
12917
- if (i2 + 1 < arr.length) {
12918
- str += joiner;
12922
+ }
12923
+ return str;
12924
+ };
12925
+ var implementation$1 = function bind(that) {
12926
+ var target = this;
12927
+ if (typeof target !== "function" || toStr.apply(target) !== funcType) {
12928
+ throw new TypeError(ERROR_MESSAGE + target);
12929
+ }
12930
+ var args = slicy(arguments, 1);
12931
+ var bound;
12932
+ var binder = function() {
12933
+ if (this instanceof bound) {
12934
+ var result = target.apply(
12935
+ this,
12936
+ concatty(args, arguments)
12937
+ );
12938
+ if (Object(result) === result) {
12939
+ return result;
12919
12940
  }
12941
+ return this;
12920
12942
  }
12921
- return str;
12943
+ return target.apply(
12944
+ that,
12945
+ concatty(args, arguments)
12946
+ );
12922
12947
  };
12923
- implementation = function bind2(that) {
12924
- var target = this;
12925
- if (typeof target !== "function" || toStr2.apply(target) !== funcType) {
12926
- throw new TypeError(ERROR_MESSAGE + target);
12927
- }
12928
- var args = slicy(arguments, 1);
12929
- var bound;
12930
- var binder = function() {
12931
- if (this instanceof bound) {
12932
- var result = target.apply(
12933
- this,
12934
- concatty(args, arguments)
12935
- );
12936
- if (Object(result) === result) {
12937
- return result;
12938
- }
12939
- return this;
12940
- }
12941
- return target.apply(
12942
- that,
12943
- concatty(args, arguments)
12944
- );
12948
+ var boundLength = max$1(0, target.length - args.length);
12949
+ var boundArgs = [];
12950
+ for (var i2 = 0; i2 < boundLength; i2++) {
12951
+ boundArgs[i2] = "$" + i2;
12952
+ }
12953
+ bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
12954
+ if (target.prototype) {
12955
+ var Empty = function Empty2() {
12945
12956
  };
12946
- var boundLength = max2(0, target.length - args.length);
12947
- var boundArgs = [];
12948
- for (var i2 = 0; i2 < boundLength; i2++) {
12949
- boundArgs[i2] = "$" + i2;
12950
- }
12951
- bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
12952
- if (target.prototype) {
12953
- var Empty = function Empty2() {
12954
- };
12955
- Empty.prototype = target.prototype;
12956
- bound.prototype = new Empty();
12957
- Empty.prototype = null;
12958
- }
12959
- return bound;
12960
- };
12961
- return implementation;
12962
- }
12963
- var functionBind;
12964
- var hasRequiredFunctionBind;
12965
- function requireFunctionBind() {
12966
- if (hasRequiredFunctionBind) return functionBind;
12967
- hasRequiredFunctionBind = 1;
12968
- var implementation2 = requireImplementation();
12969
- functionBind = Function.prototype.bind || implementation2;
12970
- return functionBind;
12971
- }
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
- }
12957
+ Empty.prototype = target.prototype;
12958
+ bound.prototype = new Empty();
12959
+ Empty.prototype = null;
12960
+ }
12961
+ return bound;
12962
+ };
12963
+ var implementation = implementation$1;
12964
+ var functionBind = Function.prototype.bind || implementation;
12965
+ var functionCall = Function.prototype.call;
12980
12966
  var functionApply;
12981
12967
  var hasRequiredFunctionApply;
12982
12968
  function requireFunctionApply() {
@@ -12986,14 +12972,14 @@ function requireFunctionApply() {
12986
12972
  return functionApply;
12987
12973
  }
12988
12974
  var reflectApply = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
12989
- var bind$2 = requireFunctionBind();
12975
+ var bind$2 = functionBind;
12990
12976
  var $apply$1 = requireFunctionApply();
12991
- var $call$2 = requireFunctionCall();
12977
+ var $call$2 = functionCall;
12992
12978
  var $reflectApply = reflectApply;
12993
12979
  var actualApply = $reflectApply || bind$2.call($call$2, $apply$1);
12994
- var bind$1 = requireFunctionBind();
12980
+ var bind$1 = functionBind;
12995
12981
  var $TypeError$4 = type;
12996
- var $call$1 = requireFunctionCall();
12982
+ var $call$1 = functionCall;
12997
12983
  var $actualApply = actualApply;
12998
12984
  var callBindApplyHelpers = function callBindBasic(args) {
12999
12985
  if (args.length < 1 || typeof args[0] !== "function") {
@@ -13059,8 +13045,8 @@ function requireHasown() {
13059
13045
  hasRequiredHasown = 1;
13060
13046
  var call = Function.prototype.call;
13061
13047
  var $hasOwn = Object.prototype.hasOwnProperty;
13062
- var bind2 = requireFunctionBind();
13063
- hasown = bind2.call(call, $hasOwn);
13048
+ var bind3 = functionBind;
13049
+ hasown = bind3.call(call, $hasOwn);
13064
13050
  return hasown;
13065
13051
  }
13066
13052
  var undefined$1;
@@ -13074,7 +13060,7 @@ var $TypeError$3 = type;
13074
13060
  var $URIError = uri;
13075
13061
  var abs = abs$1;
13076
13062
  var floor = floor$1;
13077
- var max = max$1;
13063
+ var max = max$2;
13078
13064
  var min = min$1;
13079
13065
  var pow = pow$1;
13080
13066
  var round$1 = round$2;
@@ -13108,7 +13094,7 @@ var getProto = requireGetProto();
13108
13094
  var $ObjectGPO = requireObject_getPrototypeOf();
13109
13095
  var $ReflectGPO = requireReflect_getPrototypeOf();
13110
13096
  var $apply = requireFunctionApply();
13111
- var $call = requireFunctionCall();
13097
+ var $call = functionCall;
13112
13098
  var needsEval = {};
13113
13099
  var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array);
13114
13100
  var INTRINSICS = {
@@ -13279,13 +13265,13 @@ var LEGACY_ALIASES = {
13279
13265
  "%WeakMapPrototype%": ["WeakMap", "prototype"],
13280
13266
  "%WeakSetPrototype%": ["WeakSet", "prototype"]
13281
13267
  };
13282
- var bind = requireFunctionBind();
13268
+ var bind2 = functionBind;
13283
13269
  var hasOwn = requireHasown();
13284
- var $concat = bind.call($call, Array.prototype.concat);
13285
- var $spliceApply = bind.call($apply, Array.prototype.splice);
13286
- var $replace = bind.call($call, String.prototype.replace);
13287
- var $strSlice = bind.call($call, String.prototype.slice);
13288
- var $exec = bind.call($call, RegExp.prototype.exec);
13270
+ var $concat = bind2.call($call, Array.prototype.concat);
13271
+ var $spliceApply = bind2.call($apply, Array.prototype.splice);
13272
+ var $replace = bind2.call($call, String.prototype.replace);
13273
+ var $strSlice = bind2.call($call, String.prototype.slice);
13274
+ var $exec = bind2.call($call, RegExp.prototype.exec);
13289
13275
  var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
13290
13276
  var reEscapeChar = /\\(\\)?/g;
13291
13277
  var stringToPath = function stringToPath2(string2) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heycater/qualification-funnel",
3
- "version": "1.12.0",
3
+ "version": "1.14.0",
4
4
  "type": "module",
5
5
  "description": "Heycater embedded qualification funnel widget",
6
6
  "main": "dist/index.cjs.js",