@heycater/qualification-funnel 1.19.34 → 1.19.36
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 +485 -467
- package/dist/index.cjs.js +491 -473
- package/dist/index.esm.js +107 -25
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -13325,7 +13325,14 @@ function requireFunctionBind() {
|
|
|
13325
13325
|
functionBind = Function.prototype.bind || implementation2;
|
|
13326
13326
|
return functionBind;
|
|
13327
13327
|
}
|
|
13328
|
-
var functionCall
|
|
13328
|
+
var functionCall;
|
|
13329
|
+
var hasRequiredFunctionCall;
|
|
13330
|
+
function requireFunctionCall() {
|
|
13331
|
+
if (hasRequiredFunctionCall) return functionCall;
|
|
13332
|
+
hasRequiredFunctionCall = 1;
|
|
13333
|
+
functionCall = Function.prototype.call;
|
|
13334
|
+
return functionCall;
|
|
13335
|
+
}
|
|
13329
13336
|
var functionApply;
|
|
13330
13337
|
var hasRequiredFunctionApply;
|
|
13331
13338
|
function requireFunctionApply() {
|
|
@@ -13337,12 +13344,12 @@ function requireFunctionApply() {
|
|
|
13337
13344
|
var reflectApply = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
|
|
13338
13345
|
var bind$2 = requireFunctionBind();
|
|
13339
13346
|
var $apply$1 = requireFunctionApply();
|
|
13340
|
-
var $call$2 =
|
|
13347
|
+
var $call$2 = requireFunctionCall();
|
|
13341
13348
|
var $reflectApply = reflectApply;
|
|
13342
13349
|
var actualApply = $reflectApply || bind$2.call($call$2, $apply$1);
|
|
13343
13350
|
var bind$1 = requireFunctionBind();
|
|
13344
13351
|
var $TypeError$4 = type;
|
|
13345
|
-
var $call$1 =
|
|
13352
|
+
var $call$1 = requireFunctionCall();
|
|
13346
13353
|
var $actualApply = actualApply;
|
|
13347
13354
|
var callBindApplyHelpers = function callBindBasic(args) {
|
|
13348
13355
|
if (args.length < 1 || typeof args[0] !== "function") {
|
|
@@ -13457,7 +13464,7 @@ var getProto = requireGetProto();
|
|
|
13457
13464
|
var $ObjectGPO = requireObject_getPrototypeOf();
|
|
13458
13465
|
var $ReflectGPO = requireReflect_getPrototypeOf();
|
|
13459
13466
|
var $apply = requireFunctionApply();
|
|
13460
|
-
var $call =
|
|
13467
|
+
var $call = requireFunctionCall();
|
|
13461
13468
|
var needsEval = {};
|
|
13462
13469
|
var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array);
|
|
13463
13470
|
var INTRINSICS = {
|
|
@@ -32582,6 +32589,7 @@ const RedesignedFunnel = ({
|
|
|
32582
32589
|
const response = await submitAsNewCustomer(buildValues);
|
|
32583
32590
|
const { signInToken, opportunity, isUkLead } = response || {};
|
|
32584
32591
|
if (isUkLead) {
|
|
32592
|
+
trackFormSubmitted(funnelContextRef.current);
|
|
32585
32593
|
trackCompleted(funnelContextRef.current);
|
|
32586
32594
|
setSubmittedData(formData);
|
|
32587
32595
|
setPhase("done");
|
|
@@ -32594,6 +32602,7 @@ const RedesignedFunnel = ({
|
|
|
32594
32602
|
}
|
|
32595
32603
|
const accountUrl = signInToken ? `/${router.locale}/account/requests/${opportunity.id}?one_time_sign_in_token=${signInToken}` : `/${router.locale}/account/external/requests/${opportunity.id}`;
|
|
32596
32604
|
setRedirectUrl(accountUrl);
|
|
32605
|
+
trackFormSubmitted(funnelContextRef.current);
|
|
32597
32606
|
trackCompleted(funnelContextRef.current);
|
|
32598
32607
|
setSubmittedData(formData);
|
|
32599
32608
|
setPhase("done");
|
|
@@ -33235,33 +33244,83 @@ function useAbandonmentTracking(funnelContextRef, state) {
|
|
|
33235
33244
|
]);
|
|
33236
33245
|
}
|
|
33237
33246
|
const FEATURE_FLAG_NAME = "qf_redesign_v1";
|
|
33238
|
-
|
|
33239
|
-
|
|
33240
|
-
|
|
33247
|
+
const POSTHOG_POLL_INTERVAL_MS = 100;
|
|
33248
|
+
const POSTHOG_MAX_WAIT_MS = 5e3;
|
|
33249
|
+
function checkPostHogFlag() {
|
|
33250
|
+
if (typeof window === "undefined") return null;
|
|
33251
|
+
const posthog = window.posthog;
|
|
33252
|
+
if (!(posthog == null ? void 0 : posthog.getFeatureFlag)) return null;
|
|
33253
|
+
const flagValue = posthog.getFeatureFlag(FEATURE_FLAG_NAME);
|
|
33254
|
+
if (flagValue === "redesign") return "redesign";
|
|
33255
|
+
if (flagValue === "control") return "control";
|
|
33256
|
+
return null;
|
|
33257
|
+
}
|
|
33258
|
+
function getUrlVariantOverride() {
|
|
33259
|
+
if (typeof window === "undefined") return null;
|
|
33260
|
+
const search = window.location.search;
|
|
33261
|
+
if (search.includes("variant=redesign")) return "redesign";
|
|
33262
|
+
if (search.includes("variant=control")) return "control";
|
|
33263
|
+
return null;
|
|
33264
|
+
}
|
|
33265
|
+
function useFunnelVariantWithLoading() {
|
|
33266
|
+
const urlOverride = getUrlVariantOverride();
|
|
33267
|
+
const [result, setResult] = useState(() => {
|
|
33268
|
+
if (urlOverride) {
|
|
33269
|
+
return { variant: urlOverride, isLoading: false };
|
|
33270
|
+
}
|
|
33271
|
+
const initialFlag = checkPostHogFlag();
|
|
33272
|
+
if (initialFlag !== null) {
|
|
33273
|
+
return { variant: initialFlag, isLoading: false };
|
|
33274
|
+
}
|
|
33275
|
+
return { variant: "control", isLoading: true };
|
|
33276
|
+
});
|
|
33241
33277
|
useEffect(() => {
|
|
33242
|
-
if (
|
|
33243
|
-
|
|
33278
|
+
if (urlOverride) {
|
|
33279
|
+
setResult({ variant: urlOverride, isLoading: false });
|
|
33244
33280
|
return;
|
|
33245
33281
|
}
|
|
33246
|
-
|
|
33282
|
+
const flagValue = checkPostHogFlag();
|
|
33283
|
+
if (flagValue !== null) {
|
|
33284
|
+
setResult({ variant: flagValue, isLoading: false });
|
|
33247
33285
|
return;
|
|
33248
33286
|
}
|
|
33249
|
-
|
|
33250
|
-
|
|
33251
|
-
|
|
33252
|
-
|
|
33253
|
-
if (
|
|
33254
|
-
|
|
33255
|
-
|
|
33256
|
-
|
|
33287
|
+
let resolved = false;
|
|
33288
|
+
let timeoutId = null;
|
|
33289
|
+
const startTime = Date.now();
|
|
33290
|
+
const resolve = (variant) => {
|
|
33291
|
+
if (resolved) return;
|
|
33292
|
+
resolved = true;
|
|
33293
|
+
if (timeoutId) clearTimeout(timeoutId);
|
|
33294
|
+
setResult({ variant, isLoading: false });
|
|
33295
|
+
};
|
|
33296
|
+
const pollForPostHog = () => {
|
|
33297
|
+
if (resolved) return;
|
|
33298
|
+
const posthog = window.posthog;
|
|
33299
|
+
const immediateFlag = checkPostHogFlag();
|
|
33300
|
+
if (immediateFlag !== null) {
|
|
33301
|
+
resolve(immediateFlag);
|
|
33302
|
+
return;
|
|
33303
|
+
}
|
|
33304
|
+
if (posthog == null ? void 0 : posthog.onFeatureFlags) {
|
|
33305
|
+
posthog.onFeatureFlags(() => {
|
|
33306
|
+
const flag = checkPostHogFlag();
|
|
33307
|
+
resolve(flag ?? "control");
|
|
33308
|
+
});
|
|
33309
|
+
return;
|
|
33310
|
+
}
|
|
33311
|
+
if (Date.now() - startTime >= POSTHOG_MAX_WAIT_MS) {
|
|
33312
|
+
resolve("control");
|
|
33313
|
+
return;
|
|
33257
33314
|
}
|
|
33315
|
+
timeoutId = setTimeout(pollForPostHog, POSTHOG_POLL_INTERVAL_MS);
|
|
33258
33316
|
};
|
|
33259
|
-
|
|
33260
|
-
|
|
33261
|
-
|
|
33262
|
-
|
|
33263
|
-
|
|
33264
|
-
|
|
33317
|
+
pollForPostHog();
|
|
33318
|
+
return () => {
|
|
33319
|
+
resolved = true;
|
|
33320
|
+
if (timeoutId) clearTimeout(timeoutId);
|
|
33321
|
+
};
|
|
33322
|
+
}, [urlOverride]);
|
|
33323
|
+
return result;
|
|
33265
33324
|
}
|
|
33266
33325
|
const EmbeddedFunnel = React__default.forwardRef(
|
|
33267
33326
|
({
|
|
@@ -33277,7 +33336,7 @@ const EmbeddedFunnel = React__default.forwardRef(
|
|
|
33277
33336
|
}, ref2) => {
|
|
33278
33337
|
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
33279
33338
|
const scrollHelperRef = useRef(null);
|
|
33280
|
-
const funnelVariant =
|
|
33339
|
+
const { variant: funnelVariant, isLoading: variantLoading } = useFunnelVariantWithLoading();
|
|
33281
33340
|
const { state, actions, canContinue } = useQualification({});
|
|
33282
33341
|
const funnelContext = useRef({
|
|
33283
33342
|
session_id: "",
|
|
@@ -33378,6 +33437,9 @@ const EmbeddedFunnel = React__default.forwardRef(
|
|
|
33378
33437
|
return null;
|
|
33379
33438
|
}
|
|
33380
33439
|
const isFullscreen = mode === "fullscreen";
|
|
33440
|
+
if (isFullscreen && variantLoading) {
|
|
33441
|
+
return /* @__PURE__ */ jsx(VariantLoadingWrapper, { children: /* @__PURE__ */ jsx(SmallSpinner, {}) });
|
|
33442
|
+
}
|
|
33381
33443
|
const shouldUseRedesign = isFullscreen && funnelVariant === "redesign";
|
|
33382
33444
|
if (shouldUseRedesign) {
|
|
33383
33445
|
return /* @__PURE__ */ jsx(
|
|
@@ -33524,6 +33586,26 @@ const FormWrapper = styled.form`
|
|
|
33524
33586
|
outline: none;
|
|
33525
33587
|
}
|
|
33526
33588
|
`;
|
|
33589
|
+
const VariantLoadingWrapper = styled.div`
|
|
33590
|
+
min-height: 100vh;
|
|
33591
|
+
display: flex;
|
|
33592
|
+
align-items: center;
|
|
33593
|
+
justify-content: center;
|
|
33594
|
+
background: #fff;
|
|
33595
|
+
`;
|
|
33596
|
+
const SmallSpinner = styled.div`
|
|
33597
|
+
width: 40px;
|
|
33598
|
+
height: 40px;
|
|
33599
|
+
border: 3px solid #f3f3f3;
|
|
33600
|
+
border-top: 3px solid #F95524;
|
|
33601
|
+
border-radius: 50%;
|
|
33602
|
+
animation: spin 1s linear infinite;
|
|
33603
|
+
|
|
33604
|
+
@keyframes spin {
|
|
33605
|
+
0% { transform: rotate(0deg); }
|
|
33606
|
+
100% { transform: rotate(360deg); }
|
|
33607
|
+
}
|
|
33608
|
+
`;
|
|
33527
33609
|
var createBreakpoints$1 = {};
|
|
33528
33610
|
var interopRequireDefault = { exports: {} };
|
|
33529
33611
|
(function(module) {
|