@heycater/qualification-funnel 1.18.0 → 1.19.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
@@ -4272,6 +4272,11 @@ const useIsGb = () => {
4272
4272
  return getIsGb(query);
4273
4273
  };
4274
4274
  const getIsGb = (query) => {
4275
+ if (typeof window !== "undefined") {
4276
+ if (window.location.pathname.toLowerCase().includes("london")) {
4277
+ return true;
4278
+ }
4279
+ }
4275
4280
  if (query == null ? void 0 : query.slug) {
4276
4281
  return query.slug === "catering-london";
4277
4282
  }
@@ -4984,6 +4989,7 @@ const CITY_VALUES = [
4984
4989
  "duesseldorf",
4985
4990
  "koeln",
4986
4991
  "stuttgart",
4992
+ "london",
4987
4993
  "other"
4988
4994
  ];
4989
4995
  const CITY_QUESTION_ITEMS = [
@@ -5029,6 +5035,22 @@ const CITY_QUESTION_ITEMS = [
5029
5035
  value: "stuttgart",
5030
5036
  imageComponent: Stuttgart
5031
5037
  },
5038
+ {
5039
+ labelEn: "London",
5040
+ labelDe: "London",
5041
+ value: "london",
5042
+ imageComponent: () => /* @__PURE__ */ jsx(
5043
+ Box,
5044
+ {
5045
+ height: "80px",
5046
+ width: "80px",
5047
+ display: "flex",
5048
+ alignItems: "center",
5049
+ justifyContent: "center",
5050
+ children: /* @__PURE__ */ jsx(Other, { width: "24px" })
5051
+ }
5052
+ )
5053
+ },
5032
5054
  {
5033
5055
  value: "other",
5034
5056
  labelEn: "Other City",
@@ -5050,13 +5072,23 @@ const cityQuestion = Object.freeze(
5050
5072
  createSelectorQuestion({
5051
5073
  id: "city",
5052
5074
  getValidator: ({ selectedCaterer }) => {
5053
- const supportedCityValues = getSupportedCityValues(selectedCaterer);
5075
+ const isGb = getIsGb();
5076
+ if (isGb) {
5077
+ return yup.mixed().oneOf(["london"]).required();
5078
+ }
5079
+ const supportedCityValues = getSupportedCityValues(selectedCaterer).filter(
5080
+ (city) => city !== "london"
5081
+ );
5054
5082
  return yup.mixed().oneOf(supportedCityValues).required();
5055
5083
  },
5056
5084
  getItems: ({ selectedCaterer }) => {
5085
+ const isGb = getIsGb();
5086
+ if (isGb) {
5087
+ return CITY_QUESTION_ITEMS.filter(({ value }) => value === "london");
5088
+ }
5057
5089
  const supportedCityValues = getSupportedCityValues(selectedCaterer);
5058
5090
  return CITY_QUESTION_ITEMS.filter(
5059
- ({ value }) => supportedCityValues.includes(value)
5091
+ ({ value }) => supportedCityValues.includes(value) && value !== "london"
5060
5092
  );
5061
5093
  }
5062
5094
  })
@@ -10217,24 +10249,36 @@ function TrackingProvider({
10217
10249
  trackedSteps = [];
10218
10250
  }
10219
10251
  }
10220
- if (isFirstTracking && stepIndex > 0 && isValidServiceType(serviceType)) {
10252
+ if (isFirstTracking && isValidServiceType(serviceType)) {
10221
10253
  const stepOrder = getStepOrderForServiceType(serviceType);
10222
- for (let i2 = 0; i2 < stepIndex && i2 < stepOrder.length; i2++) {
10223
- const skippedStepId = stepOrder[i2];
10224
- if (trackedSteps.includes(skippedStepId)) continue;
10225
- const skippedSchemaStep = SCHEMA_STEPS[skippedStepId];
10226
- const skippedQuestions = (skippedSchemaStep == null ? void 0 : skippedSchemaStep.questions) || [];
10227
- skippedQuestions.forEach((question, qIdx) => {
10254
+ const allSteps = qual.steps || [];
10255
+ for (let i2 = 0; i2 < stepOrder.length; i2++) {
10256
+ const stepId = stepOrder[i2];
10257
+ if (trackedSteps.includes(stepId)) continue;
10258
+ const stepState = allSteps.find((s3) => s3.id === stepId);
10259
+ const isDisabled = (stepState == null ? void 0 : stepState.disabled) === true;
10260
+ const isBeforeCurrentStep = i2 < stepIndex;
10261
+ const isCurrentStep = stepId === step2.id;
10262
+ if (isCurrentStep) continue;
10263
+ const shouldTrack = isBeforeCurrentStep || isDisabled;
10264
+ if (!shouldTrack) continue;
10265
+ const schemaStep2 = SCHEMA_STEPS[stepId];
10266
+ const questions22 = (schemaStep2 == null ? void 0 : schemaStep2.questions) || [];
10267
+ if (isDisabled) {
10268
+ const hasAnswer = questions22.some((q2) => answerOf(q2.id) !== void 0);
10269
+ if (!hasAnswer) continue;
10270
+ }
10271
+ questions22.forEach((question, qIdx) => {
10228
10272
  const value = answerOf(question.id);
10229
10273
  trackAnswerSelected(funnelContextRef.current, {
10230
- step_id: skippedStepId,
10274
+ step_id: stepId,
10231
10275
  step_index: i2,
10232
10276
  question_id: question.id,
10233
10277
  answer_value: serializeAnswerValue(value),
10234
- is_last_question: qIdx === skippedQuestions.length - 1
10278
+ is_last_question: qIdx === questions22.length - 1
10235
10279
  });
10236
10280
  });
10237
- trackedSteps.push(skippedStepId);
10281
+ trackedSteps.push(stepId);
10238
10282
  }
10239
10283
  }
10240
10284
  if (trackedSteps.includes(step2.id)) return;
@@ -12391,7 +12435,7 @@ var objectInspect = function inspect_(obj, options, depth, seen) {
12391
12435
  var ys = arrObjKeys(obj, inspect2);
12392
12436
  var isPlainObject2 = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
12393
12437
  var protoTag = obj instanceof Object ? "" : "null prototype";
12394
- var stringTag2 = !isPlainObject2 && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr$1(obj), 8, -1) : protoTag ? "Object" : "";
12438
+ var stringTag2 = !isPlainObject2 && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? "Object" : "";
12395
12439
  var constructorTag = isPlainObject2 || typeof obj.constructor !== "function" ? "" : obj.constructor.name ? obj.constructor.name + " " : "";
12396
12440
  var tag = constructorTag + (stringTag2 || protoTag ? "[" + $join.call($concat$1.call([], stringTag2 || [], protoTag || []), ": ") + "] " : "");
12397
12441
  if (ys.length === 0) {
@@ -12416,25 +12460,25 @@ function canTrustToString(obj) {
12416
12460
  return !toStringTag || !(typeof obj === "object" && (toStringTag in obj || typeof obj[toStringTag] !== "undefined"));
12417
12461
  }
12418
12462
  function isArray$3(obj) {
12419
- return toStr$1(obj) === "[object Array]" && canTrustToString(obj);
12463
+ return toStr(obj) === "[object Array]" && canTrustToString(obj);
12420
12464
  }
12421
12465
  function isDate(obj) {
12422
- return toStr$1(obj) === "[object Date]" && canTrustToString(obj);
12466
+ return toStr(obj) === "[object Date]" && canTrustToString(obj);
12423
12467
  }
12424
12468
  function isRegExp$1(obj) {
12425
- return toStr$1(obj) === "[object RegExp]" && canTrustToString(obj);
12469
+ return toStr(obj) === "[object RegExp]" && canTrustToString(obj);
12426
12470
  }
12427
12471
  function isError(obj) {
12428
- return toStr$1(obj) === "[object Error]" && canTrustToString(obj);
12472
+ return toStr(obj) === "[object Error]" && canTrustToString(obj);
12429
12473
  }
12430
12474
  function isString(obj) {
12431
- return toStr$1(obj) === "[object String]" && canTrustToString(obj);
12475
+ return toStr(obj) === "[object String]" && canTrustToString(obj);
12432
12476
  }
12433
12477
  function isNumber(obj) {
12434
- return toStr$1(obj) === "[object Number]" && canTrustToString(obj);
12478
+ return toStr(obj) === "[object Number]" && canTrustToString(obj);
12435
12479
  }
12436
12480
  function isBoolean(obj) {
12437
- return toStr$1(obj) === "[object Boolean]" && canTrustToString(obj);
12481
+ return toStr(obj) === "[object Boolean]" && canTrustToString(obj);
12438
12482
  }
12439
12483
  function isSymbol(obj) {
12440
12484
  if (hasShammedSymbols) {
@@ -12470,7 +12514,7 @@ var hasOwn$1 = Object.prototype.hasOwnProperty || function(key) {
12470
12514
  function has$4(obj, key) {
12471
12515
  return hasOwn$1.call(obj, key);
12472
12516
  }
12473
- function toStr$1(obj) {
12517
+ function toStr(obj) {
12474
12518
  return objectToString.call(obj);
12475
12519
  }
12476
12520
  function nameOf(f) {
@@ -12779,7 +12823,7 @@ var syntax = SyntaxError;
12779
12823
  var uri = URIError;
12780
12824
  var abs$1 = Math.abs;
12781
12825
  var floor$1 = Math.floor;
12782
- var max$2 = Math.max;
12826
+ var max$1 = Math.max;
12783
12827
  var min$1 = Math.min;
12784
12828
  var pow$1 = Math.pow;
12785
12829
  var round$2 = Math.round;
@@ -12908,77 +12952,91 @@ function requireObject_getPrototypeOf() {
12908
12952
  Object_getPrototypeOf = $Object2.getPrototypeOf || null;
12909
12953
  return Object_getPrototypeOf;
12910
12954
  }
12911
- var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
12912
- var toStr = Object.prototype.toString;
12913
- var max$1 = Math.max;
12914
- var funcType = "[object Function]";
12915
- var concatty = function concatty2(a3, b2) {
12916
- var arr = [];
12917
- for (var i2 = 0; i2 < a3.length; i2 += 1) {
12918
- arr[i2] = a3[i2];
12919
- }
12920
- for (var j = 0; j < b2.length; j += 1) {
12921
- arr[j + a3.length] = b2[j];
12922
- }
12923
- return arr;
12924
- };
12925
- var slicy = function slicy2(arrLike, offset2) {
12926
- var arr = [];
12927
- for (var i2 = offset2, j = 0; i2 < arrLike.length; i2 += 1, j += 1) {
12928
- arr[j] = arrLike[i2];
12929
- }
12930
- return arr;
12931
- };
12932
- var joiny = function(arr, joiner) {
12933
- var str = "";
12934
- for (var i2 = 0; i2 < arr.length; i2 += 1) {
12935
- str += arr[i2];
12936
- if (i2 + 1 < arr.length) {
12937
- str += joiner;
12955
+ var implementation;
12956
+ var hasRequiredImplementation;
12957
+ function requireImplementation() {
12958
+ if (hasRequiredImplementation) return implementation;
12959
+ hasRequiredImplementation = 1;
12960
+ var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
12961
+ var toStr2 = Object.prototype.toString;
12962
+ var max2 = Math.max;
12963
+ var funcType = "[object Function]";
12964
+ var concatty = function concatty2(a3, b2) {
12965
+ var arr = [];
12966
+ for (var i2 = 0; i2 < a3.length; i2 += 1) {
12967
+ arr[i2] = a3[i2];
12938
12968
  }
12939
- }
12940
- return str;
12941
- };
12942
- var implementation$1 = function bind(that) {
12943
- var target = this;
12944
- if (typeof target !== "function" || toStr.apply(target) !== funcType) {
12945
- throw new TypeError(ERROR_MESSAGE + target);
12946
- }
12947
- var args = slicy(arguments, 1);
12948
- var bound;
12949
- var binder = function() {
12950
- if (this instanceof bound) {
12951
- var result = target.apply(
12952
- this,
12953
- concatty(args, arguments)
12954
- );
12955
- if (Object(result) === result) {
12956
- return result;
12969
+ for (var j = 0; j < b2.length; j += 1) {
12970
+ arr[j + a3.length] = b2[j];
12971
+ }
12972
+ return arr;
12973
+ };
12974
+ var slicy = function slicy2(arrLike, offset2) {
12975
+ var arr = [];
12976
+ for (var i2 = offset2, j = 0; i2 < arrLike.length; i2 += 1, j += 1) {
12977
+ arr[j] = arrLike[i2];
12978
+ }
12979
+ return arr;
12980
+ };
12981
+ var joiny = function(arr, joiner) {
12982
+ var str = "";
12983
+ for (var i2 = 0; i2 < arr.length; i2 += 1) {
12984
+ str += arr[i2];
12985
+ if (i2 + 1 < arr.length) {
12986
+ str += joiner;
12957
12987
  }
12958
- return this;
12959
12988
  }
12960
- return target.apply(
12961
- that,
12962
- concatty(args, arguments)
12963
- );
12989
+ return str;
12964
12990
  };
12965
- var boundLength = max$1(0, target.length - args.length);
12966
- var boundArgs = [];
12967
- for (var i2 = 0; i2 < boundLength; i2++) {
12968
- boundArgs[i2] = "$" + i2;
12969
- }
12970
- bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
12971
- if (target.prototype) {
12972
- var Empty = function Empty2() {
12991
+ implementation = function bind2(that) {
12992
+ var target = this;
12993
+ if (typeof target !== "function" || toStr2.apply(target) !== funcType) {
12994
+ throw new TypeError(ERROR_MESSAGE + target);
12995
+ }
12996
+ var args = slicy(arguments, 1);
12997
+ var bound;
12998
+ var binder = function() {
12999
+ if (this instanceof bound) {
13000
+ var result = target.apply(
13001
+ this,
13002
+ concatty(args, arguments)
13003
+ );
13004
+ if (Object(result) === result) {
13005
+ return result;
13006
+ }
13007
+ return this;
13008
+ }
13009
+ return target.apply(
13010
+ that,
13011
+ concatty(args, arguments)
13012
+ );
12973
13013
  };
12974
- Empty.prototype = target.prototype;
12975
- bound.prototype = new Empty();
12976
- Empty.prototype = null;
12977
- }
12978
- return bound;
12979
- };
12980
- var implementation = implementation$1;
12981
- var functionBind = Function.prototype.bind || implementation;
13014
+ var boundLength = max2(0, target.length - args.length);
13015
+ var boundArgs = [];
13016
+ for (var i2 = 0; i2 < boundLength; i2++) {
13017
+ boundArgs[i2] = "$" + i2;
13018
+ }
13019
+ bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
13020
+ if (target.prototype) {
13021
+ var Empty = function Empty2() {
13022
+ };
13023
+ Empty.prototype = target.prototype;
13024
+ bound.prototype = new Empty();
13025
+ Empty.prototype = null;
13026
+ }
13027
+ return bound;
13028
+ };
13029
+ return implementation;
13030
+ }
13031
+ var functionBind;
13032
+ var hasRequiredFunctionBind;
13033
+ function requireFunctionBind() {
13034
+ if (hasRequiredFunctionBind) return functionBind;
13035
+ hasRequiredFunctionBind = 1;
13036
+ var implementation2 = requireImplementation();
13037
+ functionBind = Function.prototype.bind || implementation2;
13038
+ return functionBind;
13039
+ }
12982
13040
  var functionCall;
12983
13041
  var hasRequiredFunctionCall;
12984
13042
  function requireFunctionCall() {
@@ -12996,12 +13054,12 @@ function requireFunctionApply() {
12996
13054
  return functionApply;
12997
13055
  }
12998
13056
  var reflectApply = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
12999
- var bind$2 = functionBind;
13057
+ var bind$2 = requireFunctionBind();
13000
13058
  var $apply$1 = requireFunctionApply();
13001
13059
  var $call$2 = requireFunctionCall();
13002
13060
  var $reflectApply = reflectApply;
13003
13061
  var actualApply = $reflectApply || bind$2.call($call$2, $apply$1);
13004
- var bind$1 = functionBind;
13062
+ var bind$1 = requireFunctionBind();
13005
13063
  var $TypeError$4 = type;
13006
13064
  var $call$1 = requireFunctionCall();
13007
13065
  var $actualApply = actualApply;
@@ -13069,8 +13127,8 @@ function requireHasown() {
13069
13127
  hasRequiredHasown = 1;
13070
13128
  var call = Function.prototype.call;
13071
13129
  var $hasOwn = Object.prototype.hasOwnProperty;
13072
- var bind3 = functionBind;
13073
- hasown = bind3.call(call, $hasOwn);
13130
+ var bind2 = requireFunctionBind();
13131
+ hasown = bind2.call(call, $hasOwn);
13074
13132
  return hasown;
13075
13133
  }
13076
13134
  var undefined$1;
@@ -13084,7 +13142,7 @@ var $TypeError$3 = type;
13084
13142
  var $URIError = uri;
13085
13143
  var abs = abs$1;
13086
13144
  var floor = floor$1;
13087
- var max = max$2;
13145
+ var max = max$1;
13088
13146
  var min = min$1;
13089
13147
  var pow = pow$1;
13090
13148
  var round$1 = round$2;
@@ -13289,13 +13347,13 @@ var LEGACY_ALIASES = {
13289
13347
  "%WeakMapPrototype%": ["WeakMap", "prototype"],
13290
13348
  "%WeakSetPrototype%": ["WeakSet", "prototype"]
13291
13349
  };
13292
- var bind2 = functionBind;
13350
+ var bind = requireFunctionBind();
13293
13351
  var hasOwn = requireHasown();
13294
- var $concat = bind2.call($call, Array.prototype.concat);
13295
- var $spliceApply = bind2.call($apply, Array.prototype.splice);
13296
- var $replace = bind2.call($call, String.prototype.replace);
13297
- var $strSlice = bind2.call($call, String.prototype.slice);
13298
- var $exec = bind2.call($call, RegExp.prototype.exec);
13352
+ var $concat = bind.call($call, Array.prototype.concat);
13353
+ var $spliceApply = bind.call($apply, Array.prototype.splice);
13354
+ var $replace = bind.call($call, String.prototype.replace);
13355
+ var $strSlice = bind.call($call, String.prototype.slice);
13356
+ var $exec = bind.call($call, RegExp.prototype.exec);
13299
13357
  var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
13300
13358
  var reEscapeChar = /\\(\\)?/g;
13301
13359
  var stringToPath = function stringToPath2(string2) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heycater/qualification-funnel",
3
- "version": "1.18.0",
3
+ "version": "1.19.0",
4
4
  "type": "module",
5
5
  "description": "Heycater embedded qualification funnel widget",
6
6
  "main": "dist/index.cjs.js",