@codebards/ik-embeddable-form 0.0.2733668477-qa → 0.0.2736450101-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 CHANGED
@@ -1950,8 +1950,7 @@ var IKEmbeddableFormBundle = function(exports) {
1950
1950
  Region: formData.region ?? (ctx == null ? void 0 : ctx.region) ?? "",
1951
1951
  step,
1952
1952
  data_click_id: resolveClickId(formData),
1953
- ab_bucket_json: JSON.stringify({ gql_yoe_dropdown_ab: "" }),
1954
- fingerprint_id: getFingerprintId()
1953
+ ab_bucket_json: JSON.stringify({ gql_yoe_dropdown_ab: "" })
1955
1954
  };
1956
1955
  }
1957
1956
  async function postClickstream(url, apiKey, datasetId, tableId, row) {
@@ -2364,13 +2363,13 @@ var IKEmbeddableFormBundle = function(exports) {
2364
2363
  }
2365
2364
  startSlotsPrefetch() {
2366
2365
  if (!this.needsSlotsPrefetch() || this.slotsPrefetchPromise) return;
2367
- this.mergeFormData({ slotsLoading: true }, true);
2366
+ this.mergeFormData({ slotsLoading: true });
2368
2367
  const earlyPrefetch = getSlotsPrefetchPromise();
2369
2368
  const prefetch = earlyPrefetch ? earlyPrefetch.then((result) => {
2370
2369
  this.applySlotFetchResult(result);
2371
2370
  }) : this.loadSlotsIntoFormData();
2372
2371
  this.slotsPrefetchPromise = prefetch.catch((err) => {
2373
- this.mergeFormData({ slotsLoading: false }, true);
2372
+ this.patchFormData({ slotsLoading: false });
2374
2373
  this.analytics.trackError(err, {
2375
2374
  stepId: "prefetch-slots",
2376
2375
  formId: this.config.id
@@ -2400,7 +2399,7 @@ var IKEmbeddableFormBundle = function(exports) {
2400
2399
  patch.inviteeEndTime = firstSlot.inviteeEndTime;
2401
2400
  patch.slotDisplay = formatInviteeDisplay(firstSlot.inviteeStartTime, firstSlot.startTime);
2402
2401
  }
2403
- this.mergeFormData(patch, true);
2402
+ this.patchFormData(patch);
2404
2403
  }
2405
2404
  async ensureSlotsReady(step) {
2406
2405
  if (this.slotsPrefetchPromise) {
@@ -2737,18 +2736,23 @@ var IKEmbeddableFormBundle = function(exports) {
2737
2736
  });
2738
2737
  return data;
2739
2738
  }
2740
- mergeFormData(incoming, notify = false) {
2739
+ mergeFormData(incoming) {
2741
2740
  this.state = {
2742
2741
  ...this.state,
2743
2742
  formData: { ...this.state.formData, ...incoming }
2744
2743
  };
2745
- if (notify) this.notifyListeners();
2744
+ }
2745
+ /**
2746
+ * Like `mergeFormData`, but notifies subscribers so the UI re-renders.
2747
+ * Needed for data that arrives asynchronously while a step is already on screen
2748
+ * (slot prefetch), where `mergeFormData` alone leaves the view stale until the
2749
+ * next unrelated `setState`.
2750
+ */
2751
+ patchFormData(incoming) {
2752
+ this.setState({ formData: { ...this.state.formData, ...incoming } });
2746
2753
  }
2747
2754
  setState(partial) {
2748
2755
  this.state = { ...this.state, ...partial };
2749
- this.notifyListeners();
2750
- }
2751
- notifyListeners() {
2752
2756
  this.listeners.forEach((l2) => l2(this.getState()));
2753
2757
  }
2754
2758
  }
@@ -2884,10 +2888,6 @@ var IKEmbeddableFormBundle = function(exports) {
2884
2888
  lastName: parts.slice(1).join(" ") || (parts[0] ?? "")
2885
2889
  };
2886
2890
  }
2887
- function customerIdFields(context) {
2888
- const customerId = str(context.openConfig.customerId);
2889
- return customerId ? { customer_id: customerId } : {};
2890
- }
2891
2891
  function resolveUtmMedium(context) {
2892
2892
  return resolveWordPressUtmMedium(
2893
2893
  context.visitorId,
@@ -2915,7 +2915,6 @@ var IKEmbeddableFormBundle = function(exports) {
2915
2915
  const { firstName, lastName } = resolveName(formData);
2916
2916
  const webinarType = resolveEffectiveWebinarType(formData, context.webinarType);
2917
2917
  return {
2918
- ...customerIdFields(context),
2919
2918
  "First Name": firstName,
2920
2919
  "Last Name": lastName,
2921
2920
  "Email Address": email(formData.email),
@@ -2995,7 +2994,6 @@ var IKEmbeddableFormBundle = function(exports) {
2995
2994
  const gaEventId = Date.now();
2996
2995
  const { firstName, lastName } = resolveName(formData);
2997
2996
  return {
2998
- ...customerIdFields(context),
2999
2997
  "First Name": firstName,
3000
2998
  "Last Name": lastName,
3001
2999
  "Email Address": email(formData.email),
@@ -3067,7 +3065,6 @@ var IKEmbeddableFormBundle = function(exports) {
3067
3065
  const linkedIn = str(formData.linkedIn).trim();
3068
3066
  const resumeBase64 = str(formData.resumeFileBase64).trim();
3069
3067
  return {
3070
- ...customerIdFields(context),
3071
3068
  Lead_Created_Time: formatLeadCreatedTime(formData.leadCreatedTime),
3072
3069
  Page_URL: encodeURIComponent(context.pageUrl),
3073
3070
  "First Name": firstName,
@@ -3190,10 +3187,6 @@ var IKEmbeddableFormBundle = function(exports) {
3190
3187
  return url.toString();
3191
3188
  }
3192
3189
  buildBody(contract, formData) {
3193
- const body = this.buildRawBody(contract, formData);
3194
- return { ...body, fingerprint_id: getFingerprintId() };
3195
- }
3196
- buildRawBody(contract, formData) {
3197
3190
  if (contract.payloadBuilder) {
3198
3191
  return buildPayload(contract.payloadBuilder, formData);
3199
3192
  }
@@ -3218,13 +3211,7 @@ var IKEmbeddableFormBundle = function(exports) {
3218
3211
  }
3219
3212
  async fetchWithRetry(url, init, retriesLeft, timeoutMs) {
3220
3213
  const controller = new AbortController();
3221
- let timedOut = false;
3222
- const timeoutId = setTimeout(() => {
3223
- timedOut = true;
3224
- controller.abort(
3225
- new DOMException(`Request timed out after ${timeoutMs}ms`, "TimeoutError")
3226
- );
3227
- }, timeoutMs);
3214
+ const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
3228
3215
  try {
3229
3216
  const res = await fetch(url, { ...init, signal: controller.signal });
3230
3217
  clearTimeout(timeoutId);
@@ -3241,21 +3228,13 @@ var IKEmbeddableFormBundle = function(exports) {
3241
3228
  return { data, status: res.status, ok: true };
3242
3229
  } catch (err) {
3243
3230
  clearTimeout(timeoutId);
3244
- const normalizedErr = timedOut ? this.buildTimeoutError(timeoutMs) : err;
3245
- if (retriesLeft > 1 && this.isRetryable(normalizedErr)) {
3231
+ if (retriesLeft > 1 && this.isRetryable(err)) {
3246
3232
  await this.delay(500 * (2 - retriesLeft));
3247
3233
  return this.fetchWithRetry(url, init, retriesLeft - 1, timeoutMs);
3248
3234
  }
3249
- throw normalizedErr;
3235
+ throw err;
3250
3236
  }
3251
3237
  }
3252
- buildTimeoutError(timeoutMs) {
3253
- return {
3254
- code: "TIMEOUT",
3255
- message: "This is taking longer than expected. Please try again.",
3256
- details: { timeoutMs }
3257
- };
3258
- }
3259
3238
  applyResponseMapping(mapping, response) {
3260
3239
  if (!mapping) return {};
3261
3240
  const result = {};
@@ -3271,7 +3250,7 @@ var IKEmbeddableFormBundle = function(exports) {
3271
3250
  if (err instanceof TypeError) return true;
3272
3251
  if (err && typeof err === "object" && "code" in err) {
3273
3252
  const code = err.code;
3274
- return code === "TIMEOUT" || code === "HTTP_429" || code === "HTTP_503" || code === "HTTP_502";
3253
+ return code === "HTTP_429" || code === "HTTP_503" || code === "HTTP_502";
3275
3254
  }
3276
3255
  return false;
3277
3256
  }
@@ -21616,49 +21595,10 @@ var IKEmbeddableFormBundle = function(exports) {
21616
21595
  }
21617
21596
  }
21618
21597
  };
21619
- const emailRegistrationVariant = {
21620
- id: "email-registration",
21621
- overrides: {
21622
- layout: {
21623
- leftPanel: {
21624
- progressGroups: [
21625
- {
21626
- number: 1,
21627
- title: "Webinar Registration",
21628
- stepIds: ["slot-selection"]
21629
- },
21630
- {
21631
- number: 2,
21632
- title: "Profile Details",
21633
- stepIds: ["profile-details", "goals-details"]
21634
- }
21635
- ]
21636
- },
21637
- rightPanel: {
21638
- progressGroups: [
21639
- { stepIds: ["slot-selection"] },
21640
- { stepIds: ["profile-details"] },
21641
- { stepIds: ["goals-details"] },
21642
- { stepIds: ["consultation-prefs"] }
21643
- ]
21644
- }
21645
- },
21646
- steps: {
21647
- // Lead is resolved from customer_id on the backend — skip contact collection.
21648
- "contact-details": { show: false },
21649
- "profile-details": {
21650
- fields: {
21651
- interviewTimeline: { show: false }
21652
- }
21653
- }
21654
- }
21655
- }
21656
- };
21657
21598
  const GQL_WEBINAR_VARIANTS = [
21658
21599
  defaultVariant,
21659
21600
  indiaVariant,
21660
- eventVariant,
21661
- emailRegistrationVariant
21601
+ eventVariant
21662
21602
  ];
21663
21603
  const gqlWebinarConfig = {
21664
21604
  ...gqlWebinarBaseConfig,
@@ -21822,7 +21762,7 @@ ${intlTelStyles}`;
21822
21762
  destroy();
21823
21763
  },
21824
21764
  getVersion() {
21825
- return "1.0.35";
21765
+ return "1.0.36";
21826
21766
  },
21827
21767
  /**
21828
21768
  * Allowlisted snapshot of everything the user has submitted so far.