@perevorot/shop 3.0.8 → 3.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("vue"),t=require("formvuelate"),n=require("@formvuelate/plugin-vee-validate"),r=require("@perevorot/shop/dist/forms/FormText"),a=require("@perevorot/shop/dist/forms/FormRadio"),o=require("yup");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function u(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var l=i(n),m=i(r),h=i(a),d=u(o);e.markRaw(m.default),e.markRaw(h.default);var _=t.SchemaFormFactory([l.default({})]),s=e.defineComponent({components:{SchemaForm:_},setup:function(){var n,r=e.inject("loggedUser"),a=e.inject("field"),o=e.ref(null),i=e.ref(null),u=(n=function(){return i.value.click(),p.isValid(l.value)},function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return Promise.resolve(n.apply(this,e))}catch(e){return Promise.reject(e)}}),l=e.ref({type:a("other_type","me"),name:a("other_name",""),last_name:a("other_last_name",""),middle_name:a("other_middle_name",""),phone_me:a("other_phone_me",""),phone_other:a("other_phone_other","")}),_=e.ref({type:{component:h.default,model:"type",label:"",list:[{code:"me",value:__("auth.registration.form.user_type_me")},{code:"other",value:__("auth.registration.form.user_type_other")}]},name:{component:m.default,label:__("auth.registration.form.name"),placeholder:__("auth.registration.form.name"),model:"name",condition:function(e){return"other"===e.type}},last_name:{component:m.default,label:__("auth.registration.form.last_name"),placeholder:__("auth.registration.form.last_name"),model:"last_name",condition:function(e){return"other"===e.type}},middle_name:{component:m.default,label:__("auth.registration.form.middle_name"),placeholder:__("auth.registration.form.middle_name"),model:"middle_name",condition:function(e){return"other"===e.type}},phone_me:{component:m.default,label:__("auth.registration.form.phone"),model:"phone_me",mask:"(###) ###-##-##",type:"phone",condition:function(e){return"me"===e.type}},phone_other:{component:m.default,label:__("auth.registration.form.phone"),model:"phone_other",mask:"(###) ###-##-##",type:"phone",condition:function(e){return"other"===e.type}}});t.useSchemaForm(l);var s=/^\(\d{3}\) \d{3}\-\d{2}\-\d{2}$/,p=d.object().shape({name:d.string().when("type",(function(e){if("other"==e)return d.string().trim().required(__("auth.validation.required"))})),last_name:d.string().when("type",(function(e){if("other"==e)return d.string().trim().required(__("auth.validation.required"))})),middle_name:d.string().when("type",(function(e){if("other"==e)return d.string().trim().required(__("auth.validation.required"))})),phone_me:d.string().when("type",(function(e){if("me"==e)return d.string().required(__("auth.validation.phone")).matches(s,__("auth.validation.phone"))})),phone_other:d.string().when("type",(function(e){if("other"==e)return d.string().required(__("auth.validation.phone")).matches(s,__("auth.validation.phone"))}))});return e.onMounted((function(){l.value.phone_me||(l.value.phone_me=r.value.phone);var t=e.inject("loggedUser"),n=JSON.parse(JSON.stringify(t.value.shipping_data));n&&(l.value.name||(l.value.name=n.name),l.value.last_name||(l.value.last_name=n.last_name),l.value.middle_name||(l.value.middle_name=n.middle_name),l.value.phone_other||(l.value.phone_other=n.phone))})),{schema:_,validation:p,user:l,form:o,userSubmitButton:i,isValid:u,getValue:function(){var e=JSON.parse(JSON.stringify(l.value));return"me"==e.type?(e.name=r.value.name,e.last_name=r.value.last_name,e.middle_name=r.value.middle_name,e.phone=e.phone_me,delete e.phone_other,delete e.phone_me):(e.phone=e.phone_other,delete e.phone_me,delete e.phone_other),delete e.type,e}}}}),p={class:"auth-user"},c={type:"submit",ref:"userSubmitButton",class:"is-hidden"};s.render=function(t,n,r,a,o,i){var u=e.resolveComponent("SchemaForm");return e.openBlock(),e.createElementBlock("div",p,[e.createVNode(u,{schemaRowClasses:"field",schema:t.schema,"validation-schema":t.validation,preventModelCleanupOnSchemaChange:!0,ref:"form"},{afterForm:e.withCtx((function(){return[e.createElementVNode("button",c,null,512)]})),_:1},8,["schema","validation-schema"])])},module.exports=s;
1
+ "use strict";var e=require("vue"),t=require("formvuelate"),n=require("@formvuelate/plugin-vee-validate"),r=require("@perevorot/shop/dist/forms/FormText"),a=require("@perevorot/shop/dist/forms/FormRadio"),o=require("yup");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function u(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var l=i(n),m=i(r),h=i(a),d=u(o);e.markRaw(m.default),e.markRaw(h.default);var s=t.SchemaFormFactory([l.default({})]),_=e.defineComponent({components:{SchemaForm:s},setup:function(){var n,r=e.inject("loggedUser"),a=e.inject("field"),o=e.ref(null),i=e.ref(null),u=(n=function(){return i.value.click(),p.isValid(l.value)},function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return Promise.resolve(n.apply(this,e))}catch(e){return Promise.reject(e)}}),l=e.ref({type:a("other_type","me"),name:a("other_name",""),last_name:a("other_last_name",""),middle_name:a("other_middle_name",""),phone_me:a("other_phone_me",""),phone_other:a("other_phone_other","")}),s=e.ref({type:{component:h.default,model:"type",label:"",list:[{code:"me",value:__("auth.registration.form.user_type_me")},{code:"other",value:__("auth.registration.form.user_type_other")}]},name:{component:m.default,label:__("auth.registration.form.name"),placeholder:__("auth.registration.form.name"),model:"name",condition:function(e){return"other"===e.type}},last_name:{component:m.default,label:__("auth.registration.form.last_name"),placeholder:__("auth.registration.form.last_name"),model:"last_name",condition:function(e){return"other"===e.type}},middle_name:{component:m.default,label:__("auth.registration.form.middle_name"),placeholder:__("auth.registration.form.middle_name"),model:"middle_name",condition:function(e){return"other"===e.type}},phone_me:{component:m.default,label:__("auth.registration.form.phone"),model:"phone_me",mask:"(###) ###-##-##",type:"phone",condition:function(e){return"me"===e.type}},phone_other:{component:m.default,label:__("auth.registration.form.phone"),model:"phone_other",mask:"(###) ###-##-##",type:"phone",condition:function(e){return"other"===e.type}}});t.useSchemaForm(l);var _=/^\(\d{3}\) \d{3}\-\d{2}\-\d{2}$/,p=d.object().shape({name:d.string().when("type",(function(e){if("other"==e)return d.string().trim().required(__("auth.validation.required"))})),last_name:d.string().when("type",(function(e){if("other"==e)return d.string().trim().required(__("auth.validation.required"))})),middle_name:d.string().when("type",(function(e){if("other"==e)return d.string().trim().required(__("auth.validation.required"))})),phone_me:d.string().when("type",(function(e){if("me"==e)return d.string().required(__("auth.validation.phone")).matches(_,__("auth.validation.phone"))})),phone_other:d.string().when("type",(function(e){if("other"==e)return d.string().required(__("auth.validation.phone")).matches(_,__("auth.validation.phone"))}))});return e.onMounted((function(){l.value.phone_me||(l.value.phone_me=r.value.phone);var t=e.inject("loggedUser"),n=JSON.parse(JSON.stringify(t.value.shipping_data));n&&(l.value.name||(l.value.name=n.name),l.value.last_name||(l.value.last_name=n.last_name),l.value.middle_name||(l.value.middle_name=n.middle_name),l.value.phone_other||(l.value.phone_other=n.phone))})),{schema:s,validation:p,user:l,form:o,userSubmitButton:i,isValid:u,getValue:function(){var e=JSON.parse(JSON.stringify(l.value));return"me"==e.type?(e.name=r.value.name,e.last_name=r.value.last_name,e.middle_name=r.value.middle_name,e.phone=e.phone_me,delete e.phone_other,delete e.phone_me):(e.phone=e.phone_other,delete e.phone_me,delete e.phone_other),delete e.type,e}}}}),p={type:"submit",ref:"userSubmitButton",class:"is-hidden"};_.render=function(t,n,r,a,o,i){var u=e.resolveComponent("SchemaForm");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["auth-user other-recipient","is-"+t.user.type])},[e.createVNode(u,{schemaRowClasses:"field",schema:t.schema,"validation-schema":t.validation,preventModelCleanupOnSchemaChange:!0,ref:"form"},{afterForm:e.withCtx((function(){return[e.createElementVNode("button",p,null,512)]})),_:1},8,["schema","validation-schema"])],2)},module.exports=_;
2
2
  //# sourceMappingURL=OtherRecipient.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"OtherRecipient.js","sources":["../../../../../src/components/shop/order/shipping/OtherRecipient.vue","../../../../../src/components/shop/order/shipping/OtherRecipient.vue?vue&type=template&id=471f4537&lang.js"],"sourcesContent":["<template>\n <div class=\"auth-user\">\n <SchemaForm schemaRowClasses=\"field\" :schema=\"schema\" :validation-schema=\"validation\" :preventModelCleanupOnSchemaChange=\"true\" ref=\"form\">\n <template #afterForm>\n <button type=\"submit\" ref=\"userSubmitButton\" class=\"is-hidden\"></button>\n </template>\n </SchemaForm>\n </div>\n</template>\n<script>\nimport { ref, defineComponent, markRaw, inject, onMounted } from 'vue';\nimport { SchemaFormFactory, useSchemaForm } from 'formvuelate';\nimport VeeValidatePlugin from '@formvuelate/plugin-vee-validate';\nimport FormText from '@perevorot/shop/dist/forms/FormText';\nimport FormRadio from '@perevorot/shop/dist/forms/FormRadio';\nimport * as yup from 'yup';\n\nmarkRaw(FormText);\nmarkRaw(FormRadio);\n\nconst SchemaForm = SchemaFormFactory([VeeValidatePlugin({})]);\n\nexport default defineComponent({\n components: {\n SchemaForm,\n },\n setup() {\n const checkoutUser = inject('loggedUser');\n const field = inject('field');\n const form = ref(null);\n const userSubmitButton = ref(null);\n\n const isValid = async () => {\n userSubmitButton.value.click();\n\n return await validation.isValid(user.value);\n }\n\n const user = ref({\n type: field('other_type', 'me'),\n name: field('other_name', ''),\n last_name: field('other_last_name', ''),\n middle_name: field('other_middle_name', ''),\n phone_me: field('other_phone_me', ''),\n phone_other: field('other_phone_other', ''),\n });\n\n const getValue = () => {\n const raw = JSON.parse(JSON.stringify(user.value));\n\n if (raw.type == 'me') {\n raw.name = checkoutUser.value.name;\n raw.last_name = checkoutUser.value.last_name;\n raw.middle_name = checkoutUser.value.middle_name;\n raw.phone = raw.phone_me;\n\n delete raw.phone_other;\n delete raw.phone_me;\n } else {\n raw.phone = raw.phone_other;\n\n delete raw.phone_me;\n delete raw.phone_other;\n }\n\n delete raw.type;\n\n return raw;\n }\n\n const schema = ref({\n type: {\n component: FormRadio,\n model: 'type',\n label: '',\n list: [\n { code: 'me', value: __('auth.registration.form.user_type_me') },\n { code: 'other', value: __('auth.registration.form.user_type_other') }\n ],\n },\n name: {\n component: FormText,\n label: __('auth.registration.form.name'),\n placeholder: __('auth.registration.form.name'),\n model: 'name',\n condition: (model) => model.type === 'other'\n },\n last_name: {\n component: FormText,\n label: __('auth.registration.form.last_name'),\n placeholder: __('auth.registration.form.last_name'),\n model: 'last_name',\n condition: (model) => model.type === 'other'\n },\n middle_name: {\n component: FormText,\n label: __('auth.registration.form.middle_name'),\n placeholder: __('auth.registration.form.middle_name'),\n model: 'middle_name',\n condition: (model) => model.type === 'other'\n },\n phone_me: {\n component: FormText,\n label: __('auth.registration.form.phone'),\n model: 'phone_me',\n mask: '(###) ###-##-##',\n type: 'phone',\n condition: (model) => model.type === 'me'\n },\n phone_other: {\n component: FormText,\n label: __('auth.registration.form.phone'),\n model: 'phone_other',\n mask: '(###) ###-##-##',\n type: 'phone',\n condition: (model) => model.type === 'other'\n },\n });\n\n useSchemaForm(user);\n\n const phoneRegExp = /^\\(\\d{3}\\) \\d{3}\\-\\d{2}\\-\\d{2}$/;\n\n const validation = yup.object().shape({\n name: yup.string().when('type', (type) => {\n if (type == 'other') {\n return yup.string().trim().required(__('auth.validation.required'));\n }\n }),\n last_name: yup.string().when('type', (type) => {\n if (type == 'other') {\n return yup.string().trim().required(__('auth.validation.required'));\n }\n }),\n middle_name: yup.string().when('type', (type) => {\n if (type == 'other') {\n return yup.string().trim().required(__('auth.validation.required'));\n }\n }),\n phone_me: yup.string().when('type', (type) => {\n if (type == 'me') {\n return yup.string().required(__('auth.validation.phone')).matches(phoneRegExp, __('auth.validation.phone'));\n }\n }),\n phone_other: yup.string().when('type', (type) => {\n if (type == 'other') {\n return yup.string().required(__('auth.validation.phone')).matches(phoneRegExp, __('auth.validation.phone'));\n }\n })\n });\n\n onMounted(() => {\n if (!user.value.phone_me) {\n user.value.phone_me = checkoutUser.value.phone;\n }\n\n const loggedUser = inject('loggedUser');\n const userData = JSON.parse(JSON.stringify(loggedUser.value.shipping_data));\n\n if (userData) {\n if (!user.value.name) {\n user.value.name = userData.name;\n }\n\n if (!user.value.last_name) {\n user.value.last_name = userData.last_name;\n }\n\n if (!user.value.middle_name) {\n user.value.middle_name = userData.middle_name;\n }\n\n if (!user.value.phone_other) {\n user.value.phone_other = userData.phone;\n }\n }\n });\n\n return {\n schema,\n validation,\n user,\n form,\n userSubmitButton,\n isValid,\n getValue,\n }\n }\n});\n</script>","<template>\n <div class=\"auth-user\">\n <SchemaForm schemaRowClasses=\"field\" :schema=\"schema\" :validation-schema=\"validation\" :preventModelCleanupOnSchemaChange=\"true\" ref=\"form\">\n <template #afterForm>\n <button type=\"submit\" ref=\"userSubmitButton\" class=\"is-hidden\"></button>\n </template>\n </SchemaForm>\n </div>\n</template>\n<script>\nimport { ref, defineComponent, markRaw, inject, onMounted } from 'vue';\nimport { SchemaFormFactory, useSchemaForm } from 'formvuelate';\nimport VeeValidatePlugin from '@formvuelate/plugin-vee-validate';\nimport FormText from '@perevorot/shop/dist/forms/FormText';\nimport FormRadio from '@perevorot/shop/dist/forms/FormRadio';\nimport * as yup from 'yup';\n\nmarkRaw(FormText);\nmarkRaw(FormRadio);\n\nconst SchemaForm = SchemaFormFactory([VeeValidatePlugin({})]);\n\nexport default defineComponent({\n components: {\n SchemaForm,\n },\n setup() {\n const checkoutUser = inject('loggedUser');\n const field = inject('field');\n const form = ref(null);\n const userSubmitButton = ref(null);\n\n const isValid = async () => {\n userSubmitButton.value.click();\n\n return await validation.isValid(user.value);\n }\n\n const user = ref({\n type: field('other_type', 'me'),\n name: field('other_name', ''),\n last_name: field('other_last_name', ''),\n middle_name: field('other_middle_name', ''),\n phone_me: field('other_phone_me', ''),\n phone_other: field('other_phone_other', ''),\n });\n\n const getValue = () => {\n const raw = JSON.parse(JSON.stringify(user.value));\n\n if (raw.type == 'me') {\n raw.name = checkoutUser.value.name;\n raw.last_name = checkoutUser.value.last_name;\n raw.middle_name = checkoutUser.value.middle_name;\n raw.phone = raw.phone_me;\n\n delete raw.phone_other;\n delete raw.phone_me;\n } else {\n raw.phone = raw.phone_other;\n\n delete raw.phone_me;\n delete raw.phone_other;\n }\n\n delete raw.type;\n\n return raw;\n }\n\n const schema = ref({\n type: {\n component: FormRadio,\n model: 'type',\n label: '',\n list: [\n { code: 'me', value: __('auth.registration.form.user_type_me') },\n { code: 'other', value: __('auth.registration.form.user_type_other') }\n ],\n },\n name: {\n component: FormText,\n label: __('auth.registration.form.name'),\n placeholder: __('auth.registration.form.name'),\n model: 'name',\n condition: (model) => model.type === 'other'\n },\n last_name: {\n component: FormText,\n label: __('auth.registration.form.last_name'),\n placeholder: __('auth.registration.form.last_name'),\n model: 'last_name',\n condition: (model) => model.type === 'other'\n },\n middle_name: {\n component: FormText,\n label: __('auth.registration.form.middle_name'),\n placeholder: __('auth.registration.form.middle_name'),\n model: 'middle_name',\n condition: (model) => model.type === 'other'\n },\n phone_me: {\n component: FormText,\n label: __('auth.registration.form.phone'),\n model: 'phone_me',\n mask: '(###) ###-##-##',\n type: 'phone',\n condition: (model) => model.type === 'me'\n },\n phone_other: {\n component: FormText,\n label: __('auth.registration.form.phone'),\n model: 'phone_other',\n mask: '(###) ###-##-##',\n type: 'phone',\n condition: (model) => model.type === 'other'\n },\n });\n\n useSchemaForm(user);\n\n const phoneRegExp = /^\\(\\d{3}\\) \\d{3}\\-\\d{2}\\-\\d{2}$/;\n\n const validation = yup.object().shape({\n name: yup.string().when('type', (type) => {\n if (type == 'other') {\n return yup.string().trim().required(__('auth.validation.required'));\n }\n }),\n last_name: yup.string().when('type', (type) => {\n if (type == 'other') {\n return yup.string().trim().required(__('auth.validation.required'));\n }\n }),\n middle_name: yup.string().when('type', (type) => {\n if (type == 'other') {\n return yup.string().trim().required(__('auth.validation.required'));\n }\n }),\n phone_me: yup.string().when('type', (type) => {\n if (type == 'me') {\n return yup.string().required(__('auth.validation.phone')).matches(phoneRegExp, __('auth.validation.phone'));\n }\n }),\n phone_other: yup.string().when('type', (type) => {\n if (type == 'other') {\n return yup.string().required(__('auth.validation.phone')).matches(phoneRegExp, __('auth.validation.phone'));\n }\n })\n });\n\n onMounted(() => {\n if (!user.value.phone_me) {\n user.value.phone_me = checkoutUser.value.phone;\n }\n\n const loggedUser = inject('loggedUser');\n const userData = JSON.parse(JSON.stringify(loggedUser.value.shipping_data));\n\n if (userData) {\n if (!user.value.name) {\n user.value.name = userData.name;\n }\n\n if (!user.value.last_name) {\n user.value.last_name = userData.last_name;\n }\n\n if (!user.value.middle_name) {\n user.value.middle_name = userData.middle_name;\n }\n\n if (!user.value.phone_other) {\n user.value.phone_other = userData.phone;\n }\n }\n });\n\n return {\n schema,\n validation,\n user,\n form,\n userSubmitButton,\n isValid,\n getValue,\n }\n }\n});\n</script>"],"names":["markRaw","FormText","FormRadio","SchemaForm","SchemaFormFactory","VeeValidatePlugin","defineComponent","components","setup","checkoutUser","inject","field","form","ref","userSubmitButton","isValid","value","click","validation","user","i","arguments","resolve","apply","args","reject","type","name","last_name","middle_name","phone_me","phone_other","schema","component","model","label","list","code","__","placeholder","condition","mask","useSchemaForm","phoneRegExp","yup","object","shape","string","when","trim","required","matches","onMounted","phone","loggedUser","userData","JSON","parse","stringify","shipping_data","getValue","raw","_createElementBlock","_hoisted_1","_createVNode","schemaRowClasses","_ctx","preventModelCleanupOnSchemaChange","afterForm","_createElementVNode","_hoisted_2"],"mappings":"omBAiBAA,UAAQC,WACRD,UAAQE,WAER,IAAMC,EAAaC,oBAAkB,CAACC,UAAkB,QAEzCC,kBAAgB,CAC3BC,WAAY,CACRJ,WAAAA,GAEJK,uBACUC,EAAeC,SAAO,cACtBC,EAAQD,SAAO,SACfE,EAAOC,MAAI,MACXC,EAAmBD,MAAI,MAEvBE,uBACFD,EAAiBE,MAAMC,QAEVC,EAAWH,QAAQI,EAAKH,6BA8C/B,GAAII,IAAOA,EAAIC,oCACVD,sBAGLE,UAAUC,WAAYC,4BAEtBC,aAjDJN,EAAON,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AAI9B,oBAGR8B,EAAInC,KAEJmC,gBClEJ,gBAGSnC,KAAK,SAASb,IAAI,yBAAyB,wGAH/DiD,2BAAAC,GACIC,iBAAYC,iBAAiB,QAASjC,OAAQkC,6BAA4BA,aAAaC,mCAAmC,EAAMtD,IAAI,SACrHuD,qBACP,kBAAAC,8BAAAC"}
1
+ {"version":3,"file":"OtherRecipient.js","sources":["../../../../../src/components/shop/order/shipping/OtherRecipient.vue","../../../../../src/components/shop/order/shipping/OtherRecipient.vue?vue&type=template&id=8e5d3012&lang.js"],"sourcesContent":["<template>\n <div class=\"auth-user other-recipient\" v-bind:class=\"'is-'+user.type\">\n <SchemaForm schemaRowClasses=\"field\" :schema=\"schema\" :validation-schema=\"validation\" :preventModelCleanupOnSchemaChange=\"true\" ref=\"form\">\n <template #afterForm>\n <button type=\"submit\" ref=\"userSubmitButton\" class=\"is-hidden\"></button>\n </template>\n </SchemaForm>\n </div>\n</template>\n<script>\nimport { ref, defineComponent, markRaw, inject, onMounted } from 'vue';\nimport { SchemaFormFactory, useSchemaForm } from 'formvuelate';\nimport VeeValidatePlugin from '@formvuelate/plugin-vee-validate';\nimport FormText from '@perevorot/shop/dist/forms/FormText';\nimport FormRadio from '@perevorot/shop/dist/forms/FormRadio';\nimport * as yup from 'yup';\n\nmarkRaw(FormText);\nmarkRaw(FormRadio);\n\nconst SchemaForm = SchemaFormFactory([VeeValidatePlugin({})]);\n\nexport default defineComponent({\n components: {\n SchemaForm,\n },\n setup() {\n const checkoutUser = inject('loggedUser');\n const field = inject('field');\n const form = ref(null);\n const userSubmitButton = ref(null);\n\n const isValid = async () => {\n userSubmitButton.value.click();\n\n return await validation.isValid(user.value);\n }\n\n const user = ref({\n type: field('other_type', 'me'),\n name: field('other_name', ''),\n last_name: field('other_last_name', ''),\n middle_name: field('other_middle_name', ''),\n phone_me: field('other_phone_me', ''),\n phone_other: field('other_phone_other', ''),\n });\n\n const getValue = () => {\n const raw = JSON.parse(JSON.stringify(user.value));\n\n if (raw.type == 'me') {\n raw.name = checkoutUser.value.name;\n raw.last_name = checkoutUser.value.last_name;\n raw.middle_name = checkoutUser.value.middle_name;\n raw.phone = raw.phone_me;\n\n delete raw.phone_other;\n delete raw.phone_me;\n } else {\n raw.phone = raw.phone_other;\n\n delete raw.phone_me;\n delete raw.phone_other;\n }\n\n delete raw.type;\n\n return raw;\n }\n\n const schema = ref({\n type: {\n component: FormRadio,\n model: 'type',\n label: '',\n list: [\n { code: 'me', value: __('auth.registration.form.user_type_me') },\n { code: 'other', value: __('auth.registration.form.user_type_other') }\n ],\n },\n name: {\n component: FormText,\n label: __('auth.registration.form.name'),\n placeholder: __('auth.registration.form.name'),\n model: 'name',\n condition: (model) => model.type === 'other'\n },\n last_name: {\n component: FormText,\n label: __('auth.registration.form.last_name'),\n placeholder: __('auth.registration.form.last_name'),\n model: 'last_name',\n condition: (model) => model.type === 'other'\n },\n middle_name: {\n component: FormText,\n label: __('auth.registration.form.middle_name'),\n placeholder: __('auth.registration.form.middle_name'),\n model: 'middle_name',\n condition: (model) => model.type === 'other'\n },\n phone_me: {\n component: FormText,\n label: __('auth.registration.form.phone'),\n model: 'phone_me',\n mask: '(###) ###-##-##',\n type: 'phone',\n condition: (model) => model.type === 'me'\n },\n phone_other: {\n component: FormText,\n label: __('auth.registration.form.phone'),\n model: 'phone_other',\n mask: '(###) ###-##-##',\n type: 'phone',\n condition: (model) => model.type === 'other'\n },\n });\n\n useSchemaForm(user);\n\n const phoneRegExp = /^\\(\\d{3}\\) \\d{3}\\-\\d{2}\\-\\d{2}$/;\n\n const validation = yup.object().shape({\n name: yup.string().when('type', (type) => {\n if (type == 'other') {\n return yup.string().trim().required(__('auth.validation.required'));\n }\n }),\n last_name: yup.string().when('type', (type) => {\n if (type == 'other') {\n return yup.string().trim().required(__('auth.validation.required'));\n }\n }),\n middle_name: yup.string().when('type', (type) => {\n if (type == 'other') {\n return yup.string().trim().required(__('auth.validation.required'));\n }\n }),\n phone_me: yup.string().when('type', (type) => {\n if (type == 'me') {\n return yup.string().required(__('auth.validation.phone')).matches(phoneRegExp, __('auth.validation.phone'));\n }\n }),\n phone_other: yup.string().when('type', (type) => {\n if (type == 'other') {\n return yup.string().required(__('auth.validation.phone')).matches(phoneRegExp, __('auth.validation.phone'));\n }\n })\n });\n\n onMounted(() => {\n if (!user.value.phone_me) {\n user.value.phone_me = checkoutUser.value.phone;\n }\n\n const loggedUser = inject('loggedUser');\n const userData = JSON.parse(JSON.stringify(loggedUser.value.shipping_data));\n\n if (userData) {\n if (!user.value.name) {\n user.value.name = userData.name;\n }\n\n if (!user.value.last_name) {\n user.value.last_name = userData.last_name;\n }\n\n if (!user.value.middle_name) {\n user.value.middle_name = userData.middle_name;\n }\n\n if (!user.value.phone_other) {\n user.value.phone_other = userData.phone;\n }\n }\n });\n\n return {\n schema,\n validation,\n user,\n form,\n userSubmitButton,\n isValid,\n getValue,\n }\n }\n});\n</script>","<template>\n <div class=\"auth-user other-recipient\" v-bind:class=\"'is-'+user.type\">\n <SchemaForm schemaRowClasses=\"field\" :schema=\"schema\" :validation-schema=\"validation\" :preventModelCleanupOnSchemaChange=\"true\" ref=\"form\">\n <template #afterForm>\n <button type=\"submit\" ref=\"userSubmitButton\" class=\"is-hidden\"></button>\n </template>\n </SchemaForm>\n </div>\n</template>\n<script>\nimport { ref, defineComponent, markRaw, inject, onMounted } from 'vue';\nimport { SchemaFormFactory, useSchemaForm } from 'formvuelate';\nimport VeeValidatePlugin from '@formvuelate/plugin-vee-validate';\nimport FormText from '@perevorot/shop/dist/forms/FormText';\nimport FormRadio from '@perevorot/shop/dist/forms/FormRadio';\nimport * as yup from 'yup';\n\nmarkRaw(FormText);\nmarkRaw(FormRadio);\n\nconst SchemaForm = SchemaFormFactory([VeeValidatePlugin({})]);\n\nexport default defineComponent({\n components: {\n SchemaForm,\n },\n setup() {\n const checkoutUser = inject('loggedUser');\n const field = inject('field');\n const form = ref(null);\n const userSubmitButton = ref(null);\n\n const isValid = async () => {\n userSubmitButton.value.click();\n\n return await validation.isValid(user.value);\n }\n\n const user = ref({\n type: field('other_type', 'me'),\n name: field('other_name', ''),\n last_name: field('other_last_name', ''),\n middle_name: field('other_middle_name', ''),\n phone_me: field('other_phone_me', ''),\n phone_other: field('other_phone_other', ''),\n });\n\n const getValue = () => {\n const raw = JSON.parse(JSON.stringify(user.value));\n\n if (raw.type == 'me') {\n raw.name = checkoutUser.value.name;\n raw.last_name = checkoutUser.value.last_name;\n raw.middle_name = checkoutUser.value.middle_name;\n raw.phone = raw.phone_me;\n\n delete raw.phone_other;\n delete raw.phone_me;\n } else {\n raw.phone = raw.phone_other;\n\n delete raw.phone_me;\n delete raw.phone_other;\n }\n\n delete raw.type;\n\n return raw;\n }\n\n const schema = ref({\n type: {\n component: FormRadio,\n model: 'type',\n label: '',\n list: [\n { code: 'me', value: __('auth.registration.form.user_type_me') },\n { code: 'other', value: __('auth.registration.form.user_type_other') }\n ],\n },\n name: {\n component: FormText,\n label: __('auth.registration.form.name'),\n placeholder: __('auth.registration.form.name'),\n model: 'name',\n condition: (model) => model.type === 'other'\n },\n last_name: {\n component: FormText,\n label: __('auth.registration.form.last_name'),\n placeholder: __('auth.registration.form.last_name'),\n model: 'last_name',\n condition: (model) => model.type === 'other'\n },\n middle_name: {\n component: FormText,\n label: __('auth.registration.form.middle_name'),\n placeholder: __('auth.registration.form.middle_name'),\n model: 'middle_name',\n condition: (model) => model.type === 'other'\n },\n phone_me: {\n component: FormText,\n label: __('auth.registration.form.phone'),\n model: 'phone_me',\n mask: '(###) ###-##-##',\n type: 'phone',\n condition: (model) => model.type === 'me'\n },\n phone_other: {\n component: FormText,\n label: __('auth.registration.form.phone'),\n model: 'phone_other',\n mask: '(###) ###-##-##',\n type: 'phone',\n condition: (model) => model.type === 'other'\n },\n });\n\n useSchemaForm(user);\n\n const phoneRegExp = /^\\(\\d{3}\\) \\d{3}\\-\\d{2}\\-\\d{2}$/;\n\n const validation = yup.object().shape({\n name: yup.string().when('type', (type) => {\n if (type == 'other') {\n return yup.string().trim().required(__('auth.validation.required'));\n }\n }),\n last_name: yup.string().when('type', (type) => {\n if (type == 'other') {\n return yup.string().trim().required(__('auth.validation.required'));\n }\n }),\n middle_name: yup.string().when('type', (type) => {\n if (type == 'other') {\n return yup.string().trim().required(__('auth.validation.required'));\n }\n }),\n phone_me: yup.string().when('type', (type) => {\n if (type == 'me') {\n return yup.string().required(__('auth.validation.phone')).matches(phoneRegExp, __('auth.validation.phone'));\n }\n }),\n phone_other: yup.string().when('type', (type) => {\n if (type == 'other') {\n return yup.string().required(__('auth.validation.phone')).matches(phoneRegExp, __('auth.validation.phone'));\n }\n })\n });\n\n onMounted(() => {\n if (!user.value.phone_me) {\n user.value.phone_me = checkoutUser.value.phone;\n }\n\n const loggedUser = inject('loggedUser');\n const userData = JSON.parse(JSON.stringify(loggedUser.value.shipping_data));\n\n if (userData) {\n if (!user.value.name) {\n user.value.name = userData.name;\n }\n\n if (!user.value.last_name) {\n user.value.last_name = userData.last_name;\n }\n\n if (!user.value.middle_name) {\n user.value.middle_name = userData.middle_name;\n }\n\n if (!user.value.phone_other) {\n user.value.phone_other = userData.phone;\n }\n }\n });\n\n return {\n schema,\n validation,\n user,\n form,\n userSubmitButton,\n isValid,\n getValue,\n }\n }\n});\n</script>"],"names":["markRaw","FormText","FormRadio","SchemaForm","SchemaFormFactory","VeeValidatePlugin","defineComponent","components","setup","checkoutUser","inject","field","form","ref","userSubmitButton","isValid","value","click","validation","user","i","arguments","resolve","apply","args","reject","type","name","last_name","middle_name","phone_me","phone_other","schema","component","model","label","list","code","__","placeholder","condition","mask","useSchemaForm","phoneRegExp","yup","object","shape","string","when","trim","required","matches","onMounted","phone","loggedUser","userData","JSON","parse","stringify","shipping_data","getValue","raw","_createElementBlock","_ctx","_createVNode","schemaRowClasses","preventModelCleanupOnSchemaChange","afterForm","_createElementVNode","_hoisted_1"],"mappings":"omBAiBAA,UAAQC,WACRD,UAAQE,WAER,IAAMC,EAAaC,oBAAkB,CAACC,UAA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