@perevorot/shop 2.0.96 → 2.0.98
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
|
-
"use strict";var e=require("vue"),t=require("vuex"),n={name:"account",setup:function(){var n=t.useStore(),o=e.computed((function(){return n.getters["auth/account"]})),r=e.computed((function(){return n.getters["auth/me"]})),l=e.computed((function(){
|
|
1
|
+
"use strict";var e=require("vue"),t=require("vuex"),n={name:"account",setup:function(){var n=t.useStore(),o=e.computed((function(){return n.getters["auth/account"]})),r=e.computed((function(){return n.getters["auth/me"]})),l=e.computed((function(){var e=window.location.href.replace(/#.*$/,"");return o.value.find((function(t){return t.path===e}))}));return{routes:o,logout:function(){n.dispatch("auth/logout")},current:l,user:r}}},o={class:"columns account"},r={class:"column is-3"},l={class:"user-wrapper"},c=e.createElementVNode("div",{class:"icon"},null,-1),u={class:"user"},a={class:"email"},s=e.createElementVNode("hr",null,null,-1),i={class:"menu"},m={class:"menu-list"},d=["href"],p={key:0,class:"icon"},k=["xlink:href"],E={key:1,class:"badge"},f={key:1},g=e.createElementVNode("hr",null,null,-1),N=e.createElementVNode("svg",{class:"icon"},[e.createElementVNode("use",{"xlink:href":"#icon-logout"})],-1),V={class:"column"};n.render=function(t,n,v,h,B,y){return e.renderSlot(t.$slots,"default",{routes:h.routes,logout:h.logout,current:h.current,user:h.user},(function(){return[e.createElementVNode("div",o,[e.createElementVNode("div",r,[e.renderSlot(t.$slots,"user",{user:h.user},(function(){return[e.createElementVNode("div",l,[c,e.createElementVNode("div",u,e.toDisplayString(h.user.name),1),e.createElementVNode("div",a,e.toDisplayString(h.user.email),1)]),s]})),e.createElementVNode("aside",i,[e.createElementVNode("ul",m,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.routes,(function(t,n){return e.openBlock(),e.createElementBlock("li",{key:n},[t.text?(e.openBlock(),e.createElementBlock("a",{key:0,href:t.path,class:e.normalizeClass({"is-active":h.current.path===t.path})},[t.icon?(e.openBlock(),e.createElementBlock("svg",p,[e.createElementVNode("use",{"xlink:href":"#"+t.icon},null,8,k)])):e.createCommentVNode("v-if",!0),e.createElementVNode("span",null,e.toDisplayString(t.text),1),t.badge?(e.openBlock(),e.createElementBlock("span",E,e.toDisplayString(t.badge),1)):e.createCommentVNode("v-if",!0)],10,d)):(e.openBlock(),e.createElementBlock("hr",f))])})),128)),g,e.createElementVNode("li",null,[e.createElementVNode("a",{onClick:n[0]||(n[0]=function(){return h.logout&&h.logout.apply(h,arguments)})},[N,e.createElementVNode("span",null,e.toDisplayString(t.__("auth.user.menu.logout")),1)])])])])]),e.createElementVNode("div",V,[h.current.component?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(h.current.component),{key:0})):e.createCommentVNode("v-if",!0)])])]}))},module.exports=n;
|
|
2
2
|
//# sourceMappingURL=Account.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Account.js","sources":["../../../src/components/account/Account.vue","../../../src/components/account/Account.vue?vue&type=template&id=
|
|
1
|
+
{"version":3,"file":"Account.js","sources":["../../../src/components/account/Account.vue","../../../src/components/account/Account.vue?vue&type=template&id=cdc24670&lang.js"],"sourcesContent":["<template>\n <slot :routes=\"routes\" :logout=\"logout\" :current=\"current\" :user=\"user\">\n <div class=\"columns account\">\n <div class=\"column is-3\">\n <slot name=\"user\" :user=\"user\">\n <div class=\"user-wrapper\">\n <div class=\"icon\"></div>\n <div class=\"user\">{{ user.name }}</div>\n <div class=\"email\">{{ user.email }}</div>\n </div>\n <hr />\n </slot>\n <aside class=\"menu\">\n <ul class=\"menu-list\">\n <li v-for=\"(item, key) in routes\" v-bind:key=\"key\">\n <a :href=\"item.path\" v-if=\"item.text\" v-bind:class=\"{ 'is-active': current.path === item.path }\">\n <svg class=\"icon\" v-if=\"item.icon\">\n <use :xlink:href=\"'#' + item.icon\" />\n </svg>\n <span>{{ item.text }}</span>\n <span class=\"badge\" v-if=\"item.badge\">{{ item.badge }}</span>\n </a>\n <hr v-else />\n </li>\n <hr />\n <li>\n <a @click=\"logout\">\n <svg class=\"icon\">\n <use xlink:href=\"#icon-logout\" />\n </svg>\n <span>{{ __('auth.user.menu.logout') }}</span>\n </a>\n </li>\n </ul>\n </aside>\n </div>\n <div class=\"column\">\n <component :is=\"current.component\" v-if=\"current.component\"></component>\n </div>\n </div>\n </slot>\n</template>\n<script>\nimport { computed } from 'vue';\nimport { useStore } from 'vuex';\n\nexport default {\n name: 'account',\n setup() {\n const store = useStore();\n const routes = computed(() => store.getters['auth/account']);\n const user = computed(() => store.getters['auth/me']);\n const current = computed(() => {\n const href = window.location.href;\n const path = href.replace(/#.*$/, '');\n\n return routes.value.find((route) => route.path === path);\n });\n\n const logout = () => {\n store.dispatch('auth/logout');\n };\n\n return {\n routes,\n logout,\n current,\n user\n };\n }\n};\n</script>","<template>\n <slot :routes=\"routes\" :logout=\"logout\" :current=\"current\" :user=\"user\">\n <div class=\"columns account\">\n <div class=\"column is-3\">\n <slot name=\"user\" :user=\"user\">\n <div class=\"user-wrapper\">\n <div class=\"icon\"></div>\n <div class=\"user\">{{ user.name }}</div>\n <div class=\"email\">{{ user.email }}</div>\n </div>\n <hr />\n </slot>\n <aside class=\"menu\">\n <ul class=\"menu-list\">\n <li v-for=\"(item, key) in routes\" v-bind:key=\"key\">\n <a :href=\"item.path\" v-if=\"item.text\" v-bind:class=\"{ 'is-active': current.path === item.path }\">\n <svg class=\"icon\" v-if=\"item.icon\">\n <use :xlink:href=\"'#' + item.icon\" />\n </svg>\n <span>{{ item.text }}</span>\n <span class=\"badge\" v-if=\"item.badge\">{{ item.badge }}</span>\n </a>\n <hr v-else />\n </li>\n <hr />\n <li>\n <a @click=\"logout\">\n <svg class=\"icon\">\n <use xlink:href=\"#icon-logout\" />\n </svg>\n <span>{{ __('auth.user.menu.logout') }}</span>\n </a>\n </li>\n </ul>\n </aside>\n </div>\n <div class=\"column\">\n <component :is=\"current.component\" v-if=\"current.component\"></component>\n </div>\n </div>\n </slot>\n</template>\n<script>\nimport { computed } from 'vue';\nimport { useStore } from 'vuex';\n\nexport default {\n name: 'account',\n setup() {\n const store = useStore();\n const routes = computed(() => store.getters['auth/account']);\n const user = computed(() => store.getters['auth/me']);\n const current = computed(() => {\n const href = window.location.href;\n const path = href.replace(/#.*$/, '');\n\n return routes.value.find((route) => route.path === path);\n });\n\n const logout = () => {\n store.dispatch('auth/logout');\n };\n\n return {\n routes,\n logout,\n current,\n user\n };\n }\n};\n</script>"],"names":["name","setup","store","useStore","routes","computed","getters","user","current","path","window","location","href","replace","value","find","route","logout","dispatch","_createElementVNode","_renderSlot","$setup","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","email","_hoisted_7","_hoisted_8","_hoisted_9","_createElementBlock","item","key","text","icon","_hoisted_11","badge","_hoisted_13","_hoisted_15","onClick","_hoisted_16","_ctx","_hoisted_17","component","_createBlock"],"mappings":"sDA8Ce,CACXA,KAAM,UACNC,qBACUC,EAAQC,aACRC,EAASC,YAAS,kBAAMH,EAAMI,QAAQ,mBACtCC,EAAOF,YAAS,kBAAMH,EAAMI,QAAQ,cACpCE,EAAUH,YAAS,eAEfI,EADOC,OAAOC,SAASC,KACXC,QAAQ,OAAQ,WAE3BT,EAAOU,MAAMC,MAAK,SAACC,UAAUA,EAAMP,OAASA,cAOhD,CACHL,OAAAA,EACAa,OANW,WACXf,EAAMgB,SAAS,gBAMfV,QAAAA,EACAD,KAAAA,cCjEO,4BACI,wBAEQ,kBACPY,kCAAW,0BACA,iBACA,WAEfA,iDAES,iBACC,uCAGa,wCAIC,qBAIpBA,0CAGQA,kCAAW,SACPA,yCAAgB,+BAQ7B,gDAnCnBC,iCAAOhB,OAAQiB,SAASJ,OAAQI,SAASb,QAASa,UAAUd,KAAMc,SAAlE,kBACIF,2BAAAG,GACIH,2BAAAI,GACIH,8BAAmBb,KAAMc,SAAzB,kBACIF,2BAAAK,GACIC,EACAN,2BAAAO,oBAAqBL,OAAKrB,SAC1BmB,2BAAAQ,oBAAsBN,OAAKO,YAE/BC,MAEJV,6BAAAW,GACIX,0BAAAY,oBACIC,kDAA0BX,mBAAdY,EAAMC,wBAAlBF,2BAAyCE,IAAKA,IACfD,EAAKE,oBAAhCH,gCAAIpB,KAAMqB,EAAKxB,yCAAoDY,UAAQZ,OAASwB,EAAKxB,SAC7DwB,EAAKG,oBAA7BJ,2BAAAK,GACIlB,6CAAwBc,EAAKG,mDAEjCjB,mDAASc,EAAKE,SACYF,EAAKK,qBAA/BN,4BAAAO,oBAAyCN,EAAKK,kEAElDN,yCAEJQ,EACArB,gCACIA,0BAAIsB,sCAAOpB,0CACPqB,EAGAvB,mDAASwB,4CAM7BxB,2BAAAyB,GAC6CvB,UAAQwB,yBAAjDC,wCAAgBzB,UAAQwB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("vue"),t=require("formvuelate"),
|
|
1
|
+
"use strict";var e=require("vue"),t=require("formvuelate"),n=require("@formvuelate/plugin-vee-validate"),r=require("@perevorot/shop/dist/forms/FormText"),o=require("@perevorot/shop/dist/forms/FormRadio"),a=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(o),p=u(a);e.markRaw(m.default),e.markRaw(h.default);var s=t.SchemaFormFactory([l.default({})]),c=e.defineComponent({components:{SchemaForm:s},setup:function(){var n,r=e.inject("user"),o=e.inject("field"),a=e.ref(null),i=e.ref(null),u=(n=function(){return i.value.click(),d.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:o("other_type","me"),name:o("other_name",""),last_name:o("other_last_name",""),phone_me:o("other_phone_me",""),phone_other:o("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"),model:"name",condition:function(e){return"other"===e.type}},last_name:{component:m.default,label:__("auth.registration.form.last_name"),model:"last_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 c=/^\(\d{3}\) \d{3}\-\d{2}\-\d{2}$/,d=p.object().shape({name:p.string().when("type",(function(e){if("other"==e)return p.string().trim().required(__("auth.validation.required"))})),last_name:p.string().when("type",(function(e){if("other"==e)return p.string().trim().required(__("auth.validation.required"))})),phone_me:p.string().when("type",(function(e){if("me"==e)return p.string().required(__("auth.validation.phone")).matches(c,__("auth.validation.phone"))})),phone_other:p.string().when("type",(function(e){if("other"==e)return p.string().required(__("auth.validation.phone")).matches(c,__("auth.validation.phone"))}))});return e.onMounted((function(){l.value.phone_me||(l.value.phone_me=r.value.phone)})),{schema:s,validation:d,user:l,form:a,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.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}}}}),d={class:"auth-user"},f={type:"submit",ref:"userSubmitButton",class:"is-hidden"};c.render=function(t,n,r,o,a,i){var u=e.resolveComponent("SchemaForm");return e.openBlock(),e.createElementBlock("div",d,[e.createVNode(u,{schemaRowClasses:"field",schema:t.schema,"validation-schema":t.validation,preventModelCleanupOnSchemaChange:!0,ref:"form"},{afterForm:e.withCtx((function(){return[e.createElementVNode("button",f,null,512)]})),_:1},8,["schema","validation-schema"])])},module.exports=c;
|
|
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=0b088d62&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 } 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('user');\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 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.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 model: 'name',\n condition: (model) => model.type === 'other'\n },\n last_name: {\n component: FormText,\n label: __('auth.registration.form.last_name'),\n model: 'last_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 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 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 } 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('user');\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 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.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 model: 'name',\n condition: (model) => model.type === 'other'\n },\n last_name: {\n component: FormText,\n label: __('auth.registration.form.last_name'),\n model: 'last_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 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 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","f","checkoutUser","inject","field","form","ref","userSubmitButton","isValid","value","click","validation","user","i","resolve","apply","this","reject","e","type","name","last_name","phone_me","phone_other","schema","component","model","label","list","code","__","condition","mask","useSchemaForm","phoneRegExp","yup","object","shape","string","when","trim","required","matches","getValue","raw","JSON","parse","stringify","phone","_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,qBAqDmBC,EApDTC,EAAeC,SAAO,QACtBC,EAAQD,SAAO,SAC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E,OAAOC,SAASX,GAAG,gCAG/CR,SAAUa,EAAIG,SAASC,KAAK,QAAQ,SAACpB,MACrB,MAARA,SACOgB,EAAIG,SAASG,SAASX,GAAG,0BAA0BY,QAAQR,EAAaJ,GAAG,6BAG1FP,YAAaY,EAAIG,SAASC,KAAK,QAAQ,SAACpB,MACxB,SAARA,SACOgB,EAAIG,SAASG,SAASX,GAAG,0BAA0BY,QAAQR,EAAaJ,GAAG,qCAKvF,CACHN,OAAAA,EACAb,WAAAA,EACAC,KAAAA,EACAP,KAAAA,EACAE,iBAAAA,EACAC,QAAAA,EACAmC,SAhGa,eACPC,EAAMC,KAAKC,MAAMD,KAAKE,UAAUnC,EAAKH,cAE3B,MAAZmC,EAAIzB,MACJyB,EAAIxB,KAAOlB,EAAaO,MAAMW,KAC9BwB,EAAIvB,UAAYnB,EAAaO,MAAMY,UACnCuB,EAAII,MAAQJ,EAAItB,gBAETsB,EAAIrB,mBACJqB,EAAItB,WAEXsB,EAAII,MAAQJ,EAAIrB,mBAETqB,EAAItB,gBACJsB,EAAIrB,oBAGRqB,EAAIzB,KAEJyB,gBChEJ,gBAGSzB,KAAK,SAASb,IAAI,yBAAyB,wGAH/D2C,2BAAAC,GACIC,iBAAYC,iBAAiB,QAAS5B,OAAQ6B,6BAA4BA,aAAaC,mCAAmC,EAAMhD,IAAI,SACrHiD,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=2946e944&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('user');\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 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.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 model: 'name',\n condition: (model) => model.type === 'other'\n },\n last_name: {\n component: FormText,\n label: __('auth.registration.form.last_name'),\n model: 'last_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 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 //console.log('checkoutUser.phone', checkoutUser.value.phone);\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('user');\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 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.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 model: 'name',\n condition: (model) => model.type === 'other'\n },\n last_name: {\n component: FormText,\n label: __('auth.registration.form.last_name'),\n model: 'last_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 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 //console.log('checkoutUser.phone', checkoutUser.value.phone);\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","f","checkoutUser","inject","field","form","ref","userSubmitButton","isValid","value","click","validation","user","i","resolve","apply","this","reject","e","type","name","last_name","phone_me","phone_other","schema","component","model","label","list","code","__","condition","mask","useSchemaForm","phoneRegExp","yup","object","shape","string","when","trim","required","matches","onMounted","phone","getValue","raw","JSON","parse","stringify","_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,qBAqDmBC,EApDTC,EAAeC,SAAO,QACtBC,EAAQD,SAAO,SACfE,EAAOC,MAAI,MACXC,EAAmBD,MAAI,MAEvBE,GA+CSP,oBA9CXM,EAAiBE,MAAMC,QAEVC,EAAWH,QAAQI,EAAKH,6BA8C/B,KAAQ,EAAGI,sCACNA,sBAGLC,UAAUC,MAAMC,iCAEhBC,OAAOC,MAjDXN,EAAON,MAAI,CACba,KAAMf,EAAM,aAAc,MAC1BgB,KAAMhB,EAAM,aAAc,IAC1BiB,UAAWjB,EAAM,kBAAmB,IACpCkB,SAAUlB,EAAM,iBAAkB,IACl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