@codebards/ik-embeddable-form 0.0.2696943363-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 +80 -10
- package/dist/embed.js.map +1 -1
- package/package.json +1 -1
package/dist/embed.js
CHANGED
|
@@ -1700,7 +1700,8 @@ var IKEmbeddableFormBundle = function(exports) {
|
|
|
1700
1700
|
Region: formData.region ?? (ctx == null ? void 0 : ctx.region) ?? "",
|
|
1701
1701
|
step,
|
|
1702
1702
|
data_click_id: resolveClickId(formData),
|
|
1703
|
-
ab_bucket_json: JSON.stringify({ gql_yoe_dropdown_ab: "" })
|
|
1703
|
+
ab_bucket_json: JSON.stringify({ gql_yoe_dropdown_ab: "" }),
|
|
1704
|
+
fingerprint_id: getFingerprintId()
|
|
1704
1705
|
};
|
|
1705
1706
|
}
|
|
1706
1707
|
async function postClickstream(url, apiKey, datasetId, tableId, row) {
|
|
@@ -2087,13 +2088,13 @@ var IKEmbeddableFormBundle = function(exports) {
|
|
|
2087
2088
|
}
|
|
2088
2089
|
startSlotsPrefetch() {
|
|
2089
2090
|
if (!this.needsSlotsPrefetch() || this.slotsPrefetchPromise) return;
|
|
2090
|
-
this.mergeFormData({ slotsLoading: true });
|
|
2091
|
+
this.mergeFormData({ slotsLoading: true }, true);
|
|
2091
2092
|
const earlyPrefetch = getSlotsPrefetchPromise();
|
|
2092
2093
|
const prefetch = earlyPrefetch ? earlyPrefetch.then((result) => {
|
|
2093
2094
|
this.applySlotFetchResult(result);
|
|
2094
2095
|
}) : this.loadSlotsIntoFormData();
|
|
2095
2096
|
this.slotsPrefetchPromise = prefetch.catch((err) => {
|
|
2096
|
-
this.mergeFormData({ slotsLoading: false });
|
|
2097
|
+
this.mergeFormData({ slotsLoading: false }, true);
|
|
2097
2098
|
this.analytics.trackError(err, {
|
|
2098
2099
|
stepId: "prefetch-slots",
|
|
2099
2100
|
formId: this.config.id
|
|
@@ -2125,6 +2126,7 @@ var IKEmbeddableFormBundle = function(exports) {
|
|
|
2125
2126
|
slotDisplay: formatInviteeDisplay(firstSlot.inviteeStartTime, firstSlot.startTime)
|
|
2126
2127
|
});
|
|
2127
2128
|
}
|
|
2129
|
+
this.notifyListeners();
|
|
2128
2130
|
}
|
|
2129
2131
|
async ensureSlotsReady(step) {
|
|
2130
2132
|
if (this.slotsPrefetchPromise) {
|
|
@@ -2436,14 +2438,18 @@ var IKEmbeddableFormBundle = function(exports) {
|
|
|
2436
2438
|
});
|
|
2437
2439
|
return data;
|
|
2438
2440
|
}
|
|
2439
|
-
mergeFormData(incoming) {
|
|
2441
|
+
mergeFormData(incoming, notify = false) {
|
|
2440
2442
|
this.state = {
|
|
2441
2443
|
...this.state,
|
|
2442
2444
|
formData: { ...this.state.formData, ...incoming }
|
|
2443
2445
|
};
|
|
2446
|
+
if (notify) this.notifyListeners();
|
|
2444
2447
|
}
|
|
2445
2448
|
setState(partial) {
|
|
2446
2449
|
this.state = { ...this.state, ...partial };
|
|
2450
|
+
this.notifyListeners();
|
|
2451
|
+
}
|
|
2452
|
+
notifyListeners() {
|
|
2447
2453
|
this.listeners.forEach((l2) => l2(this.getState()));
|
|
2448
2454
|
}
|
|
2449
2455
|
}
|
|
@@ -2558,6 +2564,10 @@ var IKEmbeddableFormBundle = function(exports) {
|
|
|
2558
2564
|
lastName: parts.slice(1).join(" ") || (parts[0] ?? "")
|
|
2559
2565
|
};
|
|
2560
2566
|
}
|
|
2567
|
+
function customerIdFields(context) {
|
|
2568
|
+
const customerId = str(context.openConfig.customerId);
|
|
2569
|
+
return customerId ? { customer_id: customerId } : {};
|
|
2570
|
+
}
|
|
2561
2571
|
function resolveUtmMedium(context) {
|
|
2562
2572
|
return resolveWordPressUtmMedium(
|
|
2563
2573
|
context.visitorId,
|
|
@@ -2585,6 +2595,7 @@ var IKEmbeddableFormBundle = function(exports) {
|
|
|
2585
2595
|
const { firstName, lastName } = resolveName(formData);
|
|
2586
2596
|
const webinarType = resolveEffectiveWebinarType(formData, context.webinarType);
|
|
2587
2597
|
return {
|
|
2598
|
+
...customerIdFields(context),
|
|
2588
2599
|
"First Name": firstName,
|
|
2589
2600
|
"Last Name": lastName,
|
|
2590
2601
|
"Email Address": str(formData.email),
|
|
@@ -2658,6 +2669,7 @@ var IKEmbeddableFormBundle = function(exports) {
|
|
|
2658
2669
|
const gaEventId = Date.now();
|
|
2659
2670
|
const { firstName, lastName } = resolveName(formData);
|
|
2660
2671
|
return {
|
|
2672
|
+
...customerIdFields(context),
|
|
2661
2673
|
"First Name": firstName,
|
|
2662
2674
|
"Last Name": lastName,
|
|
2663
2675
|
"Email Address": str(formData.email),
|
|
@@ -2728,6 +2740,7 @@ var IKEmbeddableFormBundle = function(exports) {
|
|
|
2728
2740
|
const linkedIn = str(formData.linkedIn).trim();
|
|
2729
2741
|
const resumeBase64 = str(formData.resumeFileBase64).trim();
|
|
2730
2742
|
return {
|
|
2743
|
+
...customerIdFields(context),
|
|
2731
2744
|
Lead_Created_Time: formatLeadCreatedTime(formData.leadCreatedTime),
|
|
2732
2745
|
Page_URL: encodeURIComponent(context.pageUrl),
|
|
2733
2746
|
"First Name": firstName,
|
|
@@ -2850,6 +2863,10 @@ var IKEmbeddableFormBundle = function(exports) {
|
|
|
2850
2863
|
return url.toString();
|
|
2851
2864
|
}
|
|
2852
2865
|
buildBody(contract, formData) {
|
|
2866
|
+
const body = this.buildRawBody(contract, formData);
|
|
2867
|
+
return { ...body, fingerprint_id: getFingerprintId() };
|
|
2868
|
+
}
|
|
2869
|
+
buildRawBody(contract, formData) {
|
|
2853
2870
|
if (contract.payloadBuilder) {
|
|
2854
2871
|
return buildPayload(contract.payloadBuilder, formData);
|
|
2855
2872
|
}
|
|
@@ -2874,7 +2891,13 @@ var IKEmbeddableFormBundle = function(exports) {
|
|
|
2874
2891
|
}
|
|
2875
2892
|
async fetchWithRetry(url, init, retriesLeft, timeoutMs) {
|
|
2876
2893
|
const controller = new AbortController();
|
|
2877
|
-
|
|
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);
|
|
2878
2901
|
try {
|
|
2879
2902
|
const res = await fetch(url, { ...init, signal: controller.signal });
|
|
2880
2903
|
clearTimeout(timeoutId);
|
|
@@ -2891,13 +2914,21 @@ var IKEmbeddableFormBundle = function(exports) {
|
|
|
2891
2914
|
return { data, status: res.status, ok: true };
|
|
2892
2915
|
} catch (err) {
|
|
2893
2916
|
clearTimeout(timeoutId);
|
|
2894
|
-
|
|
2917
|
+
const normalizedErr = timedOut ? this.buildTimeoutError(timeoutMs) : err;
|
|
2918
|
+
if (retriesLeft > 1 && this.isRetryable(normalizedErr)) {
|
|
2895
2919
|
await this.delay(500 * (2 - retriesLeft));
|
|
2896
2920
|
return this.fetchWithRetry(url, init, retriesLeft - 1, timeoutMs);
|
|
2897
2921
|
}
|
|
2898
|
-
throw
|
|
2922
|
+
throw normalizedErr;
|
|
2899
2923
|
}
|
|
2900
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
|
+
}
|
|
2901
2932
|
applyResponseMapping(mapping, response) {
|
|
2902
2933
|
if (!mapping) return {};
|
|
2903
2934
|
const result = {};
|
|
@@ -2913,7 +2944,7 @@ var IKEmbeddableFormBundle = function(exports) {
|
|
|
2913
2944
|
if (err instanceof TypeError) return true;
|
|
2914
2945
|
if (err && typeof err === "object" && "code" in err) {
|
|
2915
2946
|
const code = err.code;
|
|
2916
|
-
return code === "HTTP_429" || code === "HTTP_503" || code === "HTTP_502";
|
|
2947
|
+
return code === "TIMEOUT" || code === "HTTP_429" || code === "HTTP_503" || code === "HTTP_502";
|
|
2917
2948
|
}
|
|
2918
2949
|
return false;
|
|
2919
2950
|
}
|
|
@@ -20495,10 +20526,49 @@ var IKEmbeddableFormBundle = function(exports) {
|
|
|
20495
20526
|
}
|
|
20496
20527
|
}
|
|
20497
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
|
+
};
|
|
20498
20567
|
const GQL_WEBINAR_VARIANTS = [
|
|
20499
20568
|
defaultVariant,
|
|
20500
20569
|
indiaVariant,
|
|
20501
|
-
eventVariant
|
|
20570
|
+
eventVariant,
|
|
20571
|
+
emailRegistrationVariant
|
|
20502
20572
|
];
|
|
20503
20573
|
const gqlWebinarConfig = {
|
|
20504
20574
|
...gqlWebinarBaseConfig,
|
|
@@ -20661,7 +20731,7 @@ ${intlTelStyles}`;
|
|
|
20661
20731
|
destroy();
|
|
20662
20732
|
},
|
|
20663
20733
|
getVersion() {
|
|
20664
|
-
return "1.0.
|
|
20734
|
+
return "1.0.31";
|
|
20665
20735
|
}
|
|
20666
20736
|
};
|
|
20667
20737
|
if (typeof window !== "undefined") {
|