@codebards/ik-embeddable-form 0.0.2671593828-qa → 0.0.2675470093-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
@@ -383,6 +383,9 @@ var IKEmbeddableFormBundle = function(exports) {
383
383
  const pair = document.cookie.split(";").map((c2) => c2.trim()).find((c2) => c2.startsWith(`${key}=`));
384
384
  return pair ? decodeURIComponent(pair.slice(key.length + 1)) : null;
385
385
  }
386
+ function deleteCookie(name) {
387
+ document.cookie = `${encodeURIComponent(name)}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/`;
388
+ }
386
389
  function readJsonCookie(name) {
387
390
  const raw = getCookie(name);
388
391
  if (!raw) return null;
@@ -1134,6 +1137,13 @@ var IKEmbeddableFormBundle = function(exports) {
1134
1137
  true
1135
1138
  );
1136
1139
  }
1140
+ function clearPrefillCookies() {
1141
+ deleteCookie("ik_email");
1142
+ deleteCookie("ik_phone");
1143
+ deleteCookie("ik_phone_code");
1144
+ deleteCookie("ik_experience");
1145
+ deleteCookie("ik_domain");
1146
+ }
1137
1147
  function getPrefillFromCookies() {
1138
1148
  const prefill = {};
1139
1149
  const email = getCookie("ik_email");
@@ -1564,7 +1574,6 @@ var IKEmbeddableFormBundle = function(exports) {
1564
1574
  timeSlot: "preferred_time_slot"
1565
1575
  };
1566
1576
  const STEP_VIEW_CLICK_IDS = {
1567
- "contact-details": "webinar-modal_button_show-webinar-slots",
1568
1577
  "slot-selection": "webinar-modal_button_show-webinar-slots",
1569
1578
  "profile-details": "Gql-form_button_gpl-registration-step",
1570
1579
  "goals-details": "Gql-form_button_gpl-registration-step",
@@ -1953,6 +1962,9 @@ var IKEmbeddableFormBundle = function(exports) {
1953
1962
  this.config.id,
1954
1963
  this.state.currentStepId
1955
1964
  );
1965
+ if (this.state.isComplete) {
1966
+ this.setState({ formData: this.buildInitialFormData() });
1967
+ }
1956
1968
  }
1957
1969
  trackSlotSelection(slot) {
1958
1970
  const data = {
@@ -2234,6 +2246,7 @@ var IKEmbeddableFormBundle = function(exports) {
2234
2246
  response,
2235
2247
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
2236
2248
  };
2249
+ clearPrefillCookies();
2237
2250
  this.setState({ isComplete: true });
2238
2251
  this.analytics.trackSubmitSuccess(this.config.id, this.openConfig.variant);
2239
2252
  (_c = (_b = this.openConfig).onSuccess) == null ? void 0 : _c.call(_b, result);
@@ -2255,6 +2268,7 @@ var IKEmbeddableFormBundle = function(exports) {
2255
2268
  response,
2256
2269
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
2257
2270
  };
2271
+ clearPrefillCookies();
2258
2272
  this.analytics.trackSubmitSuccess(this.config.id, this.openConfig.variant);
2259
2273
  this.setState({ isComplete: true });
2260
2274
  (_c = (_b = this.openConfig).onSuccess) == null ? void 0 : _c.call(_b, result);
@@ -18164,7 +18178,8 @@ var IKEmbeddableFormBundle = function(exports) {
18164
18178
  return /* @__PURE__ */ u$1(
18165
18179
  Select,
18166
18180
  {
18167
- ...withFieldInteract({ ...commonProps, ...rhfField }),
18181
+ ...commonProps,
18182
+ ...rhfField,
18168
18183
  onChange: (e2) => {
18169
18184
  onFieldInteract();
18170
18185
  rhfField.onChange(e2);
@@ -18195,7 +18210,8 @@ var IKEmbeddableFormBundle = function(exports) {
18195
18210
  return /* @__PURE__ */ u$1(
18196
18211
  Checkbox,
18197
18212
  {
18198
- ...withFieldInteract({ ...commonProps, ...rhfField }),
18213
+ ...commonProps,
18214
+ ...rhfField,
18199
18215
  checked: Boolean(rhfField.value),
18200
18216
  onChange: (e2) => {
18201
18217
  onFieldInteract();
@@ -20627,7 +20643,7 @@ ${intlTelStyles}`;
20627
20643
  destroy();
20628
20644
  },
20629
20645
  getVersion() {
20630
- return "1.0.20";
20646
+ return "1.0.21";
20631
20647
  }
20632
20648
  };
20633
20649
  if (typeof window !== "undefined") {