@heycater/qualification-funnel 1.4.11 → 1.4.13
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 +3 -3
- package/dist/index.cjs.js +73 -73
- package/dist/index.esm.js +131 -130
- package/package.json +12 -3
package/dist/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _a;
|
|
2
2
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
|
-
import React__default, { createContext, useContext, useMemo, useReducer, useCallback, useEffect, useRef, useState, isValidElement, cloneElement, Children, forwardRef } from "react";
|
|
4
|
+
import React__default, { createContext, useContext, useMemo, useReducer, useCallback, useEffect, useRef, useState, isValidElement, cloneElement, Children, forwardRef, useLayoutEffect } from "react";
|
|
5
5
|
import { darken as darken$1, lighten as lighten$1, ButtonBase as ButtonBase$2, Typography as Typography$1, useMediaQuery, Input as Input$1, IconButton as IconButton$2, useTheme as useTheme$1, FormControlLabel, Tooltip, Menu, Hidden, SnackbarContent, Snackbar, TextField, CircularProgress, Modal, ThemeProvider as ThemeProvider$1, StylesProvider as StylesProvider$1, CssBaseline } from "@material-ui/core";
|
|
6
6
|
import { useTranslation, initReactI18next, I18nextProvider } from "react-i18next";
|
|
7
7
|
import styled, { css as css$1, createGlobalStyle, ThemeProvider } from "styled-components";
|
|
@@ -11050,6 +11050,9 @@ function trackAnswerSelected(context, answer) {
|
|
|
11050
11050
|
captureEvent("qf_v2_answer_selected", properties);
|
|
11051
11051
|
}
|
|
11052
11052
|
function trackFormSubmitted(context, metadata) {
|
|
11053
|
+
if (!context.session_id) {
|
|
11054
|
+
console.warn("[Tracking] trackFormSubmitted called with empty session_id", context);
|
|
11055
|
+
}
|
|
11053
11056
|
const properties = {
|
|
11054
11057
|
funnel_mode: context.funnel_mode,
|
|
11055
11058
|
session_id: context.session_id,
|
|
@@ -11065,6 +11068,9 @@ function trackFormSubmitted(context, metadata) {
|
|
|
11065
11068
|
captureEvent("qf_v2_form_submitted", properties);
|
|
11066
11069
|
}
|
|
11067
11070
|
function trackCompleted(context) {
|
|
11071
|
+
if (!context.session_id) {
|
|
11072
|
+
console.warn("[Tracking] trackCompleted called with empty session_id", context);
|
|
11073
|
+
}
|
|
11068
11074
|
const properties = {
|
|
11069
11075
|
funnel_mode: context.funnel_mode,
|
|
11070
11076
|
session_id: context.session_id,
|
|
@@ -11079,6 +11085,9 @@ function trackCompleted(context) {
|
|
|
11079
11085
|
captureEvent("qf_v2_completed", properties);
|
|
11080
11086
|
}
|
|
11081
11087
|
function trackAbandoned(context, lastStep) {
|
|
11088
|
+
if (!context.session_id) {
|
|
11089
|
+
console.warn("[Tracking] trackAbandoned called with empty session_id", context);
|
|
11090
|
+
}
|
|
11082
11091
|
const properties = {
|
|
11083
11092
|
funnel_mode: context.funnel_mode,
|
|
11084
11093
|
session_id: context.session_id,
|
|
@@ -11133,6 +11142,7 @@ function TrackingProvider({
|
|
|
11133
11142
|
const serviceType = value;
|
|
11134
11143
|
if (serviceType) {
|
|
11135
11144
|
const stepOrder = getStepOrderForServiceType(serviceType);
|
|
11145
|
+
delete funnelContextRef.current.city;
|
|
11136
11146
|
updateContext({
|
|
11137
11147
|
service_type: serviceType,
|
|
11138
11148
|
total_steps: stepOrder.length
|
|
@@ -11151,18 +11161,21 @@ function TrackingProvider({
|
|
|
11151
11161
|
},
|
|
11152
11162
|
[funnelContextRef, currentStepId, state, updateContext]
|
|
11153
11163
|
);
|
|
11154
|
-
return /* @__PURE__ */ jsx(TrackingContext.Provider, { value: {
|
|
11164
|
+
return /* @__PURE__ */ jsx(TrackingContext.Provider, { value: { funnelContextRef, currentStepId, trackAnswer }, children });
|
|
11155
11165
|
}
|
|
11156
11166
|
function useTracking() {
|
|
11157
11167
|
const context = useContext(TrackingContext);
|
|
11158
11168
|
if (!context) {
|
|
11159
|
-
|
|
11160
|
-
|
|
11169
|
+
const defaultRef = {
|
|
11170
|
+
current: {
|
|
11161
11171
|
session_id: "",
|
|
11162
11172
|
funnel_mode: "embedded",
|
|
11163
11173
|
service_type: "",
|
|
11164
11174
|
total_steps: 0
|
|
11165
|
-
}
|
|
11175
|
+
}
|
|
11176
|
+
};
|
|
11177
|
+
return {
|
|
11178
|
+
funnelContextRef: defaultRef,
|
|
11166
11179
|
currentStepId: "",
|
|
11167
11180
|
trackAnswer: () => {
|
|
11168
11181
|
}
|
|
@@ -12258,7 +12271,7 @@ var objectInspect = function inspect_(obj, options, depth, seen) {
|
|
|
12258
12271
|
var ys = arrObjKeys(obj, inspect2);
|
|
12259
12272
|
var isPlainObject2 = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
|
|
12260
12273
|
var protoTag = obj instanceof Object ? "" : "null prototype";
|
|
12261
|
-
var stringTag2 = !isPlainObject2 && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? "Object" : "";
|
|
12274
|
+
var stringTag2 = !isPlainObject2 && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr$1(obj), 8, -1) : protoTag ? "Object" : "";
|
|
12262
12275
|
var constructorTag = isPlainObject2 || typeof obj.constructor !== "function" ? "" : obj.constructor.name ? obj.constructor.name + " " : "";
|
|
12263
12276
|
var tag = constructorTag + (stringTag2 || protoTag ? "[" + $join.call($concat$1.call([], stringTag2 || [], protoTag || []), ": ") + "] " : "");
|
|
12264
12277
|
if (ys.length === 0) {
|
|
@@ -12283,25 +12296,25 @@ function canTrustToString(obj) {
|
|
|
12283
12296
|
return !toStringTag || !(typeof obj === "object" && (toStringTag in obj || typeof obj[toStringTag] !== "undefined"));
|
|
12284
12297
|
}
|
|
12285
12298
|
function isArray$3(obj) {
|
|
12286
|
-
return toStr(obj) === "[object Array]" && canTrustToString(obj);
|
|
12299
|
+
return toStr$1(obj) === "[object Array]" && canTrustToString(obj);
|
|
12287
12300
|
}
|
|
12288
12301
|
function isDate(obj) {
|
|
12289
|
-
return toStr(obj) === "[object Date]" && canTrustToString(obj);
|
|
12302
|
+
return toStr$1(obj) === "[object Date]" && canTrustToString(obj);
|
|
12290
12303
|
}
|
|
12291
12304
|
function isRegExp$1(obj) {
|
|
12292
|
-
return toStr(obj) === "[object RegExp]" && canTrustToString(obj);
|
|
12305
|
+
return toStr$1(obj) === "[object RegExp]" && canTrustToString(obj);
|
|
12293
12306
|
}
|
|
12294
12307
|
function isError(obj) {
|
|
12295
|
-
return toStr(obj) === "[object Error]" && canTrustToString(obj);
|
|
12308
|
+
return toStr$1(obj) === "[object Error]" && canTrustToString(obj);
|
|
12296
12309
|
}
|
|
12297
12310
|
function isString(obj) {
|
|
12298
|
-
return toStr(obj) === "[object String]" && canTrustToString(obj);
|
|
12311
|
+
return toStr$1(obj) === "[object String]" && canTrustToString(obj);
|
|
12299
12312
|
}
|
|
12300
12313
|
function isNumber(obj) {
|
|
12301
|
-
return toStr(obj) === "[object Number]" && canTrustToString(obj);
|
|
12314
|
+
return toStr$1(obj) === "[object Number]" && canTrustToString(obj);
|
|
12302
12315
|
}
|
|
12303
12316
|
function isBoolean(obj) {
|
|
12304
|
-
return toStr(obj) === "[object Boolean]" && canTrustToString(obj);
|
|
12317
|
+
return toStr$1(obj) === "[object Boolean]" && canTrustToString(obj);
|
|
12305
12318
|
}
|
|
12306
12319
|
function isSymbol(obj) {
|
|
12307
12320
|
if (hasShammedSymbols) {
|
|
@@ -12337,7 +12350,7 @@ var hasOwn$1 = Object.prototype.hasOwnProperty || function(key) {
|
|
|
12337
12350
|
function has$4(obj, key) {
|
|
12338
12351
|
return hasOwn$1.call(obj, key);
|
|
12339
12352
|
}
|
|
12340
|
-
function toStr(obj) {
|
|
12353
|
+
function toStr$1(obj) {
|
|
12341
12354
|
return objectToString.call(obj);
|
|
12342
12355
|
}
|
|
12343
12356
|
function nameOf(f) {
|
|
@@ -12646,7 +12659,7 @@ var syntax = SyntaxError;
|
|
|
12646
12659
|
var uri = URIError;
|
|
12647
12660
|
var abs$1 = Math.abs;
|
|
12648
12661
|
var floor$1 = Math.floor;
|
|
12649
|
-
var max$
|
|
12662
|
+
var max$2 = Math.max;
|
|
12650
12663
|
var min$1 = Math.min;
|
|
12651
12664
|
var pow$1 = Math.pow;
|
|
12652
12665
|
var round$2 = Math.round;
|
|
@@ -12775,99 +12788,78 @@ function requireObject_getPrototypeOf() {
|
|
|
12775
12788
|
Object_getPrototypeOf = $Object2.getPrototypeOf || null;
|
|
12776
12789
|
return Object_getPrototypeOf;
|
|
12777
12790
|
}
|
|
12778
|
-
var
|
|
12779
|
-
var
|
|
12780
|
-
|
|
12781
|
-
|
|
12782
|
-
|
|
12783
|
-
var
|
|
12784
|
-
var
|
|
12785
|
-
|
|
12786
|
-
|
|
12787
|
-
var
|
|
12788
|
-
|
|
12789
|
-
|
|
12790
|
-
|
|
12791
|
-
|
|
12792
|
-
|
|
12793
|
-
|
|
12794
|
-
|
|
12795
|
-
|
|
12796
|
-
}
|
|
12797
|
-
|
|
12798
|
-
|
|
12799
|
-
|
|
12800
|
-
|
|
12791
|
+
var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
|
|
12792
|
+
var toStr = Object.prototype.toString;
|
|
12793
|
+
var max$1 = Math.max;
|
|
12794
|
+
var funcType = "[object Function]";
|
|
12795
|
+
var concatty = function concatty2(a3, b2) {
|
|
12796
|
+
var arr = [];
|
|
12797
|
+
for (var i2 = 0; i2 < a3.length; i2 += 1) {
|
|
12798
|
+
arr[i2] = a3[i2];
|
|
12799
|
+
}
|
|
12800
|
+
for (var j = 0; j < b2.length; j += 1) {
|
|
12801
|
+
arr[j + a3.length] = b2[j];
|
|
12802
|
+
}
|
|
12803
|
+
return arr;
|
|
12804
|
+
};
|
|
12805
|
+
var slicy = function slicy2(arrLike, offset2) {
|
|
12806
|
+
var arr = [];
|
|
12807
|
+
for (var i2 = offset2, j = 0; i2 < arrLike.length; i2 += 1, j += 1) {
|
|
12808
|
+
arr[j] = arrLike[i2];
|
|
12809
|
+
}
|
|
12810
|
+
return arr;
|
|
12811
|
+
};
|
|
12812
|
+
var joiny = function(arr, joiner) {
|
|
12813
|
+
var str = "";
|
|
12814
|
+
for (var i2 = 0; i2 < arr.length; i2 += 1) {
|
|
12815
|
+
str += arr[i2];
|
|
12816
|
+
if (i2 + 1 < arr.length) {
|
|
12817
|
+
str += joiner;
|
|
12801
12818
|
}
|
|
12802
|
-
|
|
12803
|
-
|
|
12804
|
-
|
|
12805
|
-
|
|
12806
|
-
|
|
12807
|
-
|
|
12808
|
-
|
|
12809
|
-
|
|
12819
|
+
}
|
|
12820
|
+
return str;
|
|
12821
|
+
};
|
|
12822
|
+
var implementation$1 = function bind(that) {
|
|
12823
|
+
var target = this;
|
|
12824
|
+
if (typeof target !== "function" || toStr.apply(target) !== funcType) {
|
|
12825
|
+
throw new TypeError(ERROR_MESSAGE + target);
|
|
12826
|
+
}
|
|
12827
|
+
var args = slicy(arguments, 1);
|
|
12828
|
+
var bound;
|
|
12829
|
+
var binder = function() {
|
|
12830
|
+
if (this instanceof bound) {
|
|
12831
|
+
var result = target.apply(
|
|
12832
|
+
this,
|
|
12833
|
+
concatty(args, arguments)
|
|
12834
|
+
);
|
|
12835
|
+
if (Object(result) === result) {
|
|
12836
|
+
return result;
|
|
12810
12837
|
}
|
|
12838
|
+
return this;
|
|
12811
12839
|
}
|
|
12812
|
-
return
|
|
12840
|
+
return target.apply(
|
|
12841
|
+
that,
|
|
12842
|
+
concatty(args, arguments)
|
|
12843
|
+
);
|
|
12813
12844
|
};
|
|
12814
|
-
|
|
12815
|
-
|
|
12816
|
-
|
|
12817
|
-
|
|
12818
|
-
|
|
12819
|
-
|
|
12820
|
-
|
|
12821
|
-
var
|
|
12822
|
-
if (this instanceof bound) {
|
|
12823
|
-
var result = target.apply(
|
|
12824
|
-
this,
|
|
12825
|
-
concatty(args, arguments)
|
|
12826
|
-
);
|
|
12827
|
-
if (Object(result) === result) {
|
|
12828
|
-
return result;
|
|
12829
|
-
}
|
|
12830
|
-
return this;
|
|
12831
|
-
}
|
|
12832
|
-
return target.apply(
|
|
12833
|
-
that,
|
|
12834
|
-
concatty(args, arguments)
|
|
12835
|
-
);
|
|
12845
|
+
var boundLength = max$1(0, target.length - args.length);
|
|
12846
|
+
var boundArgs = [];
|
|
12847
|
+
for (var i2 = 0; i2 < boundLength; i2++) {
|
|
12848
|
+
boundArgs[i2] = "$" + i2;
|
|
12849
|
+
}
|
|
12850
|
+
bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
|
|
12851
|
+
if (target.prototype) {
|
|
12852
|
+
var Empty = function Empty2() {
|
|
12836
12853
|
};
|
|
12837
|
-
|
|
12838
|
-
|
|
12839
|
-
|
|
12840
|
-
|
|
12841
|
-
|
|
12842
|
-
|
|
12843
|
-
|
|
12844
|
-
|
|
12845
|
-
|
|
12846
|
-
Empty.prototype = target.prototype;
|
|
12847
|
-
bound.prototype = new Empty();
|
|
12848
|
-
Empty.prototype = null;
|
|
12849
|
-
}
|
|
12850
|
-
return bound;
|
|
12851
|
-
};
|
|
12852
|
-
return implementation;
|
|
12853
|
-
}
|
|
12854
|
-
var functionBind;
|
|
12855
|
-
var hasRequiredFunctionBind;
|
|
12856
|
-
function requireFunctionBind() {
|
|
12857
|
-
if (hasRequiredFunctionBind) return functionBind;
|
|
12858
|
-
hasRequiredFunctionBind = 1;
|
|
12859
|
-
var implementation2 = requireImplementation();
|
|
12860
|
-
functionBind = Function.prototype.bind || implementation2;
|
|
12861
|
-
return functionBind;
|
|
12862
|
-
}
|
|
12863
|
-
var functionCall;
|
|
12864
|
-
var hasRequiredFunctionCall;
|
|
12865
|
-
function requireFunctionCall() {
|
|
12866
|
-
if (hasRequiredFunctionCall) return functionCall;
|
|
12867
|
-
hasRequiredFunctionCall = 1;
|
|
12868
|
-
functionCall = Function.prototype.call;
|
|
12869
|
-
return functionCall;
|
|
12870
|
-
}
|
|
12854
|
+
Empty.prototype = target.prototype;
|
|
12855
|
+
bound.prototype = new Empty();
|
|
12856
|
+
Empty.prototype = null;
|
|
12857
|
+
}
|
|
12858
|
+
return bound;
|
|
12859
|
+
};
|
|
12860
|
+
var implementation = implementation$1;
|
|
12861
|
+
var functionBind = Function.prototype.bind || implementation;
|
|
12862
|
+
var functionCall = Function.prototype.call;
|
|
12871
12863
|
var functionApply;
|
|
12872
12864
|
var hasRequiredFunctionApply;
|
|
12873
12865
|
function requireFunctionApply() {
|
|
@@ -12877,14 +12869,14 @@ function requireFunctionApply() {
|
|
|
12877
12869
|
return functionApply;
|
|
12878
12870
|
}
|
|
12879
12871
|
var reflectApply = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
|
|
12880
|
-
var bind$2 =
|
|
12872
|
+
var bind$2 = functionBind;
|
|
12881
12873
|
var $apply$1 = requireFunctionApply();
|
|
12882
|
-
var $call$2 =
|
|
12874
|
+
var $call$2 = functionCall;
|
|
12883
12875
|
var $reflectApply = reflectApply;
|
|
12884
12876
|
var actualApply = $reflectApply || bind$2.call($call$2, $apply$1);
|
|
12885
|
-
var bind$1 =
|
|
12877
|
+
var bind$1 = functionBind;
|
|
12886
12878
|
var $TypeError$4 = type;
|
|
12887
|
-
var $call$1 =
|
|
12879
|
+
var $call$1 = functionCall;
|
|
12888
12880
|
var $actualApply = actualApply;
|
|
12889
12881
|
var callBindApplyHelpers = function callBindBasic(args) {
|
|
12890
12882
|
if (args.length < 1 || typeof args[0] !== "function") {
|
|
@@ -12950,8 +12942,8 @@ function requireHasown() {
|
|
|
12950
12942
|
hasRequiredHasown = 1;
|
|
12951
12943
|
var call = Function.prototype.call;
|
|
12952
12944
|
var $hasOwn = Object.prototype.hasOwnProperty;
|
|
12953
|
-
var
|
|
12954
|
-
hasown =
|
|
12945
|
+
var bind3 = functionBind;
|
|
12946
|
+
hasown = bind3.call(call, $hasOwn);
|
|
12955
12947
|
return hasown;
|
|
12956
12948
|
}
|
|
12957
12949
|
var undefined$1;
|
|
@@ -12965,7 +12957,7 @@ var $TypeError$3 = type;
|
|
|
12965
12957
|
var $URIError = uri;
|
|
12966
12958
|
var abs = abs$1;
|
|
12967
12959
|
var floor = floor$1;
|
|
12968
|
-
var max = max$
|
|
12960
|
+
var max = max$2;
|
|
12969
12961
|
var min = min$1;
|
|
12970
12962
|
var pow = pow$1;
|
|
12971
12963
|
var round$1 = round$2;
|
|
@@ -12999,7 +12991,7 @@ var getProto = requireGetProto();
|
|
|
12999
12991
|
var $ObjectGPO = requireObject_getPrototypeOf();
|
|
13000
12992
|
var $ReflectGPO = requireReflect_getPrototypeOf();
|
|
13001
12993
|
var $apply = requireFunctionApply();
|
|
13002
|
-
var $call =
|
|
12994
|
+
var $call = functionCall;
|
|
13003
12995
|
var needsEval = {};
|
|
13004
12996
|
var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array);
|
|
13005
12997
|
var INTRINSICS = {
|
|
@@ -13170,13 +13162,13 @@ var LEGACY_ALIASES = {
|
|
|
13170
13162
|
"%WeakMapPrototype%": ["WeakMap", "prototype"],
|
|
13171
13163
|
"%WeakSetPrototype%": ["WeakSet", "prototype"]
|
|
13172
13164
|
};
|
|
13173
|
-
var
|
|
13165
|
+
var bind2 = functionBind;
|
|
13174
13166
|
var hasOwn = requireHasown();
|
|
13175
|
-
var $concat =
|
|
13176
|
-
var $spliceApply =
|
|
13177
|
-
var $replace =
|
|
13178
|
-
var $strSlice =
|
|
13179
|
-
var $exec =
|
|
13167
|
+
var $concat = bind2.call($call, Array.prototype.concat);
|
|
13168
|
+
var $spliceApply = bind2.call($apply, Array.prototype.splice);
|
|
13169
|
+
var $replace = bind2.call($call, String.prototype.replace);
|
|
13170
|
+
var $strSlice = bind2.call($call, String.prototype.slice);
|
|
13171
|
+
var $exec = bind2.call($call, RegExp.prototype.exec);
|
|
13180
13172
|
var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
|
|
13181
13173
|
var reEscapeChar = /\\(\\)?/g;
|
|
13182
13174
|
var stringToPath = function stringToPath2(string2) {
|
|
@@ -26660,7 +26652,7 @@ function RequestForm({ header = null }) {
|
|
|
26660
26652
|
}
|
|
26661
26653
|
handleDeliveryAddressChange();
|
|
26662
26654
|
}, [deliveryAddress]);
|
|
26663
|
-
const {
|
|
26655
|
+
const { funnelContextRef } = useTracking();
|
|
26664
26656
|
const handleSubmit = async (values2) => {
|
|
26665
26657
|
var _a3;
|
|
26666
26658
|
handleDisableCTA(true);
|
|
@@ -26676,10 +26668,10 @@ function RequestForm({ header = null }) {
|
|
|
26676
26668
|
if (success) {
|
|
26677
26669
|
setIsActualUkLead(isUkLead);
|
|
26678
26670
|
setShowLeadSuccess(true);
|
|
26679
|
-
trackFormSubmitted(
|
|
26671
|
+
trackFormSubmitted(funnelContextRef.current, {
|
|
26680
26672
|
is_uk_lead: isUkLead
|
|
26681
26673
|
});
|
|
26682
|
-
trackCompleted(
|
|
26674
|
+
trackCompleted(funnelContextRef.current);
|
|
26683
26675
|
return;
|
|
26684
26676
|
} else {
|
|
26685
26677
|
console.error("[HeyCater Funnel] Expected success screen but got success=false. Result:", response);
|
|
@@ -26706,10 +26698,10 @@ function RequestForm({ header = null }) {
|
|
|
26706
26698
|
redirectRoute = `/${router.locale}/account/external/requests/${opportunity.id}`;
|
|
26707
26699
|
}
|
|
26708
26700
|
}
|
|
26709
|
-
trackFormSubmitted(
|
|
26701
|
+
trackFormSubmitted(funnelContextRef.current, {
|
|
26710
26702
|
is_logged_in: !!currentUserAccount
|
|
26711
26703
|
});
|
|
26712
|
-
trackCompleted(
|
|
26704
|
+
trackCompleted(funnelContextRef.current);
|
|
26713
26705
|
actions.setRequest(values2);
|
|
26714
26706
|
redirectToCustomerAccountRequest(redirectRoute);
|
|
26715
26707
|
};
|
|
@@ -29791,7 +29783,7 @@ const LoadingIndicator = ({ variant }) => {
|
|
|
29791
29783
|
const WrapperBox = styled(Box)`
|
|
29792
29784
|
color: var(--embedded-text-color, inherit);
|
|
29793
29785
|
`;
|
|
29794
|
-
function useAbandonmentTracking(
|
|
29786
|
+
function useAbandonmentTracking(funnelContextRef, state) {
|
|
29795
29787
|
const hasTrackedAbandonmentRef = useRef(false);
|
|
29796
29788
|
const hasCompletedRef = useRef(false);
|
|
29797
29789
|
useEffect(() => {
|
|
@@ -29811,7 +29803,7 @@ function useAbandonmentTracking(funnelContext, state) {
|
|
|
29811
29803
|
const handleAbandonment = () => {
|
|
29812
29804
|
if (hasTrackedAbandonmentRef.current) return;
|
|
29813
29805
|
if (hasCompletedRef.current) return;
|
|
29814
|
-
trackAbandoned(
|
|
29806
|
+
trackAbandoned(funnelContextRef.current, {
|
|
29815
29807
|
step_id: stateSnapshot.stepId,
|
|
29816
29808
|
step_index: stateSnapshot.stepIndex
|
|
29817
29809
|
});
|
|
@@ -29832,8 +29824,7 @@ function useAbandonmentTracking(funnelContext, state) {
|
|
|
29832
29824
|
};
|
|
29833
29825
|
}, [
|
|
29834
29826
|
state.status,
|
|
29835
|
-
"qualification" in state && "step" in state.qualification ? state.qualification.step.id : null
|
|
29836
|
-
funnelContext
|
|
29827
|
+
"qualification" in state && "step" in state.qualification ? state.qualification.step.id : null
|
|
29837
29828
|
]);
|
|
29838
29829
|
}
|
|
29839
29830
|
const EmbeddedFunnel = React__default.forwardRef(
|
|
@@ -29872,7 +29863,7 @@ const EmbeddedFunnel = React__default.forwardRef(
|
|
|
29872
29863
|
useEffect(() => {
|
|
29873
29864
|
cleanupOldTrackingSessions();
|
|
29874
29865
|
}, []);
|
|
29875
|
-
|
|
29866
|
+
useLayoutEffect(() => {
|
|
29876
29867
|
var _a3, _b2, _c2;
|
|
29877
29868
|
if (!("qualification" in state)) return;
|
|
29878
29869
|
const sessionId = ((_a3 = state.qualification.sessionInfo) == null ? void 0 : _a3.sessionId) || "";
|
|
@@ -29889,11 +29880,13 @@ const EmbeddedFunnel = React__default.forwardRef(
|
|
|
29889
29880
|
} catch (e2) {
|
|
29890
29881
|
}
|
|
29891
29882
|
}
|
|
29883
|
+
const shouldRestoreCity = (restoredContext == null ? void 0 : restoredContext.service_type) === serviceType;
|
|
29884
|
+
const cityToUse = city || (shouldRestoreCity ? restoredContext == null ? void 0 : restoredContext.city : void 0);
|
|
29892
29885
|
updateContext({
|
|
29893
29886
|
session_id: sessionId,
|
|
29894
29887
|
total_steps: totalSteps,
|
|
29895
29888
|
service_type: (restoredContext == null ? void 0 : restoredContext.service_type) || serviceType,
|
|
29896
|
-
...
|
|
29889
|
+
...cityToUse ? { city: cityToUse } : {}
|
|
29897
29890
|
});
|
|
29898
29891
|
}, [
|
|
29899
29892
|
"qualification" in state ? (_a2 = state.qualification.sessionInfo) == null ? void 0 : _a2.sessionId : null,
|
|
@@ -29911,7 +29904,7 @@ const EmbeddedFunnel = React__default.forwardRef(
|
|
|
29911
29904
|
});
|
|
29912
29905
|
}
|
|
29913
29906
|
}, [state.status]);
|
|
29914
|
-
useAbandonmentTracking(funnelContext
|
|
29907
|
+
useAbandonmentTracking(funnelContext, state);
|
|
29915
29908
|
const toNextStep2 = useCallback(() => {
|
|
29916
29909
|
actions.nextStep();
|
|
29917
29910
|
}, [actions]);
|
|
@@ -29936,7 +29929,15 @@ const EmbeddedFunnel = React__default.forwardRef(
|
|
|
29936
29929
|
}
|
|
29937
29930
|
};
|
|
29938
29931
|
if (state.status === QUALIFICATION_STATUS.qualifiedForRequest) {
|
|
29939
|
-
return /* @__PURE__ */ jsx(
|
|
29932
|
+
return /* @__PURE__ */ jsx(
|
|
29933
|
+
TrackingProvider,
|
|
29934
|
+
{
|
|
29935
|
+
funnelContextRef: funnelContext,
|
|
29936
|
+
updateContext,
|
|
29937
|
+
currentStepId: stepId,
|
|
29938
|
+
children: /* @__PURE__ */ jsx(EmbeddedRequestPage, { ratings })
|
|
29939
|
+
}
|
|
29940
|
+
);
|
|
29940
29941
|
}
|
|
29941
29942
|
let textColor = onBackground === "light" ? "dark" : "light";
|
|
29942
29943
|
if (stepId.includes("customer-") && ((_e = slides == null ? void 0 : slides.customerTier) == null ? void 0 : _e.whiteWrapper)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heycater/qualification-funnel",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Heycater embedded qualification funnel widget",
|
|
6
6
|
"main": "dist/index.cjs.js",
|
|
@@ -32,7 +32,10 @@
|
|
|
32
32
|
"preview": "vite preview",
|
|
33
33
|
"prepublishOnly": "npm run clean && npm run build",
|
|
34
34
|
"lint": "npx eslint ./src",
|
|
35
|
-
"type-check": "tsc --noEmit"
|
|
35
|
+
"type-check": "tsc --noEmit",
|
|
36
|
+
"test": "vitest",
|
|
37
|
+
"test:ui": "vitest --ui",
|
|
38
|
+
"test:coverage": "vitest --coverage"
|
|
36
39
|
},
|
|
37
40
|
"peerDependencies": {
|
|
38
41
|
"@bugsnag/js": "^7.5.4",
|
|
@@ -66,6 +69,9 @@
|
|
|
66
69
|
},
|
|
67
70
|
"devDependencies": {
|
|
68
71
|
"@svgr/rollup": "^8.1.0",
|
|
72
|
+
"@testing-library/react": "^12.1.5",
|
|
73
|
+
"@testing-library/react-hooks": "^8.0.1",
|
|
74
|
+
"@testing-library/user-event": "^14.5.0",
|
|
69
75
|
"@types/google.maps": "^3.54.1",
|
|
70
76
|
"@types/lodash": "^4.17.0",
|
|
71
77
|
"@types/node": "20.3.2",
|
|
@@ -74,6 +80,8 @@
|
|
|
74
80
|
"@types/react-dom": "^17.0.2",
|
|
75
81
|
"@types/styled-components": "^5.1.26",
|
|
76
82
|
"@vitejs/plugin-react": "^4.2.1",
|
|
83
|
+
"@vitest/ui": "^1.0.0",
|
|
84
|
+
"happy-dom": "^12.10.3",
|
|
77
85
|
"react": "^17.0.2",
|
|
78
86
|
"react-dom": "^17.0.2",
|
|
79
87
|
"rollup-plugin-visualizer": "^6.0.5",
|
|
@@ -81,6 +89,7 @@
|
|
|
81
89
|
"typescript": "5.1.3",
|
|
82
90
|
"vite": "^5.0.10",
|
|
83
91
|
"vite-plugin-dts": "^3.7.0",
|
|
84
|
-
"vite-plugin-static-copy": "^3.1.4"
|
|
92
|
+
"vite-plugin-static-copy": "^3.1.4",
|
|
93
|
+
"vitest": "^1.0.0"
|
|
85
94
|
}
|
|
86
95
|
}
|