@heycater/qualification-funnel 1.3.18 → 1.3.20
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 +72 -72
- package/dist/index.cjs.js +2 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +56 -39
- package/dist/index.esm.js.map +1 -1
- package/dist/stats.html +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -25648,11 +25648,9 @@ const StyledInput = styled(Input)`
|
|
|
25648
25648
|
`;
|
|
25649
25649
|
function Success() {
|
|
25650
25650
|
const { actions } = useQualification();
|
|
25651
|
-
const router = useRouter();
|
|
25652
25651
|
const { t: t2 } = useTranslation("qualification");
|
|
25653
25652
|
const handleClose = () => {
|
|
25654
25653
|
actions.initialize();
|
|
25655
|
-
router.push("/en/catering-london");
|
|
25656
25654
|
};
|
|
25657
25655
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
25658
25656
|
/* @__PURE__ */ jsx(Box, { display: "flex", justifyContent: "end", children: /* @__PURE__ */ jsx(Box, { px: 2, children: /* @__PURE__ */ jsx(IconButton$2, { onClick: handleClose, "aria-label": "back", component: "span", children: /* @__PURE__ */ jsx(CloseIcon$1, {}) }) }) }),
|
|
@@ -25799,6 +25797,7 @@ function useFunnelCheckout() {
|
|
|
25799
25797
|
function useQfLeadCreator() {
|
|
25800
25798
|
const client = useClient();
|
|
25801
25799
|
const createQfLead = async (variables) => {
|
|
25800
|
+
var _a2;
|
|
25802
25801
|
try {
|
|
25803
25802
|
const {
|
|
25804
25803
|
company,
|
|
@@ -25822,36 +25821,45 @@ function useQfLeadCreator() {
|
|
|
25822
25821
|
number_of_vegetarians,
|
|
25823
25822
|
price_per_person,
|
|
25824
25823
|
min_order_number,
|
|
25825
|
-
team_size
|
|
25824
|
+
team_size,
|
|
25825
|
+
service_type,
|
|
25826
|
+
delivery_frequency,
|
|
25827
|
+
budget_range,
|
|
25828
|
+
city
|
|
25826
25829
|
} = variables;
|
|
25827
25830
|
const hasDietaryBreakdown = number_of_vegans != null && number_of_vegetarians != null && number_of_carnivore != null;
|
|
25828
25831
|
const numberOfPeople = hasDietaryBreakdown ? number_of_vegans + number_of_vegetarians + number_of_carnivore : min_order_number || team_size || void 0;
|
|
25829
25832
|
const totalBudget = numberOfPeople && price_per_person ? numberOfPeople * price_per_person : void 0;
|
|
25830
|
-
const
|
|
25831
|
-
|
|
25832
|
-
|
|
25833
|
-
{
|
|
25834
|
-
|
|
25835
|
-
|
|
25836
|
-
|
|
25837
|
-
|
|
25838
|
-
|
|
25839
|
-
|
|
25840
|
-
|
|
25841
|
-
|
|
25842
|
-
|
|
25843
|
-
|
|
25844
|
-
|
|
25845
|
-
|
|
25846
|
-
|
|
25847
|
-
|
|
25848
|
-
|
|
25849
|
-
|
|
25850
|
-
|
|
25851
|
-
|
|
25852
|
-
|
|
25853
|
-
|
|
25854
|
-
|
|
25833
|
+
const funnelDetails = [
|
|
25834
|
+
service_type && `Service Type: ${service_type}`,
|
|
25835
|
+
city && `City: ${city}`,
|
|
25836
|
+
team_size && `Team Size: ${team_size}`,
|
|
25837
|
+
delivery_frequency && `Delivery Frequency: ${delivery_frequency}`,
|
|
25838
|
+
budget_range && `Budget Range: ${budget_range}`
|
|
25839
|
+
].filter(Boolean).join("\n");
|
|
25840
|
+
const fullComment = [comment, funnelDetails].filter(Boolean).join("\n\n---\n");
|
|
25841
|
+
const payload = {
|
|
25842
|
+
email,
|
|
25843
|
+
firstName: first_name,
|
|
25844
|
+
lastName: last_name,
|
|
25845
|
+
phone,
|
|
25846
|
+
company,
|
|
25847
|
+
comment: fullComment,
|
|
25848
|
+
address: `${deliveryAddressStreet} ${deliveryAddressStreetNumber}, ${deliveryAddressPostalCode} ${deliveryAddressCity}, ${deliveryAddressCountry}`,
|
|
25849
|
+
cateringCategories: catering_categories,
|
|
25850
|
+
eventDate: event_date ? new Date(event_date).toDateString() : void 0,
|
|
25851
|
+
hasRecurringNeed: has_recurring_need,
|
|
25852
|
+
isMultiDay: is_multi_day,
|
|
25853
|
+
numberOfOmnivores: number_of_carnivore,
|
|
25854
|
+
numberOfVegans: number_of_vegans,
|
|
25855
|
+
numberOfVegetarians: number_of_vegetarians,
|
|
25856
|
+
numberOfPeople,
|
|
25857
|
+
totalBudget,
|
|
25858
|
+
leadType: lead_type
|
|
25859
|
+
};
|
|
25860
|
+
const result = await createQfLeadMutation(payload, { client });
|
|
25861
|
+
const response = (_a2 = result == null ? void 0 : result.data) == null ? void 0 : _a2.createQfLead;
|
|
25862
|
+
return response || { success: false };
|
|
25855
25863
|
} catch (error) {
|
|
25856
25864
|
if (error) {
|
|
25857
25865
|
BugsnagExport.notify(error, (event) => {
|
|
@@ -25923,12 +25931,12 @@ function useRequestForm() {
|
|
|
25923
25931
|
deliveryAddressCountry
|
|
25924
25932
|
);
|
|
25925
25933
|
if (isLeadOnlyFunnel || isUkLead) {
|
|
25926
|
-
const
|
|
25934
|
+
const response = await createQfLead({
|
|
25927
25935
|
...values2,
|
|
25928
25936
|
...qualification == null ? void 0 : qualification.answers
|
|
25929
25937
|
});
|
|
25930
25938
|
return {
|
|
25931
|
-
success,
|
|
25939
|
+
success: response == null ? void 0 : response.success,
|
|
25932
25940
|
isLeadOnly: true
|
|
25933
25941
|
};
|
|
25934
25942
|
} else {
|
|
@@ -26021,8 +26029,21 @@ function RequestForm({ header = null }) {
|
|
|
26021
26029
|
handleDeliveryAddressChange();
|
|
26022
26030
|
}, [deliveryAddress]);
|
|
26023
26031
|
const handleSubmit = async (values2) => {
|
|
26024
|
-
var _a3, _b2;
|
|
26032
|
+
var _a3, _b2, _c2, _d;
|
|
26025
26033
|
handleDisableCTA(true);
|
|
26034
|
+
const serviceType = (_a3 = qualification == null ? void 0 : qualification.answers) == null ? void 0 : _a3.service_type;
|
|
26035
|
+
const isLeadOnlyFunnel = serviceType === "regular_employee_catering" || serviceType === "full_service_event";
|
|
26036
|
+
if (isLeadOnlyFunnel) {
|
|
26037
|
+
const result = await submitAsNewCustomer(values2);
|
|
26038
|
+
if (result == null ? void 0 : result.success) {
|
|
26039
|
+
setShowLeadSuccess(true);
|
|
26040
|
+
window.gtag && window.gtag("event", "submit_qf_request");
|
|
26041
|
+
(_b2 = window.dataLayer) == null ? void 0 : _b2.push({ event: "funnel_form_submit" });
|
|
26042
|
+
} else {
|
|
26043
|
+
handleDisableCTA(false);
|
|
26044
|
+
}
|
|
26045
|
+
return;
|
|
26046
|
+
}
|
|
26026
26047
|
let redirectRoute = "";
|
|
26027
26048
|
if (currentUserAccount) {
|
|
26028
26049
|
try {
|
|
@@ -26034,17 +26055,13 @@ function RequestForm({ header = null }) {
|
|
|
26034
26055
|
}
|
|
26035
26056
|
}
|
|
26036
26057
|
} else {
|
|
26037
|
-
const
|
|
26038
|
-
|
|
26039
|
-
opportunity,
|
|
26040
|
-
isLeadOnly,
|
|
26041
|
-
success
|
|
26042
|
-
} = await submitAsNewCustomer(values2);
|
|
26058
|
+
const result = await submitAsNewCustomer(values2);
|
|
26059
|
+
const { signInToken, opportunity, isLeadOnly, success } = result;
|
|
26043
26060
|
if (isLeadOnly) {
|
|
26044
26061
|
if (success) {
|
|
26045
26062
|
setShowLeadSuccess(true);
|
|
26046
26063
|
window.gtag && window.gtag("event", "submit_qf_request");
|
|
26047
|
-
(
|
|
26064
|
+
(_c2 = window.dataLayer) == null ? void 0 : _c2.push({ event: "funnel_form_submit" });
|
|
26048
26065
|
} else {
|
|
26049
26066
|
handleDisableCTA(false);
|
|
26050
26067
|
}
|
|
@@ -26058,7 +26075,7 @@ function RequestForm({ header = null }) {
|
|
|
26058
26075
|
}
|
|
26059
26076
|
if (qualification == null ? void 0 : qualification.selectedMenu) ;
|
|
26060
26077
|
window.gtag && window.gtag("event", "submit_qf_request");
|
|
26061
|
-
(
|
|
26078
|
+
(_d = window.dataLayer) == null ? void 0 : _d.push({ event: "funnel_form_submit" });
|
|
26062
26079
|
actions.setRequest(values2);
|
|
26063
26080
|
redirectToCustomerAccountRequest(redirectRoute);
|
|
26064
26081
|
};
|