@codebards/ik-embeddable-form 0.0.2717298569-qa → 0.0.2720792320-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
@@ -119,6 +119,9 @@ var IKEmbeddableFormBundle = function(exports) {
119
119
  function isPrimitive$1(value) {
120
120
  return typeof value === "string" || typeof value === "number" || typeof value === "boolean";
121
121
  }
122
+ function toSnakeCase(key) {
123
+ return key.replace(/([A-Z]+)([A-Z][a-z])/g, "$1_$2").replace(/([a-z0-9])([A-Z])/g, "$1_$2").toLowerCase();
124
+ }
122
125
  function buildFormValues(formData, labels = {}, fields = ANALYTICS_VALUE_FIELDS) {
123
126
  const snapshot = {};
124
127
  fields.forEach((key) => {
@@ -126,9 +129,10 @@ var IKEmbeddableFormBundle = function(exports) {
126
129
  const value = formData[key];
127
130
  if (value === void 0 || value === null || value === "") return;
128
131
  if (!isPrimitive$1(value)) return;
129
- snapshot[key] = value;
132
+ const snakeKey = toSnakeCase(key);
133
+ snapshot[snakeKey] = value;
130
134
  const label = (_a = labels[key]) == null ? void 0 : _a[String(value)];
131
- if (label) snapshot[`${key}_label`] = label;
135
+ if (label) snapshot[`${snakeKey}_label`] = label;
132
136
  });
133
137
  return snapshot;
134
138
  }
@@ -2016,8 +2020,8 @@ var IKEmbeddableFormBundle = function(exports) {
2016
2020
  return this.config;
2017
2021
  }
2018
2022
  /**
2019
- * Allowlisted snapshot of the values captured so far, with `<field>_label`
2020
- * companions for select fields.
2023
+ * Allowlisted snapshot of the values captured so far, keyed in snake_case,
2024
+ * with `<field>_label` companions for select fields.
2021
2025
  *
2022
2026
  * This is the supported replacement for scraping the DOM: the profile fields
2023
2027
  * live in a shadow root and are unmounted once the user proceeds, so
@@ -7021,7 +7025,7 @@ var IKEmbeddableFormBundle = function(exports) {
7021
7025
  const booleanType = ZodBoolean.create;
7022
7026
  const unknownType = ZodUnknown.create;
7023
7027
  ZodNever.create;
7024
- ZodArray.create;
7028
+ const arrayType = ZodArray.create;
7025
7029
  const objectType = ZodObject.create;
7026
7030
  const unionType = ZodUnion.create;
7027
7031
  ZodIntersection.create;
@@ -7031,8 +7035,17 @@ var IKEmbeddableFormBundle = function(exports) {
7031
7035
  ZodPromise.create;
7032
7036
  ZodOptional.create;
7033
7037
  ZodNullable.create;
7038
+ const fieldOptionSchema = objectType({
7039
+ label: stringType(),
7040
+ value: stringType(),
7041
+ disabled: booleanType().optional(),
7042
+ icon: stringType().optional(),
7043
+ metadata: recordType(unknownType()).optional()
7044
+ });
7034
7045
  const fieldOverrideSchema = objectType({
7035
- show: booleanType().optional()
7046
+ show: booleanType().optional(),
7047
+ /** Replaces the base field's option list wholesale */
7048
+ options: arrayType(fieldOptionSchema).optional()
7036
7049
  }).passthrough();
7037
7050
  const stepOverrideSchema = objectType({
7038
7051
  show: booleanType().optional(),
@@ -7055,12 +7068,12 @@ var IKEmbeddableFormBundle = function(exports) {
7055
7068
  id: stringType(),
7056
7069
  overrides: variantOverrideSpecSchema
7057
7070
  });
7058
- const remoteVariantFileSchema = unionType([
7059
- remoteVariantEnvelopeSchema,
7060
- variantOverrideSpecSchema
7061
- ]);
7071
+ function isEnvelopeShape(raw) {
7072
+ return typeof raw === "object" && raw !== null && "overrides" in raw;
7073
+ }
7062
7074
  function parseRemoteVariantJson(raw, expectedVariantId) {
7063
- const parsed = remoteVariantFileSchema.safeParse(raw);
7075
+ const schema = isEnvelopeShape(raw) ? remoteVariantEnvelopeSchema : variantOverrideSpecSchema;
7076
+ const parsed = schema.safeParse(raw);
7064
7077
  if (!parsed.success) {
7065
7078
  console.warn(
7066
7079
  `[ConfigResolver] Invalid remote variant JSON for "${expectedVariantId}":`,
@@ -20678,6 +20691,38 @@ var IKEmbeddableFormBundle = function(exports) {
20678
20691
  }
20679
20692
  }
20680
20693
  };
20694
+ const INDIA_EXPERIENCE_OPTIONS = [
20695
+ { value: "0-2", label: "0-2" },
20696
+ { value: "3-4", label: "3-4" },
20697
+ { value: "5-8", label: "5-8" },
20698
+ { value: "9-15", label: "9-15" },
20699
+ { value: "16-20", label: "16-20" },
20700
+ { value: "20+", label: "20+" }
20701
+ ];
20702
+ const INDIA_DOMAIN_OPTIONS = [
20703
+ { value: "Back-end", label: "Back-end" },
20704
+ { value: "Cloud Engineer", label: "Cloud Engineer" },
20705
+ { value: "Cyber Security", label: "Cyber Security" },
20706
+ { value: "Data Engineer", label: "Data Engineer" },
20707
+ { value: "Data Science", label: "Data Science" },
20708
+ { value: "Front-end", label: "Front-end" },
20709
+ { value: "Full Stack", label: "Full Stack" },
20710
+ { value: "Machine Learning / AI", label: "Machine Learning / AI" },
20711
+ { value: "Engineering Manager - any domain", label: "Engineering Manager - any domain" },
20712
+ { value: "Tech Product Manager", label: "Tech Product Manager" },
20713
+ { value: "Technical Program Manager", label: "Technical Program Manager" },
20714
+ { value: "Test Engineer / SDET / QE", label: "Test Engineer / SDET / QE" },
20715
+ { value: "Android Developer", label: "Android Developer" },
20716
+ { value: "iOS Developer", label: "iOS Developer" },
20717
+ { value: "Site Reliability Engineer", label: "Site Reliability Engineer" },
20718
+ { value: "Embedded Software Engineer", label: "Embedded Software Engineer" },
20719
+ { value: "Other Software Engineers", label: "Other Software Engineers" },
20720
+ { value: "Data Analyst / Business Analyst", label: "Data Analyst / Business Analyst" },
20721
+ { value: "Core Engineering", label: "Core Engineering" },
20722
+ { value: "Salesforce developer", label: "Salesforce developer" },
20723
+ { value: "DevOps Engineer", label: "DevOps Engineer" },
20724
+ { value: "None of the above", label: "None of the above" }
20725
+ ];
20681
20726
  const indiaVariant = {
20682
20727
  id: "india",
20683
20728
  overrides: {
@@ -20708,7 +20753,9 @@ var IKEmbeddableFormBundle = function(exports) {
20708
20753
  steps: {
20709
20754
  "profile-details": {
20710
20755
  fields: {
20711
- primaryGoal: { show: false }
20756
+ primaryGoal: { show: false },
20757
+ experience: { options: INDIA_EXPERIENCE_OPTIONS },
20758
+ domain: { options: INDIA_DOMAIN_OPTIONS }
20712
20759
  }
20713
20760
  },
20714
20761
  "goals-details": { show: false }
@@ -20970,6 +21017,8 @@ ${intlTelStyles}`;
20970
21017
  * the fields render inside a shadow root and are unmounted as the user
20971
21018
  * advances, so this stays readable after submission and after the form closes.
20972
21019
  *
21020
+ * Keys are snake_case, with `<field>_label` companions for select fields:
21021
+ *
20973
21022
  * IKForm.getFormData().domain // 'backend-engineer'
20974
21023
  * IKForm.getFormData().domain_label // 'Backend Engineer'
20975
21024
  */