@heycater/qualification-funnel 1.19.30 → 1.19.32
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 +119 -119
- package/dist/index.cjs.js +364 -364
- package/dist/index.esm.js +156 -113
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -12709,7 +12709,7 @@ var objectInspect = function inspect_(obj, options, depth, seen) {
|
|
|
12709
12709
|
var ys = arrObjKeys(obj, inspect2);
|
|
12710
12710
|
var isPlainObject2 = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
|
|
12711
12711
|
var protoTag = obj instanceof Object ? "" : "null prototype";
|
|
12712
|
-
var stringTag2 = !isPlainObject2 && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr
|
|
12712
|
+
var stringTag2 = !isPlainObject2 && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? "Object" : "";
|
|
12713
12713
|
var constructorTag = isPlainObject2 || typeof obj.constructor !== "function" ? "" : obj.constructor.name ? obj.constructor.name + " " : "";
|
|
12714
12714
|
var tag = constructorTag + (stringTag2 || protoTag ? "[" + $join.call($concat$1.call([], stringTag2 || [], protoTag || []), ": ") + "] " : "");
|
|
12715
12715
|
if (ys.length === 0) {
|
|
@@ -12734,25 +12734,25 @@ function canTrustToString(obj) {
|
|
|
12734
12734
|
return !toStringTag || !(typeof obj === "object" && (toStringTag in obj || typeof obj[toStringTag] !== "undefined"));
|
|
12735
12735
|
}
|
|
12736
12736
|
function isArray$3(obj) {
|
|
12737
|
-
return toStr
|
|
12737
|
+
return toStr(obj) === "[object Array]" && canTrustToString(obj);
|
|
12738
12738
|
}
|
|
12739
12739
|
function isDate(obj) {
|
|
12740
|
-
return toStr
|
|
12740
|
+
return toStr(obj) === "[object Date]" && canTrustToString(obj);
|
|
12741
12741
|
}
|
|
12742
12742
|
function isRegExp$1(obj) {
|
|
12743
|
-
return toStr
|
|
12743
|
+
return toStr(obj) === "[object RegExp]" && canTrustToString(obj);
|
|
12744
12744
|
}
|
|
12745
12745
|
function isError(obj) {
|
|
12746
|
-
return toStr
|
|
12746
|
+
return toStr(obj) === "[object Error]" && canTrustToString(obj);
|
|
12747
12747
|
}
|
|
12748
12748
|
function isString(obj) {
|
|
12749
|
-
return toStr
|
|
12749
|
+
return toStr(obj) === "[object String]" && canTrustToString(obj);
|
|
12750
12750
|
}
|
|
12751
12751
|
function isNumber(obj) {
|
|
12752
|
-
return toStr
|
|
12752
|
+
return toStr(obj) === "[object Number]" && canTrustToString(obj);
|
|
12753
12753
|
}
|
|
12754
12754
|
function isBoolean(obj) {
|
|
12755
|
-
return toStr
|
|
12755
|
+
return toStr(obj) === "[object Boolean]" && canTrustToString(obj);
|
|
12756
12756
|
}
|
|
12757
12757
|
function isSymbol(obj) {
|
|
12758
12758
|
if (hasShammedSymbols) {
|
|
@@ -12788,7 +12788,7 @@ var hasOwn$1 = Object.prototype.hasOwnProperty || function(key) {
|
|
|
12788
12788
|
function has$4(obj, key) {
|
|
12789
12789
|
return hasOwn$1.call(obj, key);
|
|
12790
12790
|
}
|
|
12791
|
-
function toStr
|
|
12791
|
+
function toStr(obj) {
|
|
12792
12792
|
return objectToString.call(obj);
|
|
12793
12793
|
}
|
|
12794
12794
|
function nameOf(f) {
|
|
@@ -13097,7 +13097,7 @@ var syntax = SyntaxError;
|
|
|
13097
13097
|
var uri = URIError;
|
|
13098
13098
|
var abs$1 = Math.abs;
|
|
13099
13099
|
var floor$1 = Math.floor;
|
|
13100
|
-
var max$
|
|
13100
|
+
var max$1 = Math.max;
|
|
13101
13101
|
var min$1 = Math.min;
|
|
13102
13102
|
var pow$1 = Math.pow;
|
|
13103
13103
|
var round$2 = Math.round;
|
|
@@ -13226,78 +13226,99 @@ function requireObject_getPrototypeOf() {
|
|
|
13226
13226
|
Object_getPrototypeOf = $Object2.getPrototypeOf || null;
|
|
13227
13227
|
return Object_getPrototypeOf;
|
|
13228
13228
|
}
|
|
13229
|
-
var
|
|
13230
|
-
var
|
|
13231
|
-
|
|
13232
|
-
|
|
13233
|
-
|
|
13234
|
-
var
|
|
13235
|
-
|
|
13236
|
-
|
|
13237
|
-
|
|
13238
|
-
|
|
13239
|
-
arr
|
|
13240
|
-
|
|
13241
|
-
|
|
13242
|
-
};
|
|
13243
|
-
var slicy = function slicy2(arrLike, offset2) {
|
|
13244
|
-
var arr = [];
|
|
13245
|
-
for (var i2 = offset2, j = 0; i2 < arrLike.length; i2 += 1, j += 1) {
|
|
13246
|
-
arr[j] = arrLike[i2];
|
|
13247
|
-
}
|
|
13248
|
-
return arr;
|
|
13249
|
-
};
|
|
13250
|
-
var joiny = function(arr, joiner) {
|
|
13251
|
-
var str = "";
|
|
13252
|
-
for (var i2 = 0; i2 < arr.length; i2 += 1) {
|
|
13253
|
-
str += arr[i2];
|
|
13254
|
-
if (i2 + 1 < arr.length) {
|
|
13255
|
-
str += joiner;
|
|
13229
|
+
var implementation;
|
|
13230
|
+
var hasRequiredImplementation;
|
|
13231
|
+
function requireImplementation() {
|
|
13232
|
+
if (hasRequiredImplementation) return implementation;
|
|
13233
|
+
hasRequiredImplementation = 1;
|
|
13234
|
+
var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
|
|
13235
|
+
var toStr2 = Object.prototype.toString;
|
|
13236
|
+
var max2 = Math.max;
|
|
13237
|
+
var funcType = "[object Function]";
|
|
13238
|
+
var concatty = function concatty2(a3, b2) {
|
|
13239
|
+
var arr = [];
|
|
13240
|
+
for (var i2 = 0; i2 < a3.length; i2 += 1) {
|
|
13241
|
+
arr[i2] = a3[i2];
|
|
13256
13242
|
}
|
|
13257
|
-
|
|
13258
|
-
|
|
13259
|
-
}
|
|
13260
|
-
|
|
13261
|
-
|
|
13262
|
-
|
|
13263
|
-
|
|
13264
|
-
|
|
13265
|
-
|
|
13266
|
-
|
|
13267
|
-
|
|
13268
|
-
|
|
13269
|
-
|
|
13270
|
-
|
|
13271
|
-
|
|
13272
|
-
|
|
13273
|
-
if (
|
|
13274
|
-
|
|
13243
|
+
for (var j = 0; j < b2.length; j += 1) {
|
|
13244
|
+
arr[j + a3.length] = b2[j];
|
|
13245
|
+
}
|
|
13246
|
+
return arr;
|
|
13247
|
+
};
|
|
13248
|
+
var slicy = function slicy2(arrLike, offset2) {
|
|
13249
|
+
var arr = [];
|
|
13250
|
+
for (var i2 = offset2, j = 0; i2 < arrLike.length; i2 += 1, j += 1) {
|
|
13251
|
+
arr[j] = arrLike[i2];
|
|
13252
|
+
}
|
|
13253
|
+
return arr;
|
|
13254
|
+
};
|
|
13255
|
+
var joiny = function(arr, joiner) {
|
|
13256
|
+
var str = "";
|
|
13257
|
+
for (var i2 = 0; i2 < arr.length; i2 += 1) {
|
|
13258
|
+
str += arr[i2];
|
|
13259
|
+
if (i2 + 1 < arr.length) {
|
|
13260
|
+
str += joiner;
|
|
13275
13261
|
}
|
|
13276
|
-
return this;
|
|
13277
13262
|
}
|
|
13278
|
-
return
|
|
13279
|
-
that,
|
|
13280
|
-
concatty(args, arguments)
|
|
13281
|
-
);
|
|
13263
|
+
return str;
|
|
13282
13264
|
};
|
|
13283
|
-
|
|
13284
|
-
|
|
13285
|
-
|
|
13286
|
-
|
|
13287
|
-
|
|
13288
|
-
|
|
13289
|
-
|
|
13290
|
-
var
|
|
13265
|
+
implementation = function bind2(that) {
|
|
13266
|
+
var target = this;
|
|
13267
|
+
if (typeof target !== "function" || toStr2.apply(target) !== funcType) {
|
|
13268
|
+
throw new TypeError(ERROR_MESSAGE + target);
|
|
13269
|
+
}
|
|
13270
|
+
var args = slicy(arguments, 1);
|
|
13271
|
+
var bound;
|
|
13272
|
+
var binder = function() {
|
|
13273
|
+
if (this instanceof bound) {
|
|
13274
|
+
var result = target.apply(
|
|
13275
|
+
this,
|
|
13276
|
+
concatty(args, arguments)
|
|
13277
|
+
);
|
|
13278
|
+
if (Object(result) === result) {
|
|
13279
|
+
return result;
|
|
13280
|
+
}
|
|
13281
|
+
return this;
|
|
13282
|
+
}
|
|
13283
|
+
return target.apply(
|
|
13284
|
+
that,
|
|
13285
|
+
concatty(args, arguments)
|
|
13286
|
+
);
|
|
13291
13287
|
};
|
|
13292
|
-
|
|
13293
|
-
|
|
13294
|
-
|
|
13295
|
-
|
|
13296
|
-
|
|
13297
|
-
};
|
|
13298
|
-
|
|
13299
|
-
var
|
|
13300
|
-
|
|
13288
|
+
var boundLength = max2(0, target.length - args.length);
|
|
13289
|
+
var boundArgs = [];
|
|
13290
|
+
for (var i2 = 0; i2 < boundLength; i2++) {
|
|
13291
|
+
boundArgs[i2] = "$" + i2;
|
|
13292
|
+
}
|
|
13293
|
+
bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
|
|
13294
|
+
if (target.prototype) {
|
|
13295
|
+
var Empty = function Empty2() {
|
|
13296
|
+
};
|
|
13297
|
+
Empty.prototype = target.prototype;
|
|
13298
|
+
bound.prototype = new Empty();
|
|
13299
|
+
Empty.prototype = null;
|
|
13300
|
+
}
|
|
13301
|
+
return bound;
|
|
13302
|
+
};
|
|
13303
|
+
return implementation;
|
|
13304
|
+
}
|
|
13305
|
+
var functionBind;
|
|
13306
|
+
var hasRequiredFunctionBind;
|
|
13307
|
+
function requireFunctionBind() {
|
|
13308
|
+
if (hasRequiredFunctionBind) return functionBind;
|
|
13309
|
+
hasRequiredFunctionBind = 1;
|
|
13310
|
+
var implementation2 = requireImplementation();
|
|
13311
|
+
functionBind = Function.prototype.bind || implementation2;
|
|
13312
|
+
return functionBind;
|
|
13313
|
+
}
|
|
13314
|
+
var functionCall;
|
|
13315
|
+
var hasRequiredFunctionCall;
|
|
13316
|
+
function requireFunctionCall() {
|
|
13317
|
+
if (hasRequiredFunctionCall) return functionCall;
|
|
13318
|
+
hasRequiredFunctionCall = 1;
|
|
13319
|
+
functionCall = Function.prototype.call;
|
|
13320
|
+
return functionCall;
|
|
13321
|
+
}
|
|
13301
13322
|
var functionApply;
|
|
13302
13323
|
var hasRequiredFunctionApply;
|
|
13303
13324
|
function requireFunctionApply() {
|
|
@@ -13307,14 +13328,14 @@ function requireFunctionApply() {
|
|
|
13307
13328
|
return functionApply;
|
|
13308
13329
|
}
|
|
13309
13330
|
var reflectApply = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
|
|
13310
|
-
var bind$2 =
|
|
13331
|
+
var bind$2 = requireFunctionBind();
|
|
13311
13332
|
var $apply$1 = requireFunctionApply();
|
|
13312
|
-
var $call$2 =
|
|
13333
|
+
var $call$2 = requireFunctionCall();
|
|
13313
13334
|
var $reflectApply = reflectApply;
|
|
13314
13335
|
var actualApply = $reflectApply || bind$2.call($call$2, $apply$1);
|
|
13315
|
-
var bind$1 =
|
|
13336
|
+
var bind$1 = requireFunctionBind();
|
|
13316
13337
|
var $TypeError$4 = type;
|
|
13317
|
-
var $call$1 =
|
|
13338
|
+
var $call$1 = requireFunctionCall();
|
|
13318
13339
|
var $actualApply = actualApply;
|
|
13319
13340
|
var callBindApplyHelpers = function callBindBasic(args) {
|
|
13320
13341
|
if (args.length < 1 || typeof args[0] !== "function") {
|
|
@@ -13380,8 +13401,8 @@ function requireHasown() {
|
|
|
13380
13401
|
hasRequiredHasown = 1;
|
|
13381
13402
|
var call = Function.prototype.call;
|
|
13382
13403
|
var $hasOwn = Object.prototype.hasOwnProperty;
|
|
13383
|
-
var
|
|
13384
|
-
hasown =
|
|
13404
|
+
var bind2 = requireFunctionBind();
|
|
13405
|
+
hasown = bind2.call(call, $hasOwn);
|
|
13385
13406
|
return hasown;
|
|
13386
13407
|
}
|
|
13387
13408
|
var undefined$1;
|
|
@@ -13395,7 +13416,7 @@ var $TypeError$3 = type;
|
|
|
13395
13416
|
var $URIError = uri;
|
|
13396
13417
|
var abs = abs$1;
|
|
13397
13418
|
var floor = floor$1;
|
|
13398
|
-
var max = max$
|
|
13419
|
+
var max = max$1;
|
|
13399
13420
|
var min = min$1;
|
|
13400
13421
|
var pow = pow$1;
|
|
13401
13422
|
var round$1 = round$2;
|
|
@@ -13429,7 +13450,7 @@ var getProto = requireGetProto();
|
|
|
13429
13450
|
var $ObjectGPO = requireObject_getPrototypeOf();
|
|
13430
13451
|
var $ReflectGPO = requireReflect_getPrototypeOf();
|
|
13431
13452
|
var $apply = requireFunctionApply();
|
|
13432
|
-
var $call =
|
|
13453
|
+
var $call = requireFunctionCall();
|
|
13433
13454
|
var needsEval = {};
|
|
13434
13455
|
var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array);
|
|
13435
13456
|
var INTRINSICS = {
|
|
@@ -13600,13 +13621,13 @@ var LEGACY_ALIASES = {
|
|
|
13600
13621
|
"%WeakMapPrototype%": ["WeakMap", "prototype"],
|
|
13601
13622
|
"%WeakSetPrototype%": ["WeakSet", "prototype"]
|
|
13602
13623
|
};
|
|
13603
|
-
var
|
|
13624
|
+
var bind = requireFunctionBind();
|
|
13604
13625
|
var hasOwn = requireHasown();
|
|
13605
|
-
var $concat =
|
|
13606
|
-
var $spliceApply =
|
|
13607
|
-
var $replace =
|
|
13608
|
-
var $strSlice =
|
|
13609
|
-
var $exec =
|
|
13626
|
+
var $concat = bind.call($call, Array.prototype.concat);
|
|
13627
|
+
var $spliceApply = bind.call($apply, Array.prototype.splice);
|
|
13628
|
+
var $replace = bind.call($call, String.prototype.replace);
|
|
13629
|
+
var $strSlice = bind.call($call, String.prototype.slice);
|
|
13630
|
+
var $exec = bind.call($call, RegExp.prototype.exec);
|
|
13610
13631
|
var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
|
|
13611
13632
|
var reEscapeChar = /\\(\\)?/g;
|
|
13612
13633
|
var stringToPath = function stringToPath2(string2) {
|
|
@@ -31277,18 +31298,21 @@ const REDESIGN_STEPS = {
|
|
|
31277
31298
|
breadcrumbEn: "Get quotes"
|
|
31278
31299
|
}
|
|
31279
31300
|
};
|
|
31280
|
-
function getRedesignTotalSteps() {
|
|
31281
|
-
return REDESIGN_STEP_ORDER.length + 1;
|
|
31282
|
-
}
|
|
31283
|
-
const RAIL_DISPLAY_STEPS = [
|
|
31284
|
-
...REDESIGN_STEP_ORDER,
|
|
31285
|
-
REDESIGN_STEP_IDS.contact
|
|
31286
|
-
];
|
|
31287
31301
|
const StepRail = ({ currentStepId, onStepClick, answers }) => {
|
|
31288
31302
|
var _a2;
|
|
31289
31303
|
const { i18n } = useTranslation();
|
|
31290
31304
|
const isGerman = (_a2 = i18n.language) == null ? void 0 : _a2.startsWith("de");
|
|
31291
|
-
const
|
|
31305
|
+
const { state } = useQualification();
|
|
31306
|
+
const isCityStepDisabled = useMemo(() => {
|
|
31307
|
+
if (!("qualification" in state)) return false;
|
|
31308
|
+
const cityStep2 = state.qualification.steps.find((s3) => s3.id === "city");
|
|
31309
|
+
return (cityStep2 == null ? void 0 : cityStep2.disabled) === true;
|
|
31310
|
+
}, ["qualification" in state ? state.qualification.steps : null]);
|
|
31311
|
+
const railDisplaySteps = useMemo(() => {
|
|
31312
|
+
const steps2 = isCityStepDisabled ? REDESIGN_STEP_ORDER.filter((step2) => step2 !== REDESIGN_STEP_IDS.city) : [...REDESIGN_STEP_ORDER];
|
|
31313
|
+
return [...steps2, REDESIGN_STEP_IDS.contact];
|
|
31314
|
+
}, [isCityStepDisabled]);
|
|
31315
|
+
const currentIndex = railDisplaySteps.indexOf(currentStepId);
|
|
31292
31316
|
const handleStepClick = (stepId, index) => {
|
|
31293
31317
|
if (index < currentIndex && onStepClick && stepId !== REDESIGN_STEP_IDS.contact) {
|
|
31294
31318
|
onStepClick(stepId);
|
|
@@ -31316,7 +31340,7 @@ const StepRail = ({ currentStepId, onStepClick, answers }) => {
|
|
|
31316
31340
|
/* @__PURE__ */ jsx(LogoWrapper$1, { children: /* @__PURE__ */ jsx(Logo, { height: 26 }) }),
|
|
31317
31341
|
/* @__PURE__ */ jsx(SectionLabel, { children: isGerman ? "Catering anfragen" : "Request catering" }),
|
|
31318
31342
|
/* @__PURE__ */ jsx(Title$1, { children: isGerman ? "In wenigen Schritten zum passenden Catering." : "Get the perfect catering in just a few steps." }),
|
|
31319
|
-
/* @__PURE__ */ jsx(StepList, { children:
|
|
31343
|
+
/* @__PURE__ */ jsx(StepList, { children: railDisplaySteps.map((stepId, index) => {
|
|
31320
31344
|
const step2 = REDESIGN_STEPS[stepId];
|
|
31321
31345
|
const isActive = index === currentIndex;
|
|
31322
31346
|
const isCompleted = index < currentIndex;
|
|
@@ -32391,6 +32415,17 @@ const RedesignedFunnel = ({
|
|
|
32391
32415
|
const isGerman = (_a2 = i18n.language) == null ? void 0 : _a2.startsWith("de");
|
|
32392
32416
|
const router = useRouter();
|
|
32393
32417
|
const { state, actions, answerOf } = useQualification();
|
|
32418
|
+
const isCityStepDisabled = React__default.useMemo(() => {
|
|
32419
|
+
if (!("qualification" in state)) return false;
|
|
32420
|
+
const cityStep2 = state.qualification.steps.find((s3) => s3.id === "city");
|
|
32421
|
+
return (cityStep2 == null ? void 0 : cityStep2.disabled) === true;
|
|
32422
|
+
}, ["qualification" in state ? state.qualification.steps : null]);
|
|
32423
|
+
const stepOrder = React__default.useMemo(() => {
|
|
32424
|
+
if (isCityStepDisabled) {
|
|
32425
|
+
return REDESIGN_STEP_ORDER.filter((step2) => step2 !== REDESIGN_STEP_IDS.city);
|
|
32426
|
+
}
|
|
32427
|
+
return REDESIGN_STEP_ORDER;
|
|
32428
|
+
}, [isCityStepDisabled]);
|
|
32394
32429
|
const [currentStepIndex, setCurrentStepIndex] = useState(0);
|
|
32395
32430
|
const [phase, setPhase] = useState("questions");
|
|
32396
32431
|
const [budgetPerPerson2, setBudgetPerPerson] = useState(20);
|
|
@@ -32399,7 +32434,7 @@ const RedesignedFunnel = ({
|
|
|
32399
32434
|
const [redirectUrl, setRedirectUrl] = useState(null);
|
|
32400
32435
|
const hasTrackedStart = useRef(false);
|
|
32401
32436
|
const { submitAsNewCustomer } = useRequestForm();
|
|
32402
|
-
const currentStepId =
|
|
32437
|
+
const currentStepId = stepOrder[currentStepIndex];
|
|
32403
32438
|
const handleCancel = onCancel || (() => window.history.back());
|
|
32404
32439
|
useEffect(() => {
|
|
32405
32440
|
if (currentStepId === "redesign_people_count") {
|
|
@@ -32440,26 +32475,26 @@ const RedesignedFunnel = ({
|
|
|
32440
32475
|
}, [funnelContextRef, currentStepIndex, currentStepId]);
|
|
32441
32476
|
const nextStep = useCallback(() => {
|
|
32442
32477
|
const nextIndex = currentStepIndex + 1;
|
|
32443
|
-
if (nextIndex >=
|
|
32478
|
+
if (nextIndex >= stepOrder.length) {
|
|
32444
32479
|
setPhase("loading");
|
|
32445
32480
|
} else {
|
|
32446
32481
|
setCurrentStepIndex(nextIndex);
|
|
32447
32482
|
}
|
|
32448
|
-
}, [currentStepIndex]);
|
|
32483
|
+
}, [currentStepIndex, stepOrder.length]);
|
|
32449
32484
|
const previousStep = useCallback(() => {
|
|
32450
32485
|
if (currentStepIndex > 0) {
|
|
32451
32486
|
setCurrentStepIndex(currentStepIndex - 1);
|
|
32452
32487
|
}
|
|
32453
32488
|
}, [currentStepIndex]);
|
|
32454
32489
|
const goToStep = useCallback((stepId) => {
|
|
32455
|
-
const index =
|
|
32490
|
+
const index = stepOrder.indexOf(stepId);
|
|
32456
32491
|
if (index >= 0) {
|
|
32457
32492
|
if (phase === "contact") {
|
|
32458
32493
|
setPhase("questions");
|
|
32459
32494
|
}
|
|
32460
32495
|
setCurrentStepIndex(index);
|
|
32461
32496
|
}
|
|
32462
|
-
}, [phase]);
|
|
32497
|
+
}, [phase, stepOrder]);
|
|
32463
32498
|
const handleCitySelect = useCallback((city) => {
|
|
32464
32499
|
actions.answerQuestion("city", city);
|
|
32465
32500
|
trackAnswer("city", city);
|
|
@@ -32472,9 +32507,9 @@ const RedesignedFunnel = ({
|
|
|
32472
32507
|
actions.answerQuestion("service_type", mapping.service_type);
|
|
32473
32508
|
actions.answerQuestion("catering_categories", [mapping.catering_category]);
|
|
32474
32509
|
trackAnswer("event_type", eventType);
|
|
32475
|
-
updateContext({ service_type: mapping.service_type, total_steps:
|
|
32510
|
+
updateContext({ service_type: mapping.service_type, total_steps: stepOrder.length + 1 });
|
|
32476
32511
|
nextStep();
|
|
32477
|
-
}, [actions, trackAnswer, updateContext, nextStep]);
|
|
32512
|
+
}, [actions, trackAnswer, updateContext, nextStep, stepOrder.length]);
|
|
32478
32513
|
const handleDateChange = useCallback((date2) => {
|
|
32479
32514
|
if (date2) {
|
|
32480
32515
|
actions.answerQuestion("event_date", date2);
|
|
@@ -32499,6 +32534,8 @@ const RedesignedFunnel = ({
|
|
|
32499
32534
|
}, []);
|
|
32500
32535
|
const handleContactFormSubmit = useCallback(async (formData) => {
|
|
32501
32536
|
setIsSubmitting(true);
|
|
32537
|
+
const city = answerOf("city");
|
|
32538
|
+
const defaultCountry = city === "london" ? "United Kingdom" : "Germany";
|
|
32502
32539
|
try {
|
|
32503
32540
|
const buildValues = {
|
|
32504
32541
|
first_name: formData.vorname,
|
|
@@ -32510,11 +32547,17 @@ const RedesignedFunnel = ({
|
|
|
32510
32547
|
deliveryAddressStreetNumber: formData.deliveryAddressStreetNumber,
|
|
32511
32548
|
deliveryAddressPostalCode: formData.deliveryAddressPostalCode,
|
|
32512
32549
|
deliveryAddressCity: formData.deliveryAddressCity,
|
|
32513
|
-
deliveryAddressCountry: formData.deliveryAddressCountry ||
|
|
32550
|
+
deliveryAddressCountry: formData.deliveryAddressCountry || defaultCountry,
|
|
32514
32551
|
comment: formData.kommentar
|
|
32515
32552
|
};
|
|
32516
32553
|
const response = await submitAsNewCustomer(buildValues);
|
|
32517
|
-
const { signInToken, opportunity } = response || {};
|
|
32554
|
+
const { signInToken, opportunity, isUkLead } = response || {};
|
|
32555
|
+
if (isUkLead) {
|
|
32556
|
+
trackCompleted(funnelContextRef.current);
|
|
32557
|
+
setSubmittedData(formData);
|
|
32558
|
+
setPhase("done");
|
|
32559
|
+
return;
|
|
32560
|
+
}
|
|
32518
32561
|
if (!opportunity || !opportunity.id) {
|
|
32519
32562
|
console.error("[HeyCater Funnel] submitAsNewCustomer returned invalid opportunity:", response);
|
|
32520
32563
|
setIsSubmitting(false);
|
|
@@ -32529,11 +32572,11 @@ const RedesignedFunnel = ({
|
|
|
32529
32572
|
console.error("Failed to submit request:", error);
|
|
32530
32573
|
setIsSubmitting(false);
|
|
32531
32574
|
}
|
|
32532
|
-
}, [submitAsNewCustomer, funnelContextRef, router.locale]);
|
|
32575
|
+
}, [submitAsNewCustomer, funnelContextRef, router.locale, answerOf]);
|
|
32533
32576
|
const handleContactBack = useCallback(() => {
|
|
32534
32577
|
setPhase("questions");
|
|
32535
|
-
setCurrentStepIndex(
|
|
32536
|
-
}, []);
|
|
32578
|
+
setCurrentStepIndex(stepOrder.length - 1);
|
|
32579
|
+
}, [stepOrder.length]);
|
|
32537
32580
|
const canContinue = useCallback(() => {
|
|
32538
32581
|
switch (currentStepId) {
|
|
32539
32582
|
case "redesign_city":
|
|
@@ -32651,7 +32694,7 @@ const RedesignedFunnel = ({
|
|
|
32651
32694
|
const currentStep = REDESIGN_STEPS[currentStepId];
|
|
32652
32695
|
const stepTitle = isGerman ? currentStep.titleDe : currentStep.titleEn;
|
|
32653
32696
|
const stepSubtitle = isGerman ? currentStep.subtitleDe : currentStep.subtitleEn;
|
|
32654
|
-
const totalSteps =
|
|
32697
|
+
const totalSteps = stepOrder.length + 1;
|
|
32655
32698
|
const chips = buildSelectionChips();
|
|
32656
32699
|
const showBack = currentStepIndex > 0;
|
|
32657
32700
|
const showChips = currentStepIndex >= 1 && chips.length > 0;
|