lm-web-controls 1.2.71 → 1.2.72

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.
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import e,{useState as t,useEffect as a}from"react";import{Formik as n,Form as m,ErrorMessage as r}from"formik";import{formService as l}from"@leadmetrics-ai/website-sdk";import*as o from"yup";import{toast as i}from"react-toastify";var c=/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/,s=/^(\+91[\-\s]?)?[0]?(91)?[6789]\d{9}$/,u=o.object().shape({name:o.string().required("Please enter your name").min(3),email:o.string().required("Please enter your email").email("Please enter a valid email").matches(c,"Please enter a valid email"),mobile:o.string().required("Please enter your mobile number").matches(s,"Please enter a valid mobile number")});function d(o){var c=o.closeIcon,s=o.slug,d=o.title,p=t(!1),f=p[0],b=p[1],v=t(""),E=v[0],g=v[1];a((function(){var e=function(e){var t=e.target.closest(".lm-cta-link-button");if(t){var a=t.getAttribute("data-lm-cta-type"),n=t.getAttribute("href");"modal"===a?(e.preventDefault(),e.stopPropagation(),g(t.textContent||""),b(!0)):"link"===a&&n&&(e.preventDefault(),e.stopPropagation(),window.open(n,"_blank","noopener,noreferrer"))}};return document.addEventListener("click",e,!0),function(){document.removeEventListener("click",e,!0)}}),[]);return e.createElement(e.Fragment,null,f&&e.createElement("div",{className:"modal-wrapper"},e.createElement("div",{className:"modal-container"},e.createElement("button",{className:"modal-close-button",onClick:function(){b(!1)},title:"close"},c),e.createElement("h2",{className:"modal-title"},d||E),e.createElement("div",{className:"modal-form-wrapper"},e.createElement(n,{validationSchema:u,onSubmit:function(e,t){var a=t.setSubmitting,n=t.resetForm;l.post(s,e).then((function(){n(),i.success("Form submitted successfully!")})).catch((function(){i.error("Failed to submit the form. Please try again.")})).finally((function(){a(!1),b(!1)}))},initialValues:{name:"",email:"",mobile:""}},(function(t){var a=t.handleSubmit,n=t.handleChange,l=t.handleBlur,o=t.values,i=t.isSubmitting;return e.createElement(m,{className:"modal-form-container",noValidate:!0,onSubmit:a},e.createElement("div",{className:"input-container"},e.createElement("input",{className:"modal-form-input",placeholder:"Name*",name:"name",onChange:n,onBlur:l,value:o.name}),e.createElement(r,{name:"name",component:"div",className:"modal-form-error-message"})),e.createElement("div",{className:"input-container"},e.createElement("input",{className:"modal-form-input",placeholder:"Email*",name:"email",onChange:n,onBlur:l,value:o.email}),e.createElement(r,{name:"email",component:"div",className:"modal-form-error-message"})),e.createElement("div",{className:"input-container"},e.createElement("input",{className:"modal-form-input",placeholder:"Contact number*",name:"mobile",onChange:n,onBlur:l,value:o.mobile}),e.createElement(r,{name:"mobile",component:"div",className:"modal-form-error-message"})),e.createElement("div",{className:"modal-form-button-container"},e.createElement("button",{className:"modal-form-submit-button",type:"submit"},i?"Submitting":"Submit")))}))))))}export{d as ModalForm};
2
+ import e,{useState as a,useEffect as t}from"react";import{Formik as n,Form as m,ErrorMessage as r}from"formik";import{formService as l}from"@leadmetrics-ai/website-sdk";import*as o from"yup";import{toast as i}from"react-toastify";var c=/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/,s=/^(\+91[\-\s]?)?[0]?(91)?[6789]\d{9}$/,u=o.object().shape({name:o.string().required("Please enter your name").min(3),email:o.string().required("Please enter your email").email("Please enter a valid email").matches(c,"Please enter a valid email"),mobile:o.string().required("Please enter your mobile number").matches(s,"Please enter a valid mobile number")});function d(o){var c=o.closeIcon,s=o.slug,d=o.title,f=a(!1),p=f[0],b=f[1],v=a(""),E=v[0],h=v[1];t((function(){document.querySelectorAll(".lm-cta-link-button").forEach((function(e){var a=function(a){a.preventDefault(),a.stopPropagation();var t=e.getAttribute("data-lm-cta-type"),n=e.getAttribute("href");"modal"===t?(h(e.textContent||""),b(!0)):"link"===t&&n&&window.open(n,"_blank","noopener,noreferrer")};return e.addEventListener("click",a),function(){e.removeEventListener("click",a)}}))}),[]);return e.createElement(e.Fragment,null,p&&e.createElement("div",{className:"modal-wrapper"},e.createElement("div",{className:"modal-container"},e.createElement("button",{className:"modal-close-button",onClick:function(){b(!1)},title:"close"},c),e.createElement("h2",{className:"modal-title"},d||E),e.createElement("div",{className:"modal-form-wrapper"},e.createElement(n,{validationSchema:u,onSubmit:function(e,a){var t=a.setSubmitting,n=a.resetForm;l.post(s,e).then((function(){n(),i.success("Form submitted successfully!")})).catch((function(){i.error("Failed to submit the form. Please try again.")})).finally((function(){t(!1),b(!1)}))},initialValues:{name:"",email:"",mobile:""}},(function(a){var t=a.handleSubmit,n=a.handleChange,l=a.handleBlur,o=a.values,i=a.isSubmitting;return e.createElement(m,{className:"modal-form-container",noValidate:!0,onSubmit:t},e.createElement("div",{className:"input-container"},e.createElement("input",{className:"modal-form-input",placeholder:"Name*",name:"name",onChange:n,onBlur:l,value:o.name}),e.createElement(r,{name:"name",component:"div",className:"modal-form-error-message"})),e.createElement("div",{className:"input-container"},e.createElement("input",{className:"modal-form-input",placeholder:"Email*",name:"email",onChange:n,onBlur:l,value:o.email}),e.createElement(r,{name:"email",component:"div",className:"modal-form-error-message"})),e.createElement("div",{className:"input-container"},e.createElement("input",{className:"modal-form-input",placeholder:"Contact number*",name:"mobile",onChange:n,onBlur:l,value:o.mobile}),e.createElement(r,{name:"mobile",component:"div",className:"modal-form-error-message"})),e.createElement("div",{className:"modal-form-button-container"},e.createElement("button",{className:"modal-form-submit-button",type:"submit"},i?"Submitting":"Submit")))}))))))}export{d as ModalForm};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lm-web-controls",
3
- "version": "1.2.71",
3
+ "version": "1.2.72",
4
4
  "description": "leadmetrics-lm-web-controls",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",