@codebards/ik-embeddable-form 0.0.2677938746-qa → 0.0.2678487150-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
@@ -1,5 +1,8 @@
1
1
  var IKEmbeddableFormBundle = function(exports) {
2
2
  "use strict";
3
+ function logWebinarType(source, data = {}) {
4
+ console.log(`[IKForm][webinarType] ${source}`, data);
5
+ }
3
6
  var n, l$1, u$2, i$1, r$1, o$1, e$1, f$2, c$1, a$1, s$1, h$1, p$1, v$1, y$1, d$1 = {}, w$2 = [], _$1 = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, g$2 = Array.isArray;
4
7
  function m$1(n2, l2) {
5
8
  for (var u2 in l2) n2[u2] = l2[u2];
@@ -851,9 +854,26 @@ var IKEmbeddableFormBundle = function(exports) {
851
854
  };
852
855
  function resolveWebinarTypeFromPrimaryGoal(primaryGoal, currentWebinarType) {
853
856
  const goal = primaryGoal.trim();
854
- if (!goal || goal === "exploring") return currentWebinarType;
857
+ if (!goal || goal === "exploring") {
858
+ logWebinarType("qualifier.resolveFromPrimaryGoal (unchanged)", {
859
+ primaryGoal: goal,
860
+ webinarType: currentWebinarType
861
+ });
862
+ return currentWebinarType;
863
+ }
855
864
  const mapped = PRIMARY_GOAL_WEBINAR_TYPE[goal];
856
- if (mapped === null || mapped === void 0) return currentWebinarType;
865
+ if (mapped === null || mapped === void 0) {
866
+ logWebinarType("qualifier.resolveFromPrimaryGoal (no mapping)", {
867
+ primaryGoal: goal,
868
+ webinarType: currentWebinarType
869
+ });
870
+ return currentWebinarType;
871
+ }
872
+ logWebinarType("qualifier.resolveFromPrimaryGoal (mapped)", {
873
+ primaryGoal: goal,
874
+ from: currentWebinarType,
875
+ webinarType: mapped
876
+ });
857
877
  return mapped;
858
878
  }
859
879
  function resolveLandingWebinarType(formData, fallbackWebinarType) {
@@ -866,11 +886,29 @@ var IKEmbeddableFormBundle = function(exports) {
866
886
  const primaryGoal = String(formData.primaryGoal ?? "").trim();
867
887
  if (!primaryGoal) {
868
888
  const assigned = formData.assignedWebinarType;
869
- if (assigned != null && String(assigned).trim()) return String(assigned);
870
- return resolveLandingWebinarType(formData, fallbackWebinarType);
889
+ if (assigned != null && String(assigned).trim()) {
890
+ logWebinarType("qualifier.resolveEffective (assigned)", {
891
+ webinarType: String(assigned),
892
+ fallbackWebinarType
893
+ });
894
+ return String(assigned);
895
+ }
896
+ const landing = resolveLandingWebinarType(formData, fallbackWebinarType);
897
+ logWebinarType("qualifier.resolveEffective (landing)", {
898
+ webinarType: landing,
899
+ fallbackWebinarType
900
+ });
901
+ return landing;
871
902
  }
872
903
  const landingType = resolveLandingWebinarType(formData, fallbackWebinarType);
873
- return resolveWebinarTypeFromPrimaryGoal(primaryGoal, landingType);
904
+ const resolved = resolveWebinarTypeFromPrimaryGoal(primaryGoal, landingType);
905
+ logWebinarType("qualifier.resolveEffective (with goal)", {
906
+ primaryGoal,
907
+ landingType,
908
+ webinarType: resolved,
909
+ fallbackWebinarType
910
+ });
911
+ return resolved;
874
912
  }
875
913
  class StepResolver {
876
914
  resolveVisibleSteps(steps, formData) {
@@ -1239,10 +1277,12 @@ var IKEmbeddableFormBundle = function(exports) {
1239
1277
  let slotsPrefetchPromise = null;
1240
1278
  function startSlotsPrefetch(openConfig) {
1241
1279
  if (slotsPrefetchPromise) return;
1242
- slotsPrefetchPromise = fetchWebinarSlots(
1243
- openConfig.webinarType || "REGULAR",
1244
- openConfig
1245
- );
1280
+ const webinarType = openConfig.webinarType || "REGULAR";
1281
+ logWebinarType("startSlotsPrefetch", {
1282
+ webinarType,
1283
+ openConfigWebinarType: openConfig.webinarType
1284
+ });
1285
+ slotsPrefetchPromise = fetchWebinarSlots(webinarType, openConfig);
1246
1286
  }
1247
1287
  function getSlotsPrefetchPromise() {
1248
1288
  return slotsPrefetchPromise;
@@ -1271,7 +1311,7 @@ var IKEmbeddableFormBundle = function(exports) {
1271
1311
  openConfig,
1272
1312
  vCountry,
1273
1313
  vCountryCode,
1274
- userTimezone: browserTz || geo.timezone,
1314
+ userTimezone: geo.timezone || browserTz,
1275
1315
  city: geo.city ?? "",
1276
1316
  region: geo.region ?? "",
1277
1317
  device: getDeviceType(),
@@ -1284,6 +1324,13 @@ var IKEmbeddableFormBundle = function(exports) {
1284
1324
  isExitIntentPopup: openConfig.isExitIntentPopup ?? false,
1285
1325
  ready: true
1286
1326
  };
1327
+ logWebinarType("initWebinarContext", {
1328
+ webinarType: contextInstance.webinarType,
1329
+ openConfigWebinarType: openConfig.webinarType,
1330
+ vCountry: contextInstance.vCountry,
1331
+ vCountryCode: contextInstance.vCountryCode,
1332
+ userTimezone: contextInstance.userTimezone
1333
+ });
1287
1334
  setClarityContext(attribution.visitorId);
1288
1335
  setUserContext(attribution.visitorId);
1289
1336
  startSlotsPrefetch(openConfig);
@@ -1410,16 +1457,35 @@ var IKEmbeddableFormBundle = function(exports) {
1410
1457
  type: webinarType
1411
1458
  });
1412
1459
  const url = `${base}/api/webinar-slot/upcoming-slots/?${params.toString()}`;
1460
+ logWebinarType("fetchSlotsFromApi request", {
1461
+ webinarType,
1462
+ country,
1463
+ timezone,
1464
+ url
1465
+ });
1413
1466
  const headers = { Accept: "application/json" };
1414
1467
  {
1415
1468
  headers.Authorization = "1Cgx6oYXkOlWkNDn7_tXO";
1416
1469
  }
1417
1470
  const res = await fetch(url, { method: "GET", headers });
1418
1471
  if (!res.ok) {
1472
+ logWebinarType("fetchSlotsFromApi failed", {
1473
+ webinarType,
1474
+ country,
1475
+ status: res.status,
1476
+ url
1477
+ });
1419
1478
  throw new Error(`Slot API failed: ${res.status}`);
1420
1479
  }
1421
1480
  const data = await res.json();
1422
- return Array.isArray(data) ? data : [];
1481
+ const slots = Array.isArray(data) ? data : [];
1482
+ logWebinarType("fetchSlotsFromApi response", {
1483
+ webinarType,
1484
+ country,
1485
+ timezone,
1486
+ count: slots.length
1487
+ });
1488
+ return slots;
1423
1489
  }
1424
1490
  function getStaticSlots(openConfig) {
1425
1491
  const custom = openConfig == null ? void 0 : openConfig.staticSlots;
@@ -1449,11 +1515,29 @@ var IKEmbeddableFormBundle = function(exports) {
1449
1515
  const country = resolveSlotApiCountry(openConfig, slotApiConfig);
1450
1516
  const timezone = resolveSlotApiTimezone();
1451
1517
  const l2Type = (slotApiConfig == null ? void 0 : slotApiConfig.fallbackType) ?? "REGULAR";
1518
+ logWebinarType("fetchWebinarSlots start", {
1519
+ webinarType,
1520
+ l2FallbackType: l2Type,
1521
+ country,
1522
+ timezone,
1523
+ openConfigWebinarType: openConfig == null ? void 0 : openConfig.webinarType,
1524
+ slotApiCountryOverride: (openConfig == null ? void 0 : openConfig.slotApiCountry) ?? (slotApiConfig == null ? void 0 : slotApiConfig.country)
1525
+ });
1452
1526
  try {
1453
1527
  const l1 = limitDisplaySlots(
1454
1528
  filterFutureSlots(await fetchSlotsFromApi(country, webinarType, timezone))
1455
1529
  );
1530
+ logWebinarType("fetchWebinarSlots L1 result", {
1531
+ webinarType,
1532
+ country,
1533
+ count: l1.length
1534
+ });
1456
1535
  if (l1.length > 0) {
1536
+ logWebinarType("fetchWebinarSlots using L1", {
1537
+ assignedWebinarType: webinarType,
1538
+ source: "api-l1",
1539
+ count: l1.length
1540
+ });
1457
1541
  return {
1458
1542
  slots: l1.map(apiSlotToWebinarSlot),
1459
1543
  rawSlots: l1,
@@ -1464,7 +1548,18 @@ var IKEmbeddableFormBundle = function(exports) {
1464
1548
  const l2 = limitDisplaySlots(
1465
1549
  filterFutureSlots(await fetchSlotsFromApi(country, l2Type, timezone))
1466
1550
  );
1551
+ logWebinarType("fetchWebinarSlots L2 result", {
1552
+ webinarType: l2Type,
1553
+ country,
1554
+ count: l2.length,
1555
+ reason: "L1 empty — falling back"
1556
+ });
1467
1557
  if (l2.length > 0) {
1558
+ logWebinarType("fetchWebinarSlots using L2", {
1559
+ assignedWebinarType: "REGULAR",
1560
+ source: "api-l2",
1561
+ count: l2.length
1562
+ });
1468
1563
  return {
1469
1564
  slots: l2.map(apiSlotToWebinarSlot),
1470
1565
  rawSlots: l2,
@@ -1472,12 +1567,22 @@ var IKEmbeddableFormBundle = function(exports) {
1472
1567
  source: "api-l2"
1473
1568
  };
1474
1569
  }
1475
- } catch {
1570
+ } catch (err) {
1571
+ logWebinarType("fetchWebinarSlots API error — static fallback", {
1572
+ webinarType,
1573
+ country,
1574
+ error: err instanceof Error ? err.message : String(err)
1575
+ });
1476
1576
  }
1477
1577
  const staticSlots = filterFutureSlots(getStaticSlots(openConfig));
1478
1578
  const fallback = limitDisplaySlots(
1479
1579
  staticSlots.length > 0 ? staticSlots : filterFutureSlots(createFutureStaticSlots())
1480
1580
  );
1581
+ logWebinarType("fetchWebinarSlots using static", {
1582
+ assignedWebinarType: webinarType,
1583
+ source: "static",
1584
+ count: fallback.length
1585
+ });
1481
1586
  return {
1482
1587
  slots: fallback.map(apiSlotToWebinarSlot),
1483
1588
  rawSlots: fallback,
@@ -1658,6 +1763,12 @@ var IKEmbeddableFormBundle = function(exports) {
1658
1763
  const webinarLeadType = String(
1659
1764
  formData.webinarLeadType ?? formData.assignedWebinarType ?? webinarType
1660
1765
  );
1766
+ logWebinarType("clickstream.leadPayload", {
1767
+ webinarType,
1768
+ webinarLeadType,
1769
+ assignedWebinarType: formData.assignedWebinarType,
1770
+ contextWebinarType: ctx == null ? void 0 : ctx.webinarType
1771
+ });
1661
1772
  return {
1662
1773
  Lead_Created_Time: leadCreatedTime,
1663
1774
  Lead_Name: leadName,
@@ -2089,6 +2200,12 @@ var IKEmbeddableFormBundle = function(exports) {
2089
2200
  });
2090
2201
  }
2091
2202
  async loadSlotsIntoFormData() {
2203
+ var _a;
2204
+ logWebinarType("FormEngine.loadSlotsIntoFormData", {
2205
+ webinarType: this.openConfig.webinarType,
2206
+ configWebinarType: this.config.webinarType,
2207
+ fallbackType: (_a = this.config.slotApi) == null ? void 0 : _a.fallbackType
2208
+ });
2092
2209
  const result = await fetchWebinarSlots(
2093
2210
  this.openConfig.webinarType,
2094
2211
  this.openConfig,
@@ -2097,6 +2214,12 @@ var IKEmbeddableFormBundle = function(exports) {
2097
2214
  this.applySlotFetchResult(result);
2098
2215
  }
2099
2216
  applySlotFetchResult(result) {
2217
+ logWebinarType("FormEngine.applySlotFetchResult", {
2218
+ assignedWebinarType: result.assignedWebinarType,
2219
+ source: result.source,
2220
+ slotCount: result.slots.length,
2221
+ openConfigWebinarType: this.openConfig.webinarType
2222
+ });
2100
2223
  this.mergeFormData({
2101
2224
  slots: result.slots,
2102
2225
  assignedWebinarType: result.assignedWebinarType,
@@ -2200,6 +2323,12 @@ var IKEmbeddableFormBundle = function(exports) {
2200
2323
  );
2201
2324
  const primaryGoal = String(this.state.formData.primaryGoal ?? "");
2202
2325
  const newType = resolveWebinarTypeFromPrimaryGoal(primaryGoal, oldType);
2326
+ logWebinarType("FormEngine.qualifier remap", {
2327
+ oldType,
2328
+ primaryGoal,
2329
+ newType,
2330
+ openConfigWebinarType: this.openConfig.webinarType
2331
+ });
2203
2332
  this.mergeFormData({
2204
2333
  assignedWebinarType: newType,
2205
2334
  qualifierOldWebinarType: oldType
@@ -2404,9 +2533,15 @@ var IKEmbeddableFormBundle = function(exports) {
2404
2533
  return visible[0];
2405
2534
  }
2406
2535
  buildInitialFormData() {
2536
+ const originalLandingWebinarType = this.openConfig.webinarType ?? this.config.webinarType ?? "REGULAR";
2537
+ logWebinarType("FormEngine.buildInitialFormData", {
2538
+ originalLandingWebinarType,
2539
+ openConfigWebinarType: this.openConfig.webinarType,
2540
+ configWebinarType: this.config.webinarType
2541
+ });
2407
2542
  const data = {
2408
2543
  _variant: this.openConfig.variant ?? this.config.defaultVariant,
2409
- originalLandingWebinarType: this.openConfig.webinarType ?? this.config.webinarType ?? "REGULAR"
2544
+ originalLandingWebinarType
2410
2545
  };
2411
2546
  if (this.openConfig.prefilledValues) {
2412
2547
  Object.assign(data, this.openConfig.prefilledValues);
@@ -2569,6 +2704,11 @@ var IKEmbeddableFormBundle = function(exports) {
2569
2704
  const utm = context.utm;
2570
2705
  const { firstName, lastName } = resolveName(formData);
2571
2706
  const webinarType = resolveEffectiveWebinarType(formData, context.webinarType);
2707
+ logWebinarType("payloads.buildRegisterPayload", {
2708
+ webinarType,
2709
+ contextWebinarType: context.webinarType,
2710
+ assignedWebinarType: formData.assignedWebinarType
2711
+ });
2572
2712
  return {
2573
2713
  "First Name": firstName,
2574
2714
  "Last Name": lastName,
@@ -2616,9 +2756,18 @@ var IKEmbeddableFormBundle = function(exports) {
2616
2756
  function resolveProfileApiFields(formData, context) {
2617
2757
  const experience = str(formData.experience);
2618
2758
  const isStudent = experience === "student" || experience.toLowerCase().includes("student") || bool(formData.isStudent);
2759
+ const webinarType = resolveEffectiveWebinarType(formData, context.webinarType);
2760
+ const oldWebinarType = resolveLandingWebinarType(formData, context.webinarType);
2761
+ logWebinarType("payloads.resolveProfileApiFields", {
2762
+ webinarType,
2763
+ oldWebinarType,
2764
+ contextWebinarType: context.webinarType,
2765
+ assignedWebinarType: formData.assignedWebinarType,
2766
+ primaryGoal: formData.primaryGoal
2767
+ });
2619
2768
  return {
2620
- "webinar-type": resolveEffectiveWebinarType(formData, context.webinarType),
2621
- "old-webinar-type": resolveLandingWebinarType(formData, context.webinarType),
2769
+ "webinar-type": webinarType,
2770
+ "old-webinar-type": oldWebinarType,
2622
2771
  primary_goal: resolvePrimaryGoalForApi(str(formData.primaryGoal)),
2623
2772
  "Work Experience": normalizeExperienceForApi(experience),
2624
2773
  "Role Domain": resolveDomainForApi(str(formData.domain)),
@@ -6909,6 +7058,12 @@ var IKEmbeddableFormBundle = function(exports) {
6909
7058
  getResolveContext(openConfig) {
6910
7059
  const webinarType = openConfig.webinarType || "REGULAR";
6911
7060
  const base = this.findBaseConfig(webinarType);
7061
+ logWebinarType("ConfigResolver.getResolveContext", {
7062
+ webinarType,
7063
+ openConfigWebinarType: openConfig.webinarType,
7064
+ resolvedBaseWebinarType: base == null ? void 0 : base.webinarType,
7065
+ registeredTypes: Object.keys(this.registry)
7066
+ });
6912
7067
  if (!base) {
6913
7068
  throw new Error(
6914
7069
  `[ConfigResolver] No config found for webinarType "${webinarType}". Registered types: ${Object.keys(this.registry).join(", ")}`
@@ -6920,6 +7075,12 @@ var IKEmbeddableFormBundle = function(exports) {
6920
7075
  buildResolvedConfig(base, openConfig, requestedVariantId, effectiveVariantId, overrides) {
6921
7076
  let resolved = this.deepClone(base);
6922
7077
  resolved.webinarType = openConfig.webinarType || "REGULAR";
7078
+ logWebinarType("ConfigResolver.buildResolvedConfig", {
7079
+ resolvedWebinarType: resolved.webinarType,
7080
+ openConfigWebinarType: openConfig.webinarType,
7081
+ baseWebinarType: base.webinarType,
7082
+ effectiveVariantId
7083
+ });
6923
7084
  const layeredOverrides = mergeOverrideSpecs(
6924
7085
  overrides,
6925
7086
  openConfig.configOverrides
@@ -20601,6 +20762,13 @@ ${intlTelStyles}`;
20601
20762
  if (isOpen) {
20602
20763
  unmount();
20603
20764
  }
20765
+ logWebinarType("IKForm.open()", {
20766
+ webinarType: config.webinarType,
20767
+ eventName: config.eventName,
20768
+ variant: config.variant,
20769
+ site: config.site,
20770
+ slotApiCountry: config.slotApiCountry
20771
+ });
20604
20772
  if (config.displayMode === "inline" && !config.container) {
20605
20773
  console.error('IKForm.open: container is required when displayMode is "inline"');
20606
20774
  (_a = config.onError) == null ? void 0 : _a.call(config, { code: "INVALID_CONFIG", message: "container is required for inline displayMode" });
@@ -20638,7 +20806,7 @@ ${intlTelStyles}`;
20638
20806
  destroy();
20639
20807
  },
20640
20808
  getVersion() {
20641
- return "1.0.22";
20809
+ return "1.0.23";
20642
20810
  }
20643
20811
  };
20644
20812
  if (typeof window !== "undefined") {