@codebards/ik-embeddable-form 0.0.2765927162-qa → 0.0.2767921802-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
@@ -1348,11 +1348,233 @@ var IKEmbeddableFormBundle = function(exports) {
1348
1348
  const month = ((_c = MONTHS[date.getMonth()]) == null ? void 0 : _c.slice(0, 3)) ?? "";
1349
1349
  return `${weekday}, ${date.getDate()} ${month}`;
1350
1350
  }
1351
+ const defaultVariant = {
1352
+ id: "default",
1353
+ overrides: {
1354
+ steps: {
1355
+ "profile-details": {
1356
+ fields: {
1357
+ interviewTimeline: { show: false },
1358
+ topicOfInterest: { show: false }
1359
+ }
1360
+ }
1361
+ }
1362
+ }
1363
+ };
1364
+ const INDIA_EXPERIENCE_OPTIONS = [
1365
+ { value: "I’m currently a student", label: "I’m currently a student" },
1366
+ { value: "0-2", label: "0-2" },
1367
+ { value: "3-4", label: "3-4" },
1368
+ { value: "5-8", label: "5-8" },
1369
+ { value: "9-15", label: "9-15" },
1370
+ { value: "16-20", label: "16-20" },
1371
+ { value: "20+", label: "20+" }
1372
+ ];
1373
+ const INDIA_DOMAIN_OPTIONS = [
1374
+ { value: "Back-end", label: "Back-end" },
1375
+ { value: "Cloud Engineer", label: "Cloud Engineer" },
1376
+ { value: "Cyber Security", label: "Cyber Security" },
1377
+ { value: "Data Engineer", label: "Data Engineer" },
1378
+ { value: "Data Science", label: "Data Science" },
1379
+ { value: "Front-end", label: "Front-end" },
1380
+ { value: "Full Stack", label: "Full Stack" },
1381
+ { value: "Machine Learning / AI", label: "Machine Learning / AI" },
1382
+ { value: "Engineering Manager - any domain", label: "Engineering Manager - any domain" },
1383
+ { value: "Tech Product Manager", label: "Tech Product Manager" },
1384
+ { value: "Technical Program Manager", label: "Technical Program Manager" },
1385
+ { value: "Test Engineer / SDET / QE", label: "Test Engineer / SDET / QE" },
1386
+ { value: "Android Developer", label: "Android Developer" },
1387
+ { value: "iOS Developer", label: "iOS Developer" },
1388
+ { value: "Site Reliability Engineer", label: "Site Reliability Engineer" },
1389
+ { value: "Embedded Software Engineer", label: "Embedded Software Engineer" },
1390
+ { value: "Other Software Engineers", label: "Other Software Engineers" },
1391
+ { value: "Data Analyst / Business Analyst", label: "Data Analyst / Business Analyst" },
1392
+ { value: "Core Engineering", label: "Core Engineering" },
1393
+ { value: "Salesforce developer", label: "Salesforce developer" },
1394
+ { value: "DevOps Engineer", label: "DevOps Engineer" },
1395
+ { value: "None of the above", label: "None of the above" }
1396
+ ];
1397
+ const indiaVariant = {
1398
+ id: "india",
1399
+ overrides: {
1400
+ layout: {
1401
+ leftPanel: {
1402
+ progressGroups: [
1403
+ {
1404
+ number: 1,
1405
+ title: "Webinar Registration",
1406
+ stepIds: ["contact-details", "slot-selection"],
1407
+ // India skips goals-details, so this group stays blue through
1408
+ // profile-details and only completes on the expert-insights step.
1409
+ pendingOnStepIds: ["profile-details"]
1410
+ },
1411
+ {
1412
+ number: 2,
1413
+ title: "Profile Details",
1414
+ stepIds: ["profile-details"]
1415
+ }
1416
+ ]
1417
+ },
1418
+ rightPanel: {
1419
+ progressGroups: [
1420
+ { stepIds: ["contact-details"] },
1421
+ { stepIds: ["slot-selection"] },
1422
+ { stepIds: ["profile-details"] },
1423
+ { stepIds: ["consultation-prefs"] }
1424
+ ]
1425
+ }
1426
+ },
1427
+ steps: {
1428
+ "profile-details": {
1429
+ fields: {
1430
+ primaryGoal: { show: false },
1431
+ experience: { options: INDIA_EXPERIENCE_OPTIONS },
1432
+ domain: { options: INDIA_DOMAIN_OPTIONS },
1433
+ topicOfInterest: { show: true },
1434
+ interviewTimeline: { show: false }
1435
+ }
1436
+ },
1437
+ "goals-details": { show: false }
1438
+ }
1439
+ }
1440
+ };
1441
+ const eventVariant = {
1442
+ id: "event",
1443
+ overrides: {
1444
+ layout: {
1445
+ leftPanel: {
1446
+ data: {
1447
+ headline: "Register for the Event",
1448
+ subheadline: "Share your details to reserve your seat"
1449
+ },
1450
+ progressGroups: [
1451
+ {
1452
+ number: 1,
1453
+ title: "Webinar Registration",
1454
+ stepIds: ["contact-details", "slot-selection"]
1455
+ },
1456
+ {
1457
+ number: 2,
1458
+ title: "Profile Details",
1459
+ stepIds: ["profile-details"]
1460
+ }
1461
+ ]
1462
+ },
1463
+ rightPanel: {
1464
+ progressGroups: [
1465
+ { stepIds: ["contact-details"] },
1466
+ { stepIds: ["profile-details"] },
1467
+ { stepIds: ["consultation-prefs"] }
1468
+ ]
1469
+ }
1470
+ },
1471
+ steps: {
1472
+ "slot-selection": { show: false },
1473
+ "profile-details": {
1474
+ fields: {
1475
+ primaryGoal: { show: false },
1476
+ topicOfInterest: { show: false }
1477
+ }
1478
+ },
1479
+ "goals-details": { show: false }
1480
+ }
1481
+ }
1482
+ };
1483
+ const emailRegistrationVariant = {
1484
+ id: "email-registration",
1485
+ overrides: {
1486
+ layout: {
1487
+ leftPanel: {
1488
+ progressGroups: [
1489
+ {
1490
+ number: 1,
1491
+ title: "Webinar Registration",
1492
+ stepIds: ["slot-selection"]
1493
+ },
1494
+ {
1495
+ number: 2,
1496
+ title: "Profile Details",
1497
+ stepIds: ["profile-details", "goals-details"]
1498
+ }
1499
+ ]
1500
+ },
1501
+ rightPanel: {
1502
+ progressGroups: [
1503
+ { stepIds: ["slot-selection"] },
1504
+ { stepIds: ["profile-details"] },
1505
+ { stepIds: ["goals-details"] },
1506
+ { stepIds: ["consultation-prefs"] }
1507
+ ]
1508
+ }
1509
+ },
1510
+ steps: {
1511
+ // Lead is resolved from customer_id on the backend — skip contact collection.
1512
+ "contact-details": { show: false },
1513
+ "profile-details": {
1514
+ fields: {
1515
+ interviewTimeline: { show: false }
1516
+ }
1517
+ }
1518
+ }
1519
+ }
1520
+ };
1521
+ const noSlotVariant = {
1522
+ id: "no-slot",
1523
+ overrides: {
1524
+ layout: {
1525
+ leftPanel: {
1526
+ progressGroups: [
1527
+ {
1528
+ number: 1,
1529
+ title: "Webinar Registration",
1530
+ stepIds: ["contact-details"]
1531
+ },
1532
+ {
1533
+ number: 2,
1534
+ title: "Profile Details",
1535
+ stepIds: ["profile-details", "goals-details"]
1536
+ }
1537
+ ]
1538
+ },
1539
+ rightPanel: {
1540
+ progressGroups: [
1541
+ { stepIds: ["contact-details"] },
1542
+ { stepIds: ["profile-details"] },
1543
+ { stepIds: ["goals-details"] },
1544
+ { stepIds: ["consultation-prefs"] }
1545
+ ]
1546
+ }
1547
+ },
1548
+ steps: {
1549
+ // No slot step downstream, so there is nothing to fetch slots for.
1550
+ "contact-details": { beforeNext: "none" },
1551
+ "slot-selection": { show: false },
1552
+ "profile-details": {
1553
+ fields: {
1554
+ interviewTimeline: { show: false },
1555
+ topicOfInterest: { show: false }
1556
+ }
1557
+ }
1558
+ }
1559
+ }
1560
+ };
1561
+ const GQL_WEBINAR_VARIANTS = [
1562
+ defaultVariant,
1563
+ indiaVariant,
1564
+ eventVariant,
1565
+ emailRegistrationVariant,
1566
+ noSlotVariant
1567
+ ];
1568
+ const SLOTLESS_VARIANT_IDS = [noSlotVariant.id];
1569
+ function isSlotlessVariant(variantId) {
1570
+ return variantId != null && SLOTLESS_VARIANT_IDS.includes(variantId);
1571
+ }
1351
1572
  let contextInstance = null;
1352
1573
  let initPromise = null;
1353
1574
  let slotsPrefetchPromise = null;
1354
1575
  function startSlotsPrefetch(openConfig) {
1355
1576
  if (slotsPrefetchPromise) return;
1577
+ if (isSlotlessVariant(openConfig.variant)) return;
1356
1578
  const webinarType = openConfig.webinarType || "REGULAR";
1357
1579
  slotsPrefetchPromise = fetchWebinarSlots(webinarType, openConfig);
1358
1580
  }
@@ -2313,15 +2535,15 @@ var IKEmbeddableFormBundle = function(exports) {
2313
2535
  this.setState({ isSubmitting: true, error: null });
2314
2536
  try {
2315
2537
  await this.runBeforeNext(currentStep);
2316
- if (currentStep.id === "profile-details" && !this.state.formData.hasSlotBooked) {
2538
+ if (currentStep.id === "profile-details" && !this.state.formData.hasSlotBooked && this.hasSlotBookingStep()) {
2317
2539
  await this.slotBookingPromise;
2318
- }
2319
- if (currentStep.id === "profile-details" && !this.state.formData.hasSlotBooked) {
2320
- throw {
2321
- code: "SLOT_NOT_BOOKED",
2322
- message: "Unable to reserve your event slot. Please try again.",
2323
- stepId: currentStep.id
2324
- };
2540
+ if (!this.state.formData.hasSlotBooked) {
2541
+ throw {
2542
+ code: "SLOT_NOT_BOOKED",
2543
+ message: "Unable to reserve your event slot. Please try again.",
2544
+ stepId: currentStep.id
2545
+ };
2546
+ }
2325
2547
  }
2326
2548
  if (currentStep.id === "slot-selection") {
2327
2549
  validateAndLogSlotTime(String(this.state.formData.eventStartTime ?? ""), {
@@ -2502,6 +2724,23 @@ var IKEmbeddableFormBundle = function(exports) {
2502
2724
  needsSlotsPrefetch() {
2503
2725
  return this.config.steps.some((step) => step.beforeNext === "fetch-slots");
2504
2726
  }
2727
+ /**
2728
+ * True when the resolved flow still books a slot — either the picker step or the
2729
+ * background auto-book step survived variant merging.
2730
+ *
2731
+ * Slotless variants (`no-slot`) drop both, so `hasSlotBooked` is never set for them
2732
+ * and the gate leaving `profile-details` must not apply. Read off the resolved steps
2733
+ * rather than the variant id so remote/host overrides that remove the slot flow
2734
+ * behave the same way.
2735
+ */
2736
+ hasSlotBookingStep() {
2737
+ return this.stepResolver.resolveVisibleSteps(this.config.steps, this.state.formData).some(
2738
+ (step) => {
2739
+ var _a;
2740
+ return step.id === "slot-selection" || ((_a = step.autoExecute) == null ? void 0 : _a.action) === "book-webinar-slot";
2741
+ }
2742
+ );
2743
+ }
2505
2744
  startSlotsPrefetch() {
2506
2745
  if (!this.needsSlotsPrefetch() || this.slotsPrefetchPromise) return;
2507
2746
  this.patchFormData({ slotsLoading: true });
@@ -2560,10 +2799,10 @@ var IKEmbeddableFormBundle = function(exports) {
2560
2799
  }
2561
2800
  }
2562
2801
  async runBeforeNext(step) {
2563
- if (step.beforeNext !== "fetch-slots") return;
2564
2802
  const { phone } = this.state.formData;
2565
2803
  const phoneNumberFull = String(this.state.formData.phoneNumberFull ?? phone ?? "");
2566
2804
  this.mergeFormData({ phoneNumberFull });
2805
+ if (step.beforeNext !== "fetch-slots") return;
2567
2806
  await this.ensureSlotsReady(step);
2568
2807
  }
2569
2808
  async runStepSuccess(step, response) {
@@ -21874,182 +22113,6 @@ var IKEmbeddableFormBundle = function(exports) {
21874
22113
  }
21875
22114
  ]
21876
22115
  };
21877
- const defaultVariant = {
21878
- id: "default",
21879
- overrides: {
21880
- steps: {
21881
- "profile-details": {
21882
- fields: {
21883
- interviewTimeline: { show: false },
21884
- topicOfInterest: { show: false }
21885
- }
21886
- }
21887
- }
21888
- }
21889
- };
21890
- const INDIA_EXPERIENCE_OPTIONS = [
21891
- { value: "I’m currently a student", label: "I’m currently a student" },
21892
- { value: "0-2", label: "0-2" },
21893
- { value: "3-4", label: "3-4" },
21894
- { value: "5-8", label: "5-8" },
21895
- { value: "9-15", label: "9-15" },
21896
- { value: "16-20", label: "16-20" },
21897
- { value: "20+", label: "20+" }
21898
- ];
21899
- const INDIA_DOMAIN_OPTIONS = [
21900
- { value: "Back-end", label: "Back-end" },
21901
- { value: "Cloud Engineer", label: "Cloud Engineer" },
21902
- { value: "Cyber Security", label: "Cyber Security" },
21903
- { value: "Data Engineer", label: "Data Engineer" },
21904
- { value: "Data Science", label: "Data Science" },
21905
- { value: "Front-end", label: "Front-end" },
21906
- { value: "Full Stack", label: "Full Stack" },
21907
- { value: "Machine Learning / AI", label: "Machine Learning / AI" },
21908
- { value: "Engineering Manager - any domain", label: "Engineering Manager - any domain" },
21909
- { value: "Tech Product Manager", label: "Tech Product Manager" },
21910
- { value: "Technical Program Manager", label: "Technical Program Manager" },
21911
- { value: "Test Engineer / SDET / QE", label: "Test Engineer / SDET / QE" },
21912
- { value: "Android Developer", label: "Android Developer" },
21913
- { value: "iOS Developer", label: "iOS Developer" },
21914
- { value: "Site Reliability Engineer", label: "Site Reliability Engineer" },
21915
- { value: "Embedded Software Engineer", label: "Embedded Software Engineer" },
21916
- { value: "Other Software Engineers", label: "Other Software Engineers" },
21917
- { value: "Data Analyst / Business Analyst", label: "Data Analyst / Business Analyst" },
21918
- { value: "Core Engineering", label: "Core Engineering" },
21919
- { value: "Salesforce developer", label: "Salesforce developer" },
21920
- { value: "DevOps Engineer", label: "DevOps Engineer" },
21921
- { value: "None of the above", label: "None of the above" }
21922
- ];
21923
- const indiaVariant = {
21924
- id: "india",
21925
- overrides: {
21926
- layout: {
21927
- leftPanel: {
21928
- progressGroups: [
21929
- {
21930
- number: 1,
21931
- title: "Webinar Registration",
21932
- stepIds: ["contact-details", "slot-selection"],
21933
- // India skips goals-details, so this group stays blue through
21934
- // profile-details and only completes on the expert-insights step.
21935
- pendingOnStepIds: ["profile-details"]
21936
- },
21937
- {
21938
- number: 2,
21939
- title: "Profile Details",
21940
- stepIds: ["profile-details"]
21941
- }
21942
- ]
21943
- },
21944
- rightPanel: {
21945
- progressGroups: [
21946
- { stepIds: ["contact-details"] },
21947
- { stepIds: ["slot-selection"] },
21948
- { stepIds: ["profile-details"] },
21949
- { stepIds: ["consultation-prefs"] }
21950
- ]
21951
- }
21952
- },
21953
- steps: {
21954
- "profile-details": {
21955
- fields: {
21956
- primaryGoal: { show: false },
21957
- experience: { options: INDIA_EXPERIENCE_OPTIONS },
21958
- domain: { options: INDIA_DOMAIN_OPTIONS },
21959
- topicOfInterest: { show: true },
21960
- interviewTimeline: { show: false }
21961
- }
21962
- },
21963
- "goals-details": { show: false }
21964
- }
21965
- }
21966
- };
21967
- const eventVariant = {
21968
- id: "event",
21969
- overrides: {
21970
- layout: {
21971
- leftPanel: {
21972
- data: {
21973
- headline: "Register for the Event",
21974
- subheadline: "Share your details to reserve your seat"
21975
- },
21976
- progressGroups: [
21977
- {
21978
- number: 1,
21979
- title: "Webinar Registration",
21980
- stepIds: ["contact-details", "slot-selection"]
21981
- },
21982
- {
21983
- number: 2,
21984
- title: "Profile Details",
21985
- stepIds: ["profile-details"]
21986
- }
21987
- ]
21988
- },
21989
- rightPanel: {
21990
- progressGroups: [
21991
- { stepIds: ["contact-details"] },
21992
- { stepIds: ["profile-details"] },
21993
- { stepIds: ["consultation-prefs"] }
21994
- ]
21995
- }
21996
- },
21997
- steps: {
21998
- "slot-selection": { show: false },
21999
- "profile-details": {
22000
- fields: {
22001
- primaryGoal: { show: false },
22002
- topicOfInterest: { show: false }
22003
- }
22004
- },
22005
- "goals-details": { show: false }
22006
- }
22007
- }
22008
- };
22009
- const emailRegistrationVariant = {
22010
- id: "email-registration",
22011
- overrides: {
22012
- layout: {
22013
- leftPanel: {
22014
- progressGroups: [
22015
- {
22016
- number: 1,
22017
- title: "Webinar Registration",
22018
- stepIds: ["slot-selection"]
22019
- },
22020
- {
22021
- number: 2,
22022
- title: "Profile Details",
22023
- stepIds: ["profile-details", "goals-details"]
22024
- }
22025
- ]
22026
- },
22027
- rightPanel: {
22028
- progressGroups: [
22029
- { stepIds: ["slot-selection"] },
22030
- { stepIds: ["profile-details"] },
22031
- { stepIds: ["goals-details"] },
22032
- { stepIds: ["consultation-prefs"] }
22033
- ]
22034
- }
22035
- },
22036
- steps: {
22037
- // Lead is resolved from customer_id on the backend — skip contact collection.
22038
- "contact-details": { show: false },
22039
- "profile-details": {
22040
- fields: {
22041
- interviewTimeline: { show: false }
22042
- }
22043
- }
22044
- }
22045
- }
22046
- };
22047
- const GQL_WEBINAR_VARIANTS = [
22048
- defaultVariant,
22049
- indiaVariant,
22050
- eventVariant,
22051
- emailRegistrationVariant
22052
- ];
22053
22116
  const gqlWebinarConfig = {
22054
22117
  ...gqlWebinarBaseConfig,
22055
22118
  variants: GQL_WEBINAR_VARIANTS