@codebards/ik-embeddable-form 0.0.2702285982-qa → 0.0.2708315494-qa
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/embed.js +73 -8
- package/dist/embed.js.map +1 -1
- package/package.json +1 -1
package/dist/embed.js
CHANGED
|
@@ -2088,13 +2088,13 @@ var IKEmbeddableFormBundle = function(exports) {
|
|
|
2088
2088
|
}
|
|
2089
2089
|
startSlotsPrefetch() {
|
|
2090
2090
|
if (!this.needsSlotsPrefetch() || this.slotsPrefetchPromise) return;
|
|
2091
|
-
this.mergeFormData({ slotsLoading: true });
|
|
2091
|
+
this.mergeFormData({ slotsLoading: true }, true);
|
|
2092
2092
|
const earlyPrefetch = getSlotsPrefetchPromise();
|
|
2093
2093
|
const prefetch = earlyPrefetch ? earlyPrefetch.then((result) => {
|
|
2094
2094
|
this.applySlotFetchResult(result);
|
|
2095
2095
|
}) : this.loadSlotsIntoFormData();
|
|
2096
2096
|
this.slotsPrefetchPromise = prefetch.catch((err) => {
|
|
2097
|
-
this.mergeFormData({ slotsLoading: false });
|
|
2097
|
+
this.mergeFormData({ slotsLoading: false }, true);
|
|
2098
2098
|
this.analytics.trackError(err, {
|
|
2099
2099
|
stepId: "prefetch-slots",
|
|
2100
2100
|
formId: this.config.id
|
|
@@ -2126,6 +2126,7 @@ var IKEmbeddableFormBundle = function(exports) {
|
|
|
2126
2126
|
slotDisplay: formatInviteeDisplay(firstSlot.inviteeStartTime, firstSlot.startTime)
|
|
2127
2127
|
});
|
|
2128
2128
|
}
|
|
2129
|
+
this.notifyListeners();
|
|
2129
2130
|
}
|
|
2130
2131
|
async ensureSlotsReady(step) {
|
|
2131
2132
|
if (this.slotsPrefetchPromise) {
|
|
@@ -2437,14 +2438,18 @@ var IKEmbeddableFormBundle = function(exports) {
|
|
|
2437
2438
|
});
|
|
2438
2439
|
return data;
|
|
2439
2440
|
}
|
|
2440
|
-
mergeFormData(incoming) {
|
|
2441
|
+
mergeFormData(incoming, notify = false) {
|
|
2441
2442
|
this.state = {
|
|
2442
2443
|
...this.state,
|
|
2443
2444
|
formData: { ...this.state.formData, ...incoming }
|
|
2444
2445
|
};
|
|
2446
|
+
if (notify) this.notifyListeners();
|
|
2445
2447
|
}
|
|
2446
2448
|
setState(partial) {
|
|
2447
2449
|
this.state = { ...this.state, ...partial };
|
|
2450
|
+
this.notifyListeners();
|
|
2451
|
+
}
|
|
2452
|
+
notifyListeners() {
|
|
2448
2453
|
this.listeners.forEach((l2) => l2(this.getState()));
|
|
2449
2454
|
}
|
|
2450
2455
|
}
|
|
@@ -2559,6 +2564,10 @@ var IKEmbeddableFormBundle = function(exports) {
|
|
|
2559
2564
|
lastName: parts.slice(1).join(" ") || (parts[0] ?? "")
|
|
2560
2565
|
};
|
|
2561
2566
|
}
|
|
2567
|
+
function customerIdFields(context) {
|
|
2568
|
+
const customerId = str(context.openConfig.customerId);
|
|
2569
|
+
return customerId ? { customer_id: customerId } : {};
|
|
2570
|
+
}
|
|
2562
2571
|
function resolveUtmMedium(context) {
|
|
2563
2572
|
return resolveWordPressUtmMedium(
|
|
2564
2573
|
context.visitorId,
|
|
@@ -2586,6 +2595,7 @@ var IKEmbeddableFormBundle = function(exports) {
|
|
|
2586
2595
|
const { firstName, lastName } = resolveName(formData);
|
|
2587
2596
|
const webinarType = resolveEffectiveWebinarType(formData, context.webinarType);
|
|
2588
2597
|
return {
|
|
2598
|
+
...customerIdFields(context),
|
|
2589
2599
|
"First Name": firstName,
|
|
2590
2600
|
"Last Name": lastName,
|
|
2591
2601
|
"Email Address": str(formData.email),
|
|
@@ -2659,6 +2669,7 @@ var IKEmbeddableFormBundle = function(exports) {
|
|
|
2659
2669
|
const gaEventId = Date.now();
|
|
2660
2670
|
const { firstName, lastName } = resolveName(formData);
|
|
2661
2671
|
return {
|
|
2672
|
+
...customerIdFields(context),
|
|
2662
2673
|
"First Name": firstName,
|
|
2663
2674
|
"Last Name": lastName,
|
|
2664
2675
|
"Email Address": str(formData.email),
|
|
@@ -2729,6 +2740,7 @@ var IKEmbeddableFormBundle = function(exports) {
|
|
|
2729
2740
|
const linkedIn = str(formData.linkedIn).trim();
|
|
2730
2741
|
const resumeBase64 = str(formData.resumeFileBase64).trim();
|
|
2731
2742
|
return {
|
|
2743
|
+
...customerIdFields(context),
|
|
2732
2744
|
Lead_Created_Time: formatLeadCreatedTime(formData.leadCreatedTime),
|
|
2733
2745
|
Page_URL: encodeURIComponent(context.pageUrl),
|
|
2734
2746
|
"First Name": firstName,
|
|
@@ -2879,7 +2891,13 @@ var IKEmbeddableFormBundle = function(exports) {
|
|
|
2879
2891
|
}
|
|
2880
2892
|
async fetchWithRetry(url, init, retriesLeft, timeoutMs) {
|
|
2881
2893
|
const controller = new AbortController();
|
|
2882
|
-
|
|
2894
|
+
let timedOut = false;
|
|
2895
|
+
const timeoutId = setTimeout(() => {
|
|
2896
|
+
timedOut = true;
|
|
2897
|
+
controller.abort(
|
|
2898
|
+
new DOMException(`Request timed out after ${timeoutMs}ms`, "TimeoutError")
|
|
2899
|
+
);
|
|
2900
|
+
}, timeoutMs);
|
|
2883
2901
|
try {
|
|
2884
2902
|
const res = await fetch(url, { ...init, signal: controller.signal });
|
|
2885
2903
|
clearTimeout(timeoutId);
|
|
@@ -2896,13 +2914,21 @@ var IKEmbeddableFormBundle = function(exports) {
|
|
|
2896
2914
|
return { data, status: res.status, ok: true };
|
|
2897
2915
|
} catch (err) {
|
|
2898
2916
|
clearTimeout(timeoutId);
|
|
2899
|
-
|
|
2917
|
+
const normalizedErr = timedOut ? this.buildTimeoutError(timeoutMs) : err;
|
|
2918
|
+
if (retriesLeft > 1 && this.isRetryable(normalizedErr)) {
|
|
2900
2919
|
await this.delay(500 * (2 - retriesLeft));
|
|
2901
2920
|
return this.fetchWithRetry(url, init, retriesLeft - 1, timeoutMs);
|
|
2902
2921
|
}
|
|
2903
|
-
throw
|
|
2922
|
+
throw normalizedErr;
|
|
2904
2923
|
}
|
|
2905
2924
|
}
|
|
2925
|
+
buildTimeoutError(timeoutMs) {
|
|
2926
|
+
return {
|
|
2927
|
+
code: "TIMEOUT",
|
|
2928
|
+
message: "This is taking longer than expected. Please try again.",
|
|
2929
|
+
details: { timeoutMs }
|
|
2930
|
+
};
|
|
2931
|
+
}
|
|
2906
2932
|
applyResponseMapping(mapping, response) {
|
|
2907
2933
|
if (!mapping) return {};
|
|
2908
2934
|
const result = {};
|
|
@@ -2918,7 +2944,7 @@ var IKEmbeddableFormBundle = function(exports) {
|
|
|
2918
2944
|
if (err instanceof TypeError) return true;
|
|
2919
2945
|
if (err && typeof err === "object" && "code" in err) {
|
|
2920
2946
|
const code = err.code;
|
|
2921
|
-
return code === "HTTP_429" || code === "HTTP_503" || code === "HTTP_502";
|
|
2947
|
+
return code === "TIMEOUT" || code === "HTTP_429" || code === "HTTP_503" || code === "HTTP_502";
|
|
2922
2948
|
}
|
|
2923
2949
|
return false;
|
|
2924
2950
|
}
|
|
@@ -20500,10 +20526,49 @@ var IKEmbeddableFormBundle = function(exports) {
|
|
|
20500
20526
|
}
|
|
20501
20527
|
}
|
|
20502
20528
|
};
|
|
20529
|
+
const emailRegistrationVariant = {
|
|
20530
|
+
id: "email-registration",
|
|
20531
|
+
overrides: {
|
|
20532
|
+
layout: {
|
|
20533
|
+
leftPanel: {
|
|
20534
|
+
progressGroups: [
|
|
20535
|
+
{
|
|
20536
|
+
number: 1,
|
|
20537
|
+
title: "Webinar Registration",
|
|
20538
|
+
stepIds: ["slot-selection"]
|
|
20539
|
+
},
|
|
20540
|
+
{
|
|
20541
|
+
number: 2,
|
|
20542
|
+
title: "Profile Details",
|
|
20543
|
+
stepIds: ["profile-details", "goals-details"]
|
|
20544
|
+
}
|
|
20545
|
+
]
|
|
20546
|
+
},
|
|
20547
|
+
rightPanel: {
|
|
20548
|
+
progressGroups: [
|
|
20549
|
+
{ stepIds: ["slot-selection"] },
|
|
20550
|
+
{ stepIds: ["profile-details"] },
|
|
20551
|
+
{ stepIds: ["goals-details"] },
|
|
20552
|
+
{ stepIds: ["consultation-prefs"] }
|
|
20553
|
+
]
|
|
20554
|
+
}
|
|
20555
|
+
},
|
|
20556
|
+
steps: {
|
|
20557
|
+
// Lead is resolved from customer_id on the backend — skip contact collection.
|
|
20558
|
+
"contact-details": { show: false },
|
|
20559
|
+
"profile-details": {
|
|
20560
|
+
fields: {
|
|
20561
|
+
interviewTimeline: { show: false }
|
|
20562
|
+
}
|
|
20563
|
+
}
|
|
20564
|
+
}
|
|
20565
|
+
}
|
|
20566
|
+
};
|
|
20503
20567
|
const GQL_WEBINAR_VARIANTS = [
|
|
20504
20568
|
defaultVariant,
|
|
20505
20569
|
indiaVariant,
|
|
20506
|
-
eventVariant
|
|
20570
|
+
eventVariant,
|
|
20571
|
+
emailRegistrationVariant
|
|
20507
20572
|
];
|
|
20508
20573
|
const gqlWebinarConfig = {
|
|
20509
20574
|
...gqlWebinarBaseConfig,
|