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Q,OAAO,QAAY,IAAc,QAAU,IACvD,CAAC,EACD,IAAIC,GAAiB,SAAS,iBAAiB,0BAA0B,EAEzEA,GAAe,QAAQC,GAAW,CAC9B,IAAIC,EAAKD,EAAQ,GACjB,MAAME,EAAQ,CAAE,KAAM,KAAK,MAAMF,EAAQ,QAAQ,IAAI,CAAG,EACxDG,EAAoBC,GAAK,IAAIH,CAAE,GAAI,CAC/B,WAAAJ,GACA,MAAAK,EACA,SAAU,CAACG,EAAgBC,EAAmBC,EAAW,CAAE,CACnE,CAAK,CACL,CAAC","names":["dynamicFormStore","defineStore","key","value","payload","field","state","_b","_a","f","carry","_sfc_main","mapStores","mapState","_hoisted_1","_hoisted_2","_createElementVNode","_toDisplayString","_ctx","_hoisted_5","_createElementBlock","$options","args","_normalizeClass","_openBlock","_hoisted_3","_c","_e","_d","_hoisted_4","validName","name","validPhone","numberObject","validCountryCodes","minDigits","maxDigits","actualNumberLength","attachValidations","validation","required","email","lengthMax","x","maxLength","lengthMin","minLength","Validations","validations","formState","useVuelidate","computed","Header","Footer","defineAsyncComponent","__variableDynamicImportRuntimeHelper","__vitePreload","Loading","mapActions","data","_createVNode","_component_Header","_createBlock","_resolveDynamicComponent","_component_Footer","injections","generateAxiosInstance","formContainers","element","id","props","generateApplication","App","VueSweetalert2","autoAnimatePlugin","createPinia"],"sources":["../../../../../app/javascript/mints-components/cali-dynamic-form/stores/store.js","../../../../../app/javascript/mints-components/cali-dynamic-form/components/Header&Footer/Header.vue","../../../../../app/javascript/mints-components/cali-dynamic-form/components/Header&Footer/Footer.vue","../../../../../app/javascript/helpers/validator_provider.js","../../../../../app/javascript/mints-components/cali-dynamic-form/mixins/validations.js","../../../../../app/javascript/mints-components/cali-dynamic-form/App.vue","../../../../../app/components/global/Form/dynamic_form_component.js"],"sourcesContent":["import { defineStore } from 'pinia'\r\n\r\nexport const dynamicFormStore = defineStore('dynamicForm', {\r\n state: () => ({\r\n form: {}, answers: {},\r\n step: 1, status: {}\r\n }),\r\n actions: {\r\n updateAnswer({ key, value }) {\r\n this.answers[key] = value\r\n },\r\n setFormData(payload) {\r\n this.form = payload\r\n },\r\n nextStep() {\r\n this.step ++;\r\n },\r\n resetStep() {\r\n this.step = 1\r\n },\r\n changeStatus({ key, value }) {\r\n this.status[key] = value\r\n },\r\n resetAnswers() {\r\n this.answers = {}\r\n },\r\n verifyIfKeysHasValue() {\r\n return this.currentInputs.every(field => Boolean(this.answers[field.slug]))\r\n }\r\n },\r\n getters: {\r\n // Global getters\r\n formType: (state) => state.form?.config_json?.is_progressive_form ? 'Progressive' : 'Static',\r\n isProgressive() { return this.formType === 'Progressive' },\r\n title: (state) => state.form?.config_json?.form_title,\r\n description: (state) => state.form?.description,\r\n fields: (state) => state.form?.config_json?.fields,\r\n inputFields() { return this.fields?.filter(f => f.data_type_enum !== 16) },\r\n labelFields() { return this.fields?.filter(f => f.data_type_enum === 16) || [] },\r\n buttonField() { return this.labelFields.find(f => f?.extra_parameters?.is_footer_button) },\r\n defaultApi: (state) => state.form?.slug ? '/api/v1/forms/' + state.form.slug : '',\r\n submitStatus: (state) => state.status?.submit,\r\n // Progressive form getters\r\n maxStep() {\r\n return this.inputFields?.reduce((carry, field) => {\r\n return field?.extra_parameters?.step > carry ? field.extra_parameters.step : carry\r\n }, 1)\r\n },\r\n currentInputs(state) { return this.inputFields.filter(field => field.extra_parameters?.step === state.step) },\r\n currentLabels(state) { return this.labelFields.filter(field => field.extra_parameters?.step === state.step) },\r\n }\r\n});\r\n","\r\n","\r\n","import { computed, reactive } from 'vue'\r\nimport useVuelidate from \"@vuelidate/core\";\r\nimport { email, required, minLength, maxLength } from \"@vuelidate/validators\";\r\n// export { required, email, minLength, maxLength } from '@vuelidate/validators'\r\n\r\nexport function validName(name) {\r\n let validNamePattern = new RegExp(\"^[a-zA-Z]+(?:[-'\\\\s][a-zA-Z]+)*$\");\r\n if (validNamePattern.test(name)) {\r\n return true;\r\n }\r\n return false\r\n}\r\n\r\nexport function validPhone(numberObject) {\r\n const validCountryCodes = {\r\n 'MX': { minDigits: 9, maxDigits: 10 }, // For Mexico, phone numbers have exactly 10 digits\r\n 'US': { minDigits: 9, maxDigits: 10 }, // For the USA, phone numbers have exactly 10 digits\r\n // Add more valid country codes and digit ranges as needed\r\n };\r\n if (numberObject.country in validCountryCodes) {\r\n const { minDigits, maxDigits } = validCountryCodes[numberObject.country];\r\n const actualNumberLength = numberObject.number.length;\r\n\r\n // Check if the 'number' has a valid length within the specified range for the given country\r\n if (actualNumberLength >= minDigits && actualNumberLength <= maxDigits) {\r\n return true; // Both country code and number are valid\r\n }\r\n }\r\n return false\r\n}\r\n\r\nexport function attachValidations(field) {\r\n let validation = {}\r\n\r\n if (field.required) {\r\n validation = {...validation, required }\r\n }\r\n\r\n if ((field.validations || []).includes('email')) {\r\n validation = {...validation, email }\r\n }\r\n\r\n if ((field.validations || []).includes('max:')) {\r\n let lengthMax = field.validations.find(x => x.includes('max:')).split(':')\r\n validation = {...validation, ...maxLength(lengthMax[lengthMax.length - 1]) }\r\n }\r\n\r\n if ((field.validations || []).includes('min:')) {\r\n let lengthMin = field.validations.find(x => x.includes('min:')).split(':')\r\n validation = {...validation, ...minLength(lengthMin[lengthMin.length - 1]) }\r\n\r\n }\r\n\r\n if (field.validName) {\r\n validation = {...validation,\r\n ... {\r\n name_validation: {\r\n $validator: validName,\r\n $message: 'Invalid Name. Valid name only contain letters, dashes (-) and spaces'\r\n }\r\n }\r\n }\r\n }\r\n\r\n if ((field.validations || []).includes('phone')) {\r\n validation = {...validation,\r\n ... {\r\n phone_valid: {\r\n $validator: validPhone,\r\n $message: 'El formato del número de teléfono es incorrecto'\r\n }\r\n }\r\n }\r\n }\r\n\r\n return validation\r\n}\r\n\r\nexport const generateValidatorInstance = (form) => {\r\n const fields = form && form.config_json ? form.config_json.fields : [];\r\n\r\n let validations = {}\r\n let formState = {}\r\n fields.forEach(field => {\r\n validations[field.slug] = attachValidations(field)\r\n formState[field.slug] = null\r\n });\r\n\r\n const rules = computed(() => ({\r\n formFilled: validations,\r\n }))\r\n\r\n const state = reactive({\r\n formFilled: formState\r\n })\r\n\r\n return useVuelidate(rules, state);\r\n};","// Store\r\nimport { dynamicFormStore } from \"../stores/store\";\r\nimport { mapStores, mapState } from 'pinia'\r\nimport { attachValidations } from '@helpers/validator_provider.js';\r\n\r\nexport default {\r\n computed: {\r\n ...mapStores(dynamicFormStore),\r\n ...mapState(dynamicFormStore, ['isProgressive', 'currentInputs', 'inputFields']),\r\n validatableFields() {\r\n return this.isProgressive ? this.currentInputs : this.inputFields\r\n },\r\n customValidations() {\r\n if (!this.validatableFields) return {};\r\n \r\n let validations = {}\r\n let formState = {}\r\n \r\n \r\n this.validatableFields.forEach(field => {\r\n validations[field.slug] = attachValidations(field)\r\n formState[field.slug] = null\r\n });\r\n \r\n return { answers: validations }\r\n }\r\n },\r\n validations() {\r\n return this.customValidations\r\n }\r\n}","\r\n","import App from '@mints-components/cali-dynamic-form/App.vue';\r\nimport { generateApplication } from '@helpers/generate_component.js';\r\nimport { generateAxiosInstance } from '@helpers/axios_provider.js';\r\n\r\n// Packages\r\nimport { autoAnimatePlugin } from \"@formkit/auto-animate/vue\"\r\nimport VueSweetalert2 from 'vue-sweetalert2';\r\nimport 'sweetalert2/dist/sweetalert2.min.css';\r\nimport { createPinia } from 'pinia'\r\n\r\nconst injections = [{\r\n name: '$axios',\r\n module: generateAxiosInstance()\r\n}, {\r\n name: '$contact',\r\n module: typeof contact !== 'undefined' ? contact : null\r\n}]\r\nlet formContainers = document.querySelectorAll(`div[id^=\"dynamic-form-\"]`);\r\n\r\nformContainers.forEach(element => {\r\n let id = element.id;\r\n const props = { data: JSON.parse(element.dataset.form) }\r\n generateApplication(App, `#${id}`, {\r\n injections,\r\n props,\r\n packages: [VueSweetalert2, autoAnimatePlugin, createPinia()]\r\n })\r\n})"],"file":"assets/js/entrypoints/team_message.js-3339cc22.js"}