@heycater/qualification-funnel 1.14.0 → 1.15.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
@@ -10171,7 +10171,7 @@ function TrackingProvider({
10171
10171
  children
10172
10172
  }) {
10173
10173
  const { state, answerOf } = useQualification();
10174
- const trackStepCompletion = useCallback(() => {
10174
+ const trackStepCompletion = useCallback((currentValues) => {
10175
10175
  var _a2;
10176
10176
  if (!("qualification" in state)) return;
10177
10177
  const qual = state.qualification;
@@ -10179,6 +10179,12 @@ function TrackingProvider({
10179
10179
  const step2 = qual.step;
10180
10180
  const stepIndex = qual.stepIndex;
10181
10181
  ((_a2 = qual.steps) == null ? void 0 : _a2.filter((s3) => !s3.disabled)) || [];
10182
+ const getValue2 = (questionId) => {
10183
+ if (currentValues && questionId in currentValues) {
10184
+ return currentValues[questionId];
10185
+ }
10186
+ return answerOf(questionId);
10187
+ };
10182
10188
  const serviceType = funnelContextRef.current.service_type || answerOf("service_type") || "";
10183
10189
  const sessionKey = `qf_v13_started_${funnelContextRef.current.session_id}_${serviceType}`;
10184
10190
  const trackedStepsKey = `qf_v13_tracked_steps_${funnelContextRef.current.session_id}_${serviceType}`;
@@ -10224,7 +10230,7 @@ function TrackingProvider({
10224
10230
  const schemaStep = SCHEMA_STEPS[step2.id];
10225
10231
  const questions2 = (schemaStep == null ? void 0 : schemaStep.questions) || [];
10226
10232
  questions2.forEach((question, questionIndex) => {
10227
- const currentValue = answerOf(question.id);
10233
+ const currentValue = getValue2(question.id);
10228
10234
  const isLastQuestion = questionIndex === questions2.length - 1;
10229
10235
  if (question.id === "service_type" && isValidServiceType(currentValue)) {
10230
10236
  const stepOrder = getStepOrderForServiceType(currentValue);
@@ -11681,7 +11687,7 @@ const EmbeddedQuestion = ({
11681
11687
  selected: answerOf("city"),
11682
11688
  onSelect: (city) => {
11683
11689
  actions.answerQuestion("city", city);
11684
- trackStepCompletion();
11690
+ trackStepCompletion({ city });
11685
11691
  actions.nextStep();
11686
11692
  }
11687
11693
  }
@@ -11764,7 +11770,7 @@ const EmbeddedQuestion = ({
11764
11770
  selected: answerOf("service_type"),
11765
11771
  onSelect: (serviceType2) => {
11766
11772
  actions.answerQuestion("service_type", serviceType2);
11767
- trackStepCompletion();
11773
+ trackStepCompletion({ service_type: serviceType2 });
11768
11774
  actions.nextStep();
11769
11775
  }
11770
11776
  }
@@ -11806,7 +11812,7 @@ const EmbeddedQuestion = ({
11806
11812
  selected: answerOf("delivery_frequency"),
11807
11813
  onSelect: (frequency) => {
11808
11814
  actions.answerQuestion("delivery_frequency", frequency);
11809
- trackStepCompletion();
11815
+ trackStepCompletion({ delivery_frequency: frequency });
11810
11816
  actions.nextStep();
11811
11817
  }
11812
11818
  }
@@ -11850,7 +11856,7 @@ const EmbeddedQuestion = ({
11850
11856
  selected: answerOf("budget_range"),
11851
11857
  onSelect: (range2) => {
11852
11858
  actions.answerQuestion("budget_range", range2);
11853
- trackStepCompletion();
11859
+ trackStepCompletion({ budget_range: range2 });
11854
11860
  actions.nextStep();
11855
11861
  }
11856
11862
  }
@@ -12374,7 +12380,7 @@ var objectInspect = function inspect_(obj, options, depth, seen) {
12374
12380
  var ys = arrObjKeys(obj, inspect2);
12375
12381
  var isPlainObject2 = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
12376
12382
  var protoTag = obj instanceof Object ? "" : "null prototype";
12377
- var stringTag2 = !isPlainObject2 && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr$1(obj), 8, -1) : protoTag ? "Object" : "";
12383
+ var stringTag2 = !isPlainObject2 && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? "Object" : "";
12378
12384
  var constructorTag = isPlainObject2 || typeof obj.constructor !== "function" ? "" : obj.constructor.name ? obj.constructor.name + " " : "";
12379
12385
  var tag = constructorTag + (stringTag2 || protoTag ? "[" + $join.call($concat$1.call([], stringTag2 || [], protoTag || []), ": ") + "] " : "");
12380
12386
  if (ys.length === 0) {
@@ -12399,25 +12405,25 @@ function canTrustToString(obj) {
12399
12405
  return !toStringTag || !(typeof obj === "object" && (toStringTag in obj || typeof obj[toStringTag] !== "undefined"));
12400
12406
  }
12401
12407
  function isArray$3(obj) {
12402
- return toStr$1(obj) === "[object Array]" && canTrustToString(obj);
12408
+ return toStr(obj) === "[object Array]" && canTrustToString(obj);
12403
12409
  }
12404
12410
  function isDate(obj) {
12405
- return toStr$1(obj) === "[object Date]" && canTrustToString(obj);
12411
+ return toStr(obj) === "[object Date]" && canTrustToString(obj);
12406
12412
  }
12407
12413
  function isRegExp$1(obj) {
12408
- return toStr$1(obj) === "[object RegExp]" && canTrustToString(obj);
12414
+ return toStr(obj) === "[object RegExp]" && canTrustToString(obj);
12409
12415
  }
12410
12416
  function isError(obj) {
12411
- return toStr$1(obj) === "[object Error]" && canTrustToString(obj);
12417
+ return toStr(obj) === "[object Error]" && canTrustToString(obj);
12412
12418
  }
12413
12419
  function isString(obj) {
12414
- return toStr$1(obj) === "[object String]" && canTrustToString(obj);
12420
+ return toStr(obj) === "[object String]" && canTrustToString(obj);
12415
12421
  }
12416
12422
  function isNumber(obj) {
12417
- return toStr$1(obj) === "[object Number]" && canTrustToString(obj);
12423
+ return toStr(obj) === "[object Number]" && canTrustToString(obj);
12418
12424
  }
12419
12425
  function isBoolean(obj) {
12420
- return toStr$1(obj) === "[object Boolean]" && canTrustToString(obj);
12426
+ return toStr(obj) === "[object Boolean]" && canTrustToString(obj);
12421
12427
  }
12422
12428
  function isSymbol(obj) {
12423
12429
  if (hasShammedSymbols) {
@@ -12453,7 +12459,7 @@ var hasOwn$1 = Object.prototype.hasOwnProperty || function(key) {
12453
12459
  function has$4(obj, key) {
12454
12460
  return hasOwn$1.call(obj, key);
12455
12461
  }
12456
- function toStr$1(obj) {
12462
+ function toStr(obj) {
12457
12463
  return objectToString.call(obj);
12458
12464
  }
12459
12465
  function nameOf(f) {
@@ -12762,7 +12768,7 @@ var syntax = SyntaxError;
12762
12768
  var uri = URIError;
12763
12769
  var abs$1 = Math.abs;
12764
12770
  var floor$1 = Math.floor;
12765
- var max$2 = Math.max;
12771
+ var max$1 = Math.max;
12766
12772
  var min$1 = Math.min;
12767
12773
  var pow$1 = Math.pow;
12768
12774
  var round$2 = Math.round;
@@ -12891,78 +12897,99 @@ function requireObject_getPrototypeOf() {
12891
12897
  Object_getPrototypeOf = $Object2.getPrototypeOf || null;
12892
12898
  return Object_getPrototypeOf;
12893
12899
  }
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;
12900
+ var implementation;
12901
+ var hasRequiredImplementation;
12902
+ function requireImplementation() {
12903
+ if (hasRequiredImplementation) return implementation;
12904
+ hasRequiredImplementation = 1;
12905
+ var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
12906
+ var toStr2 = Object.prototype.toString;
12907
+ var max2 = Math.max;
12908
+ var funcType = "[object Function]";
12909
+ var concatty = function concatty2(a3, b2) {
12910
+ var arr = [];
12911
+ for (var i2 = 0; i2 < a3.length; i2 += 1) {
12912
+ arr[i2] = a3[i2];
12921
12913
  }
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;
12914
+ for (var j = 0; j < b2.length; j += 1) {
12915
+ arr[j + a3.length] = b2[j];
12916
+ }
12917
+ return arr;
12918
+ };
12919
+ var slicy = function slicy2(arrLike, offset2) {
12920
+ var arr = [];
12921
+ for (var i2 = offset2, j = 0; i2 < arrLike.length; i2 += 1, j += 1) {
12922
+ arr[j] = arrLike[i2];
12923
+ }
12924
+ return arr;
12925
+ };
12926
+ var joiny = function(arr, joiner) {
12927
+ var str = "";
12928
+ for (var i2 = 0; i2 < arr.length; i2 += 1) {
12929
+ str += arr[i2];
12930
+ if (i2 + 1 < arr.length) {
12931
+ str += joiner;
12940
12932
  }
12941
- return this;
12942
12933
  }
12943
- return target.apply(
12944
- that,
12945
- concatty(args, arguments)
12946
- );
12934
+ return str;
12947
12935
  };
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() {
12936
+ implementation = function bind2(that) {
12937
+ var target = this;
12938
+ if (typeof target !== "function" || toStr2.apply(target) !== funcType) {
12939
+ throw new TypeError(ERROR_MESSAGE + target);
12940
+ }
12941
+ var args = slicy(arguments, 1);
12942
+ var bound;
12943
+ var binder = function() {
12944
+ if (this instanceof bound) {
12945
+ var result = target.apply(
12946
+ this,
12947
+ concatty(args, arguments)
12948
+ );
12949
+ if (Object(result) === result) {
12950
+ return result;
12951
+ }
12952
+ return this;
12953
+ }
12954
+ return target.apply(
12955
+ that,
12956
+ concatty(args, arguments)
12957
+ );
12956
12958
  };
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;
12959
+ var boundLength = max2(0, target.length - args.length);
12960
+ var boundArgs = [];
12961
+ for (var i2 = 0; i2 < boundLength; i2++) {
12962
+ boundArgs[i2] = "$" + i2;
12963
+ }
12964
+ bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
12965
+ if (target.prototype) {
12966
+ var Empty = function Empty2() {
12967
+ };
12968
+ Empty.prototype = target.prototype;
12969
+ bound.prototype = new Empty();
12970
+ Empty.prototype = null;
12971
+ }
12972
+ return bound;
12973
+ };
12974
+ return implementation;
12975
+ }
12976
+ var functionBind;
12977
+ var hasRequiredFunctionBind;
12978
+ function requireFunctionBind() {
12979
+ if (hasRequiredFunctionBind) return functionBind;
12980
+ hasRequiredFunctionBind = 1;
12981
+ var implementation2 = requireImplementation();
12982
+ functionBind = Function.prototype.bind || implementation2;
12983
+ return functionBind;
12984
+ }
12985
+ var functionCall;
12986
+ var hasRequiredFunctionCall;
12987
+ function requireFunctionCall() {
12988
+ if (hasRequiredFunctionCall) return functionCall;
12989
+ hasRequiredFunctionCall = 1;
12990
+ functionCall = Function.prototype.call;
12991
+ return functionCall;
12992
+ }
12966
12993
  var functionApply;
12967
12994
  var hasRequiredFunctionApply;
12968
12995
  function requireFunctionApply() {
@@ -12972,14 +12999,14 @@ function requireFunctionApply() {
12972
12999
  return functionApply;
12973
13000
  }
12974
13001
  var reflectApply = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
12975
- var bind$2 = functionBind;
13002
+ var bind$2 = requireFunctionBind();
12976
13003
  var $apply$1 = requireFunctionApply();
12977
- var $call$2 = functionCall;
13004
+ var $call$2 = requireFunctionCall();
12978
13005
  var $reflectApply = reflectApply;
12979
13006
  var actualApply = $reflectApply || bind$2.call($call$2, $apply$1);
12980
- var bind$1 = functionBind;
13007
+ var bind$1 = requireFunctionBind();
12981
13008
  var $TypeError$4 = type;
12982
- var $call$1 = functionCall;
13009
+ var $call$1 = requireFunctionCall();
12983
13010
  var $actualApply = actualApply;
12984
13011
  var callBindApplyHelpers = function callBindBasic(args) {
12985
13012
  if (args.length < 1 || typeof args[0] !== "function") {
@@ -13045,8 +13072,8 @@ function requireHasown() {
13045
13072
  hasRequiredHasown = 1;
13046
13073
  var call = Function.prototype.call;
13047
13074
  var $hasOwn = Object.prototype.hasOwnProperty;
13048
- var bind3 = functionBind;
13049
- hasown = bind3.call(call, $hasOwn);
13075
+ var bind2 = requireFunctionBind();
13076
+ hasown = bind2.call(call, $hasOwn);
13050
13077
  return hasown;
13051
13078
  }
13052
13079
  var undefined$1;
@@ -13060,7 +13087,7 @@ var $TypeError$3 = type;
13060
13087
  var $URIError = uri;
13061
13088
  var abs = abs$1;
13062
13089
  var floor = floor$1;
13063
- var max = max$2;
13090
+ var max = max$1;
13064
13091
  var min = min$1;
13065
13092
  var pow = pow$1;
13066
13093
  var round$1 = round$2;
@@ -13094,7 +13121,7 @@ var getProto = requireGetProto();
13094
13121
  var $ObjectGPO = requireObject_getPrototypeOf();
13095
13122
  var $ReflectGPO = requireReflect_getPrototypeOf();
13096
13123
  var $apply = requireFunctionApply();
13097
- var $call = functionCall;
13124
+ var $call = requireFunctionCall();
13098
13125
  var needsEval = {};
13099
13126
  var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array);
13100
13127
  var INTRINSICS = {
@@ -13265,13 +13292,13 @@ var LEGACY_ALIASES = {
13265
13292
  "%WeakMapPrototype%": ["WeakMap", "prototype"],
13266
13293
  "%WeakSetPrototype%": ["WeakSet", "prototype"]
13267
13294
  };
13268
- var bind2 = functionBind;
13295
+ var bind = requireFunctionBind();
13269
13296
  var hasOwn = requireHasown();
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);
13297
+ var $concat = bind.call($call, Array.prototype.concat);
13298
+ var $spliceApply = bind.call($apply, Array.prototype.splice);
13299
+ var $replace = bind.call($call, String.prototype.replace);
13300
+ var $strSlice = bind.call($call, String.prototype.slice);
13301
+ var $exec = bind.call($call, RegExp.prototype.exec);
13275
13302
  var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
13276
13303
  var reEscapeChar = /\\(\\)?/g;
13277
13304
  var stringToPath = function stringToPath2(string2) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heycater/qualification-funnel",
3
- "version": "1.14.0",
3
+ "version": "1.15.0",
4
4
  "type": "module",
5
5
  "description": "Heycater embedded qualification funnel widget",
6
6
  "main": "dist/index.cjs.js",
@@ -35,7 +35,9 @@
35
35
  "type-check": "tsc --noEmit",
36
36
  "test": "vitest",
37
37
  "test:ui": "vitest --ui",
38
- "test:coverage": "vitest --coverage"
38
+ "test:coverage": "vitest --coverage",
39
+ "test:e2e": "playwright test",
40
+ "test:e2e:ui": "playwright test --ui"
39
41
  },
40
42
  "peerDependencies": {
41
43
  "@bugsnag/js": "^7.5.4",
@@ -68,6 +70,7 @@
68
70
  "yup": "^0.32.9"
69
71
  },
70
72
  "devDependencies": {
73
+ "@playwright/test": "^1.58.2",
71
74
  "@svgr/rollup": "^8.1.0",
72
75
  "@testing-library/react": "^12.1.5",
73
76
  "@testing-library/react-hooks": "^8.0.1",