@heycater/qualification-funnel 1.6.0 → 1.7.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
@@ -10085,7 +10085,7 @@ function trackAnswerSelected(context, answer) {
10085
10085
  if (context.city) {
10086
10086
  properties.city = context.city;
10087
10087
  }
10088
- captureEvent("qf_v4_answer_selected", properties);
10088
+ captureEvent("qf_v5_answer_selected", properties);
10089
10089
  }
10090
10090
  function trackFormSubmitted(context, metadata) {
10091
10091
  if (!context.session_id) {
@@ -10103,7 +10103,7 @@ function trackFormSubmitted(context, metadata) {
10103
10103
  if (context.city) {
10104
10104
  properties.city = context.city;
10105
10105
  }
10106
- captureEvent("qf_v4_form_submitted", properties);
10106
+ captureEvent("qf_v5_form_submitted", properties);
10107
10107
  }
10108
10108
  function trackCompleted(context) {
10109
10109
  if (!context.session_id) {
@@ -10120,7 +10120,7 @@ function trackCompleted(context) {
10120
10120
  if (context.city) {
10121
10121
  properties.city = context.city;
10122
10122
  }
10123
- captureEvent("qf_v4_completed", properties);
10123
+ captureEvent("qf_v5_completed", properties);
10124
10124
  }
10125
10125
  function trackAbandoned(context, lastStep) {
10126
10126
  if (!context.session_id) {
@@ -10139,7 +10139,7 @@ function trackAbandoned(context, lastStep) {
10139
10139
  if (context.city) {
10140
10140
  properties.city = context.city;
10141
10141
  }
10142
- captureEvent("qf_v4_abandoned", properties);
10142
+ captureEvent("qf_v5_abandoned", properties);
10143
10143
  }
10144
10144
  function trackStarted(context, initialStepId) {
10145
10145
  const properties = {
@@ -10147,7 +10147,7 @@ function trackStarted(context, initialStepId) {
10147
10147
  session_id: context.session_id,
10148
10148
  initial_step: initialStepId
10149
10149
  };
10150
- captureEvent("qf_v4_started", properties);
10150
+ captureEvent("qf_v5_started", properties);
10151
10151
  }
10152
10152
  const TrackingContext = createContext(null);
10153
10153
  function TrackingProvider({
@@ -10168,7 +10168,7 @@ function TrackingProvider({
10168
10168
  const questions2 = (schemaStep == null ? void 0 : schemaStep.questions) || [];
10169
10169
  const questionIndex = questions2.findIndex((q2) => q2.id === questionId);
10170
10170
  const isLastQuestion = questionIndex === questions2.length - 1;
10171
- const sessionKey = `qf_v4_started_${funnelContextRef.current.session_id}`;
10171
+ const sessionKey = `qf_v5_started_${funnelContextRef.current.session_id}`;
10172
10172
  if (typeof sessionStorage !== "undefined") {
10173
10173
  const hasStarted = sessionStorage.getItem(sessionKey);
10174
10174
  if (!hasStarted) {
@@ -10737,7 +10737,7 @@ function DatePickerEmbedded() {
10737
10737
  month,
10738
10738
  onDayClick: (date22) => {
10739
10739
  actions.answerQuestion("event_date", date22);
10740
- trackAnswer("event_date", date22);
10740
+ trackAnswer("event_date", format(date22, "yyyy-MM-dd"));
10741
10741
  },
10742
10742
  selected: activeDate,
10743
10743
  fromDate: minimumDate,
@@ -26672,7 +26672,7 @@ function RequestForm({ header = null }) {
26672
26672
  cacheValidations
26673
26673
  });
26674
26674
  const isFloating = mobile && isNotInView;
26675
- const qualification = "qualification" in state ? state.qualification : null;
26675
+ "qualification" in state ? state.qualification : null;
26676
26676
  const { actions } = useQualification();
26677
26677
  const { currentUserAccount } = useCurrentUser();
26678
26678
  const router = useRouter();
@@ -26707,20 +26707,18 @@ function RequestForm({ header = null }) {
26707
26707
  }, [deliveryAddress]);
26708
26708
  const { funnelContextRef } = useTracking();
26709
26709
  const handleSubmit = async (values2) => {
26710
- var _a3;
26711
26710
  handleDisableCTA(true);
26712
- const serviceType = (_a3 = qualification == null ? void 0 : qualification.answers) == null ? void 0 : _a3.service_type;
26713
- const isLeadOnlyFunnel = serviceType === "regular_employee_catering" || serviceType === "full_service_event";
26714
26711
  const { deliveryAddressCountry: deliveryAddressCountry2 } = values2;
26715
26712
  const isUkLead = ["United Kingdom", "Great Britain", "UK"].includes(
26716
26713
  deliveryAddressCountry2
26717
26714
  );
26718
- if (isLeadOnlyFunnel || isUkLead) {
26715
+ if (isUkLead) {
26719
26716
  const response = await submitAsNewCustomer(values2);
26720
26717
  const { success } = response;
26721
26718
  if (success) {
26722
26719
  setIsActualUkLead(isUkLead);
26723
26720
  setShowLeadSuccess(true);
26721
+ trackFormSubmitted(funnelContextRef.current, { is_uk_lead: true });
26724
26722
  trackCompleted(funnelContextRef.current);
26725
26723
  return;
26726
26724
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heycater/qualification-funnel",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "type": "module",
5
5
  "description": "Heycater embedded qualification funnel widget",
6
6
  "main": "dist/index.cjs.js",