@heycater/qualification-funnel 1.19.17 → 1.19.19

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
@@ -10222,15 +10222,29 @@ function trackStarted(context, initialStepId) {
10222
10222
  }
10223
10223
  function trackOptimeleonConversion(eventName, serviceType) {
10224
10224
  if (typeof window === "undefined") return;
10225
+ console.log("[Optimeleon Debug] trackOptimeleonConversion called", {
10226
+ eventName,
10227
+ serviceType,
10228
+ serviceTypeType: typeof serviceType,
10229
+ serviceTypeTruthy: !!serviceType,
10230
+ optimeleonExists: !!window.optimeleon
10231
+ });
10225
10232
  if (window.optimeleon) {
10226
10233
  try {
10234
+ console.log("[Optimeleon Debug] Firing generic event:", eventName);
10227
10235
  window.optimeleon("track", eventName);
10228
10236
  if (serviceType) {
10229
- window.optimeleon("track", `${eventName}_${serviceType}`);
10237
+ const specificEvent = `${eventName}_${serviceType}`;
10238
+ console.log("[Optimeleon Debug] Firing specific event:", specificEvent);
10239
+ window.optimeleon("track", specificEvent);
10240
+ } else {
10241
+ console.log("[Optimeleon Debug] serviceType is falsy, skipping specific event");
10230
10242
  }
10231
10243
  } catch (error) {
10232
10244
  console.error("[Optimeleon] Failed to track conversion:", error);
10233
10245
  }
10246
+ } else {
10247
+ console.log("[Optimeleon Debug] window.optimeleon not available");
10234
10248
  }
10235
10249
  }
10236
10250
  function serializeAnswerValue(value) {
@@ -10330,6 +10344,7 @@ function TrackingProvider({
10330
10344
  const isLastQuestion = questionIndex === questions2.length - 1;
10331
10345
  if (question.id === "service_type" && isValidServiceType(currentValue)) {
10332
10346
  const stepOrder = getStepOrderForServiceType(currentValue);
10347
+ console.log("[Optimeleon Debug] trackingContext updating service_type:", currentValue);
10333
10348
  updateContext({
10334
10349
  service_type: currentValue,
10335
10350
  total_steps: stepOrder.length
@@ -10354,6 +10369,7 @@ function TrackingProvider({
10354
10369
  (questionId, value) => {
10355
10370
  if (questionId === "service_type" && isValidServiceType(value)) {
10356
10371
  const stepOrder = getStepOrderForServiceType(value);
10372
+ console.log("[Optimeleon Debug] trackAnswer updating service_type:", value);
10357
10373
  delete funnelContextRef.current.city;
10358
10374
  updateContext({
10359
10375
  service_type: value,
@@ -12476,7 +12492,7 @@ var objectInspect = function inspect_(obj, options, depth, seen) {
12476
12492
  var ys = arrObjKeys(obj, inspect2);
12477
12493
  var isPlainObject2 = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
12478
12494
  var protoTag = obj instanceof Object ? "" : "null prototype";
12479
- var stringTag2 = !isPlainObject2 && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr$1(obj), 8, -1) : protoTag ? "Object" : "";
12495
+ var stringTag2 = !isPlainObject2 && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? "Object" : "";
12480
12496
  var constructorTag = isPlainObject2 || typeof obj.constructor !== "function" ? "" : obj.constructor.name ? obj.constructor.name + " " : "";
12481
12497
  var tag = constructorTag + (stringTag2 || protoTag ? "[" + $join.call($concat$1.call([], stringTag2 || [], protoTag || []), ": ") + "] " : "");
12482
12498
  if (ys.length === 0) {
@@ -12501,25 +12517,25 @@ function canTrustToString(obj) {
12501
12517
  return !toStringTag || !(typeof obj === "object" && (toStringTag in obj || typeof obj[toStringTag] !== "undefined"));
12502
12518
  }
12503
12519
  function isArray$3(obj) {
12504
- return toStr$1(obj) === "[object Array]" && canTrustToString(obj);
12520
+ return toStr(obj) === "[object Array]" && canTrustToString(obj);
12505
12521
  }
12506
12522
  function isDate(obj) {
12507
- return toStr$1(obj) === "[object Date]" && canTrustToString(obj);
12523
+ return toStr(obj) === "[object Date]" && canTrustToString(obj);
12508
12524
  }
12509
12525
  function isRegExp$1(obj) {
12510
- return toStr$1(obj) === "[object RegExp]" && canTrustToString(obj);
12526
+ return toStr(obj) === "[object RegExp]" && canTrustToString(obj);
12511
12527
  }
12512
12528
  function isError(obj) {
12513
- return toStr$1(obj) === "[object Error]" && canTrustToString(obj);
12529
+ return toStr(obj) === "[object Error]" && canTrustToString(obj);
12514
12530
  }
12515
12531
  function isString(obj) {
12516
- return toStr$1(obj) === "[object String]" && canTrustToString(obj);
12532
+ return toStr(obj) === "[object String]" && canTrustToString(obj);
12517
12533
  }
12518
12534
  function isNumber(obj) {
12519
- return toStr$1(obj) === "[object Number]" && canTrustToString(obj);
12535
+ return toStr(obj) === "[object Number]" && canTrustToString(obj);
12520
12536
  }
12521
12537
  function isBoolean(obj) {
12522
- return toStr$1(obj) === "[object Boolean]" && canTrustToString(obj);
12538
+ return toStr(obj) === "[object Boolean]" && canTrustToString(obj);
12523
12539
  }
12524
12540
  function isSymbol(obj) {
12525
12541
  if (hasShammedSymbols) {
@@ -12555,7 +12571,7 @@ var hasOwn$1 = Object.prototype.hasOwnProperty || function(key) {
12555
12571
  function has$4(obj, key) {
12556
12572
  return hasOwn$1.call(obj, key);
12557
12573
  }
12558
- function toStr$1(obj) {
12574
+ function toStr(obj) {
12559
12575
  return objectToString.call(obj);
12560
12576
  }
12561
12577
  function nameOf(f) {
@@ -12864,7 +12880,7 @@ var syntax = SyntaxError;
12864
12880
  var uri = URIError;
12865
12881
  var abs$1 = Math.abs;
12866
12882
  var floor$1 = Math.floor;
12867
- var max$2 = Math.max;
12883
+ var max$1 = Math.max;
12868
12884
  var min$1 = Math.min;
12869
12885
  var pow$1 = Math.pow;
12870
12886
  var round$2 = Math.round;
@@ -12993,78 +13009,99 @@ function requireObject_getPrototypeOf() {
12993
13009
  Object_getPrototypeOf = $Object2.getPrototypeOf || null;
12994
13010
  return Object_getPrototypeOf;
12995
13011
  }
12996
- var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
12997
- var toStr = Object.prototype.toString;
12998
- var max$1 = Math.max;
12999
- var funcType = "[object Function]";
13000
- var concatty = function concatty2(a3, b2) {
13001
- var arr = [];
13002
- for (var i2 = 0; i2 < a3.length; i2 += 1) {
13003
- arr[i2] = a3[i2];
13004
- }
13005
- for (var j = 0; j < b2.length; j += 1) {
13006
- arr[j + a3.length] = b2[j];
13007
- }
13008
- return arr;
13009
- };
13010
- var slicy = function slicy2(arrLike, offset2) {
13011
- var arr = [];
13012
- for (var i2 = offset2, j = 0; i2 < arrLike.length; i2 += 1, j += 1) {
13013
- arr[j] = arrLike[i2];
13014
- }
13015
- return arr;
13016
- };
13017
- var joiny = function(arr, joiner) {
13018
- var str = "";
13019
- for (var i2 = 0; i2 < arr.length; i2 += 1) {
13020
- str += arr[i2];
13021
- if (i2 + 1 < arr.length) {
13022
- str += joiner;
13012
+ var implementation;
13013
+ var hasRequiredImplementation;
13014
+ function requireImplementation() {
13015
+ if (hasRequiredImplementation) return implementation;
13016
+ hasRequiredImplementation = 1;
13017
+ var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
13018
+ var toStr2 = Object.prototype.toString;
13019
+ var max2 = Math.max;
13020
+ var funcType = "[object Function]";
13021
+ var concatty = function concatty2(a3, b2) {
13022
+ var arr = [];
13023
+ for (var i2 = 0; i2 < a3.length; i2 += 1) {
13024
+ arr[i2] = a3[i2];
13023
13025
  }
13024
- }
13025
- return str;
13026
- };
13027
- var implementation$1 = function bind(that) {
13028
- var target = this;
13029
- if (typeof target !== "function" || toStr.apply(target) !== funcType) {
13030
- throw new TypeError(ERROR_MESSAGE + target);
13031
- }
13032
- var args = slicy(arguments, 1);
13033
- var bound;
13034
- var binder = function() {
13035
- if (this instanceof bound) {
13036
- var result = target.apply(
13037
- this,
13038
- concatty(args, arguments)
13039
- );
13040
- if (Object(result) === result) {
13041
- return result;
13026
+ for (var j = 0; j < b2.length; j += 1) {
13027
+ arr[j + a3.length] = b2[j];
13028
+ }
13029
+ return arr;
13030
+ };
13031
+ var slicy = function slicy2(arrLike, offset2) {
13032
+ var arr = [];
13033
+ for (var i2 = offset2, j = 0; i2 < arrLike.length; i2 += 1, j += 1) {
13034
+ arr[j] = arrLike[i2];
13035
+ }
13036
+ return arr;
13037
+ };
13038
+ var joiny = function(arr, joiner) {
13039
+ var str = "";
13040
+ for (var i2 = 0; i2 < arr.length; i2 += 1) {
13041
+ str += arr[i2];
13042
+ if (i2 + 1 < arr.length) {
13043
+ str += joiner;
13042
13044
  }
13043
- return this;
13044
13045
  }
13045
- return target.apply(
13046
- that,
13047
- concatty(args, arguments)
13048
- );
13046
+ return str;
13049
13047
  };
13050
- var boundLength = max$1(0, target.length - args.length);
13051
- var boundArgs = [];
13052
- for (var i2 = 0; i2 < boundLength; i2++) {
13053
- boundArgs[i2] = "$" + i2;
13054
- }
13055
- bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
13056
- if (target.prototype) {
13057
- var Empty = function Empty2() {
13048
+ implementation = function bind2(that) {
13049
+ var target = this;
13050
+ if (typeof target !== "function" || toStr2.apply(target) !== funcType) {
13051
+ throw new TypeError(ERROR_MESSAGE + target);
13052
+ }
13053
+ var args = slicy(arguments, 1);
13054
+ var bound;
13055
+ var binder = function() {
13056
+ if (this instanceof bound) {
13057
+ var result = target.apply(
13058
+ this,
13059
+ concatty(args, arguments)
13060
+ );
13061
+ if (Object(result) === result) {
13062
+ return result;
13063
+ }
13064
+ return this;
13065
+ }
13066
+ return target.apply(
13067
+ that,
13068
+ concatty(args, arguments)
13069
+ );
13058
13070
  };
13059
- Empty.prototype = target.prototype;
13060
- bound.prototype = new Empty();
13061
- Empty.prototype = null;
13062
- }
13063
- return bound;
13064
- };
13065
- var implementation = implementation$1;
13066
- var functionBind = Function.prototype.bind || implementation;
13067
- var functionCall = Function.prototype.call;
13071
+ var boundLength = max2(0, target.length - args.length);
13072
+ var boundArgs = [];
13073
+ for (var i2 = 0; i2 < boundLength; i2++) {
13074
+ boundArgs[i2] = "$" + i2;
13075
+ }
13076
+ bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
13077
+ if (target.prototype) {
13078
+ var Empty = function Empty2() {
13079
+ };
13080
+ Empty.prototype = target.prototype;
13081
+ bound.prototype = new Empty();
13082
+ Empty.prototype = null;
13083
+ }
13084
+ return bound;
13085
+ };
13086
+ return implementation;
13087
+ }
13088
+ var functionBind;
13089
+ var hasRequiredFunctionBind;
13090
+ function requireFunctionBind() {
13091
+ if (hasRequiredFunctionBind) return functionBind;
13092
+ hasRequiredFunctionBind = 1;
13093
+ var implementation2 = requireImplementation();
13094
+ functionBind = Function.prototype.bind || implementation2;
13095
+ return functionBind;
13096
+ }
13097
+ var functionCall;
13098
+ var hasRequiredFunctionCall;
13099
+ function requireFunctionCall() {
13100
+ if (hasRequiredFunctionCall) return functionCall;
13101
+ hasRequiredFunctionCall = 1;
13102
+ functionCall = Function.prototype.call;
13103
+ return functionCall;
13104
+ }
13068
13105
  var functionApply;
13069
13106
  var hasRequiredFunctionApply;
13070
13107
  function requireFunctionApply() {
@@ -13074,14 +13111,14 @@ function requireFunctionApply() {
13074
13111
  return functionApply;
13075
13112
  }
13076
13113
  var reflectApply = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
13077
- var bind$2 = functionBind;
13114
+ var bind$2 = requireFunctionBind();
13078
13115
  var $apply$1 = requireFunctionApply();
13079
- var $call$2 = functionCall;
13116
+ var $call$2 = requireFunctionCall();
13080
13117
  var $reflectApply = reflectApply;
13081
13118
  var actualApply = $reflectApply || bind$2.call($call$2, $apply$1);
13082
- var bind$1 = functionBind;
13119
+ var bind$1 = requireFunctionBind();
13083
13120
  var $TypeError$4 = type;
13084
- var $call$1 = functionCall;
13121
+ var $call$1 = requireFunctionCall();
13085
13122
  var $actualApply = actualApply;
13086
13123
  var callBindApplyHelpers = function callBindBasic(args) {
13087
13124
  if (args.length < 1 || typeof args[0] !== "function") {
@@ -13147,8 +13184,8 @@ function requireHasown() {
13147
13184
  hasRequiredHasown = 1;
13148
13185
  var call = Function.prototype.call;
13149
13186
  var $hasOwn = Object.prototype.hasOwnProperty;
13150
- var bind3 = functionBind;
13151
- hasown = bind3.call(call, $hasOwn);
13187
+ var bind2 = requireFunctionBind();
13188
+ hasown = bind2.call(call, $hasOwn);
13152
13189
  return hasown;
13153
13190
  }
13154
13191
  var undefined$1;
@@ -13162,7 +13199,7 @@ var $TypeError$3 = type;
13162
13199
  var $URIError = uri;
13163
13200
  var abs = abs$1;
13164
13201
  var floor = floor$1;
13165
- var max = max$2;
13202
+ var max = max$1;
13166
13203
  var min = min$1;
13167
13204
  var pow = pow$1;
13168
13205
  var round$1 = round$2;
@@ -13196,7 +13233,7 @@ var getProto = requireGetProto();
13196
13233
  var $ObjectGPO = requireObject_getPrototypeOf();
13197
13234
  var $ReflectGPO = requireReflect_getPrototypeOf();
13198
13235
  var $apply = requireFunctionApply();
13199
- var $call = functionCall;
13236
+ var $call = requireFunctionCall();
13200
13237
  var needsEval = {};
13201
13238
  var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array);
13202
13239
  var INTRINSICS = {
@@ -13367,13 +13404,13 @@ var LEGACY_ALIASES = {
13367
13404
  "%WeakMapPrototype%": ["WeakMap", "prototype"],
13368
13405
  "%WeakSetPrototype%": ["WeakSet", "prototype"]
13369
13406
  };
13370
- var bind2 = functionBind;
13407
+ var bind = requireFunctionBind();
13371
13408
  var hasOwn = requireHasown();
13372
- var $concat = bind2.call($call, Array.prototype.concat);
13373
- var $spliceApply = bind2.call($apply, Array.prototype.splice);
13374
- var $replace = bind2.call($call, String.prototype.replace);
13375
- var $strSlice = bind2.call($call, String.prototype.slice);
13376
- var $exec = bind2.call($call, RegExp.prototype.exec);
13409
+ var $concat = bind.call($call, Array.prototype.concat);
13410
+ var $spliceApply = bind.call($apply, Array.prototype.splice);
13411
+ var $replace = bind.call($call, String.prototype.replace);
13412
+ var $strSlice = bind.call($call, String.prototype.slice);
13413
+ var $exec = bind.call($call, RegExp.prototype.exec);
13377
13414
  var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
13378
13415
  var reEscapeChar = /\\(\\)?/g;
13379
13416
  var stringToPath = function stringToPath2(string2) {
@@ -26867,7 +26904,19 @@ function RequestForm({ header = null }) {
26867
26904
  var _a3;
26868
26905
  handleDisableCTA(true);
26869
26906
  const serviceType = (_a3 = qualification == null ? void 0 : qualification.answers) == null ? void 0 : _a3.service_type;
26870
- trackOptimeleonConversion("funnel_form_submitted", serviceType);
26907
+ const contextServiceType = funnelContextRef.current.service_type;
26908
+ console.log("[Optimeleon Debug] handleSubmit called", {
26909
+ serviceType,
26910
+ serviceTypeType: typeof serviceType,
26911
+ serviceTypeLength: serviceType == null ? void 0 : serviceType.length,
26912
+ serviceTypeFromContext: contextServiceType,
26913
+ contextServiceTypeType: typeof contextServiceType,
26914
+ allAnswers: JSON.stringify(qualification == null ? void 0 : qualification.answers),
26915
+ funnelContext: JSON.stringify(funnelContextRef.current)
26916
+ });
26917
+ const effectiveServiceType = serviceType || contextServiceType;
26918
+ console.log("[Optimeleon Debug] About to track funnel_form_submitted with:", effectiveServiceType);
26919
+ trackOptimeleonConversion("funnel_form_submitted", effectiveServiceType);
26871
26920
  const isLeadOnlyFunnel = serviceType === "regular_employee_catering" || serviceType === "full_service_event";
26872
26921
  const { deliveryAddressCountry: deliveryAddressCountry2 } = values2;
26873
26922
  const isUkLead = ["United Kingdom", "Great Britain", "UK"].includes(
@@ -26881,7 +26930,9 @@ function RequestForm({ header = null }) {
26881
26930
  setShowLeadSuccess(true);
26882
26931
  trackFormSubmitted(funnelContextRef.current, { is_uk_lead: isUkLead });
26883
26932
  trackCompleted(funnelContextRef.current);
26884
- trackOptimeleonConversion("funnel_completed", serviceType);
26933
+ console.log("[Optimeleon Debug] Lead-only flow - tracking funnel_completed with:", effectiveServiceType);
26934
+ trackOptimeleonConversion("funnel_completed", effectiveServiceType);
26935
+ window.gtag && window.gtag("event", "submit_qf_request");
26885
26936
  return;
26886
26937
  } else {
26887
26938
  console.error("[HeyCater Funnel] Lead submission failed. Result:", response);
@@ -26924,7 +26975,9 @@ function RequestForm({ header = null }) {
26924
26975
  is_logged_in: !!currentUserAccount
26925
26976
  });
26926
26977
  trackCompleted(funnelContextRef.current);
26927
- trackOptimeleonConversion("funnel_completed", serviceType);
26978
+ console.log("[Optimeleon Debug] Regular flow - tracking funnel_completed with:", effectiveServiceType);
26979
+ trackOptimeleonConversion("funnel_completed", effectiveServiceType);
26980
+ window.gtag && window.gtag("event", "submit_qf_request");
26928
26981
  actions.setRequest(values2);
26929
26982
  redirectToCustomerAccountRequest(redirectRoute);
26930
26983
  };
@@ -30112,10 +30165,18 @@ const EmbeddedFunnel = React__default.forwardRef(
30112
30165
  }
30113
30166
  const shouldRestoreCity = (restoredContext == null ? void 0 : restoredContext.service_type) === serviceType;
30114
30167
  const cityToUse = city || (shouldRestoreCity ? restoredContext == null ? void 0 : restoredContext.city : void 0);
30168
+ const finalServiceType = (restoredContext == null ? void 0 : restoredContext.service_type) || serviceType;
30169
+ console.log("[Optimeleon Debug] EmbeddedFunnel initializing context", {
30170
+ sessionId,
30171
+ serviceTypeFromState: serviceType,
30172
+ serviceTypeFromRestored: restoredContext == null ? void 0 : restoredContext.service_type,
30173
+ finalServiceType,
30174
+ allAnswers: state.qualification.answers
30175
+ });
30115
30176
  updateContext({
30116
30177
  session_id: sessionId,
30117
30178
  total_steps: totalSteps,
30118
- service_type: (restoredContext == null ? void 0 : restoredContext.service_type) || serviceType,
30179
+ service_type: finalServiceType,
30119
30180
  ...cityToUse ? { city: cityToUse } : {}
30120
30181
  });
30121
30182
  }, [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heycater/qualification-funnel",
3
- "version": "1.19.17",
3
+ "version": "1.19.19",
4
4
  "type": "module",
5
5
  "description": "Heycater embedded qualification funnel widget",
6
6
  "main": "dist/index.cjs.js",