@heycater/qualification-funnel 1.19.16 → 1.19.18
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 +33 -33
- package/dist/index.cjs.js +60 -60
- package/dist/index.esm.js +48 -7
- package/package.json +1 -1
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
|
-
|
|
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,
|
|
@@ -26453,15 +26469,18 @@ function FormikFormField({
|
|
|
26453
26469
|
const capitalizeFirstLetter = (str) => str ? str.charAt(0).toUpperCase() + str.slice(1) : "";
|
|
26454
26470
|
function PhoneField({ label, name, formik, helperText }) {
|
|
26455
26471
|
const { t: t2 } = useTranslation();
|
|
26472
|
+
const isGb = useIsGb();
|
|
26456
26473
|
const rawError = formik.errors.phone;
|
|
26457
26474
|
const error = rawError ? t2(rawError) : rawError;
|
|
26458
26475
|
const fieldValue = formik.values.phone;
|
|
26459
26476
|
const touched = formik.touched.phone;
|
|
26477
|
+
const countryPrefix = isGb ? "+44" : "+49";
|
|
26478
|
+
const placeholder = isGb ? "+44 20 7946 0958" : "+49 30 56837200";
|
|
26460
26479
|
const handleChange = (e2) => {
|
|
26461
26480
|
let value = e2.target.value;
|
|
26462
26481
|
value = value.replace(/[^\d+\s-]/g, "");
|
|
26463
26482
|
if (!value.startsWith("+")) {
|
|
26464
|
-
value =
|
|
26483
|
+
value = countryPrefix + value.replace(/^\+/, "");
|
|
26465
26484
|
}
|
|
26466
26485
|
formik.setFieldValue("phone", value, true);
|
|
26467
26486
|
};
|
|
@@ -26475,7 +26494,7 @@ function PhoneField({ label, name, formik, helperText }) {
|
|
|
26475
26494
|
value: fieldValue,
|
|
26476
26495
|
onChange: handleChange,
|
|
26477
26496
|
onBlur: () => formik.setFieldTouched("phone", true),
|
|
26478
|
-
placeholder
|
|
26497
|
+
placeholder,
|
|
26479
26498
|
$hasError: Boolean(touched && error)
|
|
26480
26499
|
}
|
|
26481
26500
|
),
|
|
@@ -26885,7 +26904,19 @@ function RequestForm({ header = null }) {
|
|
|
26885
26904
|
var _a3;
|
|
26886
26905
|
handleDisableCTA(true);
|
|
26887
26906
|
const serviceType = (_a3 = qualification == null ? void 0 : qualification.answers) == null ? void 0 : _a3.service_type;
|
|
26888
|
-
|
|
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);
|
|
26889
26920
|
const isLeadOnlyFunnel = serviceType === "regular_employee_catering" || serviceType === "full_service_event";
|
|
26890
26921
|
const { deliveryAddressCountry: deliveryAddressCountry2 } = values2;
|
|
26891
26922
|
const isUkLead = ["United Kingdom", "Great Britain", "UK"].includes(
|
|
@@ -26899,7 +26930,8 @@ function RequestForm({ header = null }) {
|
|
|
26899
26930
|
setShowLeadSuccess(true);
|
|
26900
26931
|
trackFormSubmitted(funnelContextRef.current, { is_uk_lead: isUkLead });
|
|
26901
26932
|
trackCompleted(funnelContextRef.current);
|
|
26902
|
-
|
|
26933
|
+
console.log("[Optimeleon Debug] Lead-only flow - tracking funnel_completed with:", effectiveServiceType);
|
|
26934
|
+
trackOptimeleonConversion("funnel_completed", effectiveServiceType);
|
|
26903
26935
|
return;
|
|
26904
26936
|
} else {
|
|
26905
26937
|
console.error("[HeyCater Funnel] Lead submission failed. Result:", response);
|
|
@@ -26942,7 +26974,8 @@ function RequestForm({ header = null }) {
|
|
|
26942
26974
|
is_logged_in: !!currentUserAccount
|
|
26943
26975
|
});
|
|
26944
26976
|
trackCompleted(funnelContextRef.current);
|
|
26945
|
-
|
|
26977
|
+
console.log("[Optimeleon Debug] Regular flow - tracking funnel_completed with:", effectiveServiceType);
|
|
26978
|
+
trackOptimeleonConversion("funnel_completed", effectiveServiceType);
|
|
26946
26979
|
actions.setRequest(values2);
|
|
26947
26980
|
redirectToCustomerAccountRequest(redirectRoute);
|
|
26948
26981
|
};
|
|
@@ -30130,10 +30163,18 @@ const EmbeddedFunnel = React__default.forwardRef(
|
|
|
30130
30163
|
}
|
|
30131
30164
|
const shouldRestoreCity = (restoredContext == null ? void 0 : restoredContext.service_type) === serviceType;
|
|
30132
30165
|
const cityToUse = city || (shouldRestoreCity ? restoredContext == null ? void 0 : restoredContext.city : void 0);
|
|
30166
|
+
const finalServiceType = (restoredContext == null ? void 0 : restoredContext.service_type) || serviceType;
|
|
30167
|
+
console.log("[Optimeleon Debug] EmbeddedFunnel initializing context", {
|
|
30168
|
+
sessionId,
|
|
30169
|
+
serviceTypeFromState: serviceType,
|
|
30170
|
+
serviceTypeFromRestored: restoredContext == null ? void 0 : restoredContext.service_type,
|
|
30171
|
+
finalServiceType,
|
|
30172
|
+
allAnswers: state.qualification.answers
|
|
30173
|
+
});
|
|
30133
30174
|
updateContext({
|
|
30134
30175
|
session_id: sessionId,
|
|
30135
30176
|
total_steps: totalSteps,
|
|
30136
|
-
service_type:
|
|
30177
|
+
service_type: finalServiceType,
|
|
30137
30178
|
...cityToUse ? { city: cityToUse } : {}
|
|
30138
30179
|
});
|
|
30139
30180
|
}, [
|