@perevorot/shop 2.0.119 → 2.0.121

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.
Files changed (35) hide show
  1. package/dist/api.js +1 -1
  2. package/dist/api.js.map +1 -1
  3. package/dist/components/account/Wish.js +1 -1
  4. package/dist/components/account/Wish.js.map +1 -1
  5. package/dist/components/auth/Login.js +1 -1
  6. package/dist/components/auth/Login.js.map +1 -1
  7. package/dist/components/auth/Registration.js +1 -1
  8. package/dist/components/auth/Registration.js.map +1 -1
  9. package/dist/components/auth/User.js +1 -1
  10. package/dist/components/auth/User.js.map +1 -1
  11. package/dist/components/shop/Search.js +1 -1
  12. package/dist/components/shop/Search.js.map +1 -1
  13. package/dist/components/shop/cart/CartAdd.js +1 -1
  14. package/dist/components/shop/cart/CartAdd.js.map +1 -1
  15. package/dist/components/shop/cart/CartItem.js +1 -1
  16. package/dist/components/shop/cart/CartItem.js.map +1 -1
  17. package/dist/components/shop/compare/CompareAdd.js +1 -1
  18. package/dist/components/shop/compare/CompareAdd.js.map +1 -1
  19. package/dist/components/shop/compare/ComparsionModal.js +1 -1
  20. package/dist/components/shop/compare/ComparsionModal.js.map +1 -1
  21. package/dist/components/shop/filters/FilterSearch.js +1 -1
  22. package/dist/components/shop/filters/FilterSearch.js.map +1 -1
  23. package/dist/components/shop/order/Checkout.js +1 -1
  24. package/dist/components/shop/order/Checkout.js.map +1 -1
  25. package/dist/components/shop/viewed/Viewed.js +1 -1
  26. package/dist/components/shop/viewed/Viewed.js.map +1 -1
  27. package/dist/components/shop/viewed/Viewer.js +1 -1
  28. package/dist/components/shop/viewed/Viewer.js.map +1 -1
  29. package/dist/components/shop/wishlist/WishlistAdd.js +1 -1
  30. package/dist/components/shop/wishlist/WishlistAdd.js.map +1 -1
  31. package/dist/components/shop/wishlist/WishlistDelete.js +1 -1
  32. package/dist/components/shop/wishlist/WishlistDelete.js.map +1 -1
  33. package/dist/store.js +1 -1
  34. package/dist/store.js.map +1 -1
  35. package/package.json +1 -1
package/dist/api.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var t={auth:{me:function(){return $http.post($ziggy("auth.me"))},login:function(t){return $http.post($ziggy("auth.login"),t)},logout:function(){return $http.post($ziggy("auth.logout"))},reset:function(t){return $http.post($ziggy("auth.password.email"),t)},resetSms:function(t){return $http.post($ziggy("auth.password.sms"),t)},passwordUpdate:function(t){return $http.post($ziggy("auth.password.update"),t)},registerShort:function(t){return $http.post($ziggy("auth.register.short"),t)},registerFull:function(t){return $http.post($ziggy("auth.register.full"),t)},registerForm:function(){return $http.post($ziggy("auth.register.form"))},update:function(t){return $http.post($ziggy("auth.register.update"),t)}},cart:{items:function(){return $http.post($ziggy("api.cart"),{action:"get"})},add:function(t){return $http.post($ziggy("api.cart"),{action:"add",id:t.id,quantity:t.quantity,options:!!t.options&&t.options})},options:function(t){return $http.post($ziggy("api.cart"),{action:"options",id:t.id,options:t.options})},addBundle:function(t){return $http.post($ziggy("api.cart"),{action:"addBundle",id:t.id,second:t.second,third:t.third})},remove:function(t){return $http.post($ziggy("api.cart"),{action:"remove",id:t})},clear:function(){return $http.post($ziggy("api.cart"),{action:"clear"})},quantity:function(t){return $http.post($ziggy("api.cart"),{action:"quantity",id:t.id,exact:t.exact})}},compare:{items:function(){return $http.post($ziggy("api.compare"),{action:"get"})},category:function(t){return $http.post($ziggy("api.compare"),{action:"category",slug:t})},toggle:function(t){return $http.post($ziggy("api.compare"),{action:"toggle",id:t})},delete:function(t){return $http.post($ziggy("api.compare"),{action:"delete",id:t})},modal:function(t){return $http.post($ziggy("api.compare"),{action:"modal",id:t})}},shop:{search:function(t){return $http.post($ziggy("api.search"),{term:t})}},wishlist:{items:function(){return $http.post($ziggy("api.wishlist"),{action:"get"})},toggle:function(t){return $http.post($ziggy("api.wishlist"),{action:"toggle",id:t})}}};module.exports=t;
1
+ "use strict";var t={auth:{me:function(){return $http.post($ziggy("auth.me"))},login:function(t){return $http.post($ziggy("auth.login"),t)},logout:function(){return $http.post($ziggy("auth.logout"))},reset:function(t){return $http.post($ziggy("auth.password.email"),t)},resetSms:function(t){return $http.post($ziggy("auth.password.sms"),t)},passwordUpdate:function(t){return $http.post($ziggy("auth.password.update"),t)},registerShort:function(t){return $http.post($ziggy("auth.register.short"),t)},registerFull:function(t){return $http.post($ziggy("auth.register.full"),t)},registerForm:function(){return $http.post($ziggy("auth.register.form"))},update:function(t){return $http.post($ziggy("auth.register.update"),t)}},cart:{items:function(){return $http.post($ziggy("api.cart"),{action:"get"})},add:function(t){return $http.post($ziggy("api.cart"),{action:"add",id:t.id,quantity:t.quantity,options:!!t.options&&t.options,extra:!!t.extra&&t.extra})},options:function(t){return $http.post($ziggy("api.cart"),{action:"options",id:t.id,options:t.options})},addBundle:function(t){return $http.post($ziggy("api.cart"),{action:"addBundle",id:t.id,second:t.second,third:t.third})},remove:function(t){return $http.post($ziggy("api.cart"),{action:"remove",id:t})},clear:function(){return $http.post($ziggy("api.cart"),{action:"clear"})},quantity:function(t){return $http.post($ziggy("api.cart"),{action:"quantity",id:t.id,exact:t.exact})}},compare:{items:function(){return $http.post($ziggy("api.compare"),{action:"get"})},category:function(t){return $http.post($ziggy("api.compare"),{action:"category",slug:t})},toggle:function(t){return $http.post($ziggy("api.compare"),{action:"toggle",id:t})},delete:function(t){return $http.post($ziggy("api.compare"),{action:"delete",id:t})},modal:function(t){return $http.post($ziggy("api.compare"),{action:"modal",id:t})}},shop:{search:function(t){return $http.post($ziggy("api.search"),{term:t})}},wishlist:{items:function(){return $http.post($ziggy("api.wishlist"),{action:"get"})},toggle:function(t){return $http.post($ziggy("api.wishlist"),{action:"toggle",id:t})}}};module.exports=t;
2
2
  //# sourceMappingURL=api.js.map
package/dist/api.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","sources":["../src/api/modules/auth.js","../src/api/index.js","../src/api/modules/cart.js","../src/api/modules/compare.js","../src/api/modules/shop.js","../src/api/modules/wishlist.js"],"sourcesContent":["export default {\n me() {\n return $http.post($ziggy('auth.me'));\n },\n login(credentials) {\n return $http.post($ziggy('auth.login'), credentials);\n },\n logout() {\n return $http.post($ziggy('auth.logout'));\n },\n reset(credentials) {\n return $http.post($ziggy('auth.password.email'), credentials);\n },\n resetSms(credentials) {\n return $http.post($ziggy('auth.password.sms'), credentials);\n },\n passwordUpdate(credentials) {\n return $http.post($ziggy('auth.password.update'), credentials);\n },\n registerShort(credentials) {\n return $http.post($ziggy('auth.register.short'), credentials);\n },\n registerFull(credentials) {\n return $http.post($ziggy('auth.register.full'), credentials);\n },\n registerForm() {\n return $http.post($ziggy('auth.register.form'));\n },\n update(credentials) {\n return $http.post($ziggy('auth.register.update'), credentials);\n },\n};\n","import auth from './modules/auth';\nimport cart from './modules/cart';\nimport compare from './modules/compare';\nimport shop from './modules/shop';\nimport wishlist from './modules/wishlist';\n\nexport default {\n auth,\n cart,\n compare,\n shop,\n wishlist\n};","export default {\n items() {\n return $http.post($ziggy(\"api.cart\"), {\n action: \"get\",\n });\n },\n\n add(item) {\n return $http.post($ziggy(\"api.cart\"), {\n action: \"add\",\n id: item.id,\n quantity: item.quantity,\n options: item.options ? item.options : false\n });\n },\n\n options(item) {\n return $http.post($ziggy(\"api.cart\"), {\n action: \"options\",\n id: item.id,\n options: item.options\n });\n },\n\n addBundle(item) {\n return $http.post($ziggy(\"api.cart\"), {\n action: \"addBundle\",\n id: item.id,\n second: item.second,\n third: item.third\n });\n },\n\n remove(id) {\n return $http.post($ziggy(\"api.cart\"), {\n action: \"remove\",\n id: id\n });\n },\n\n clear() {\n return $http.post($ziggy(\"api.cart\"), {\n action: \"clear\"\n });\n },\n\n quantity(item) {\n return $http.post($ziggy(\"api.cart\"), {\n action: \"quantity\",\n id: item.id,\n exact: item.exact\n });\n },\n}","export default {\n items() {\n return $http.post($ziggy('api.compare'), {\n action: 'get',\n });\n },\n\n category(slug) {\n return $http.post($ziggy('api.compare'), {\n action: 'category',\n slug: slug,\n });\n },\n\n toggle(id) {\n return $http.post($ziggy('api.compare'), {\n action: 'toggle',\n id: id,\n });\n },\n\n delete(id) {\n return $http.post($ziggy('api.compare'), {\n action: 'delete',\n id: id,\n });\n },\n modal(id) {\n return $http.post($ziggy('api.compare'), {\n action: 'modal',\n id: id,\n });\n },\n};\n","export default {\n search(term) {\n return $http.post($ziggy(\"api.search\"), {\n term: term,\n });\n },\n}","export default {\n items() {\n return $http.post($ziggy(\"api.wishlist\"), {\n action: \"get\",\n });\n },\n\n toggle(id) {\n return $http.post($ziggy(\"api.wishlist\"), {\n action: \"toggle\",\n id: id\n });\n },\n}"],"names":["auth","me","$http","post","$ziggy","login","credentials","logout","reset","resetSms","passwordUpdate","registerShort","registerFull","registerForm","update","cart","items","action","add","item","id","quantity","options","addBundle","second","third","remove","clear","exact","compare","category","slug","toggle","modal","shop","search","term","wishlist"],"mappings":"aAAA,MCMe,CACXA,KDPW,CACXC,qBACWC,MAAMC,KAAKC,OAAO,aAE7BC,eAAMC,UACKJ,MAAMC,KAAKC,OAAO,cAAeE,IAE5CC,yBACWL,MAAMC,KAAKC,OAAO,iBAE7BI,eAAMF,UACKJ,MAAMC,KAAKC,OAAO,uBAAwBE,IAErDG,kBAASH,UACEJ,MAAMC,KAAKC,OAAO,qBAAsBE,IAEnDI,wBAAeJ,UACJJ,MAAMC,KAAKC,OAAO,wBAAyBE,IAEtDK,uBAAcL,UACHJ,MAAMC,KAAKC,OAAO,uBAAwBE,IAErDM,sBAAaN,UACFJ,MAAMC,KAAKC,OAAO,sBAAuBE,IAEpDO,+BACWX,MAAMC,KAAKC,OAAO,wBAE7BU,gBAAOR,UACIJ,MAAMC,KAAKC,OAAO,wBAAyBE,KCrBtDS,KCRW,CACXC,wBACWd,MAAMC,KAAKC,OAAO,YAAa,CAClCa,OAAQ,SAIhBC,aAAIC,UACOjB,MAAMC,KAAKC,OAAO,YAAa,CAClCa,OAAQ,MACRG,GAAID,EAAKC,GACTC,SAAUF,EAAKE,SACfC,UAASH,EAAKG,SAAUH,EAAKG,WAIrCA,iBAAQH,UACGjB,MAAMC,KAAKC,OAAO,YAAa,CAClCa,OAAQ,UACRG,GAAID,EAAKC,GACTE,QAASH,EAAKG,WAItBC,mBAAUJ,UACCjB,MAAMC,KAAKC,OAAO,YAAa,CAClCa,OAAQ,YACRG,GAAID,EAAKC,GACTI,OAAQL,EAAKK,OACbC,MAAON,EAAKM,SAIpBC,gBAAON,UACIlB,MAAMC,KAAKC,OAAO,YAAa,CAClCa,OAAQ,SACRG,GAAIA,KAIZO,wBACWzB,MAAMC,KAAKC,OAAO,YAAa,CAClCa,OAAQ,WAIhBI,kBAASF,UACEjB,MAAMC,KAAKC,OAAO,YAAa,CAClCa,OAAQ,WACRG,GAAID,EAAKC,GACTQ,MAAOT,EAAKS,UDzCpBC,QETW,CACXb,wBACWd,MAAMC,KAAKC,OAAO,eAAgB,CACrCa,OAAQ,SAIhBa,kBAASC,UACE7B,MAAMC,KAAKC,OAAO,eAAgB,CACrCa,OAAQ,WACRc,KAAMA,KAIdC,gBAAOZ,UACIlB,MAAMC,KAAKC,OAAO,eAAgB,CACrCa,OAAQ,SACRG,GAAIA,qBAILA,UACIlB,MAAMC,KAAKC,OAAO,eAAgB,CACrCa,OAAQ,SACRG,GAAIA,KAGZa,eAAMb,UACKlB,MAAMC,KAAKC,OAAO,eAAgB,CACrCa,OAAQ,QACRG,GAAIA,MFpBZc,KGVW,CACXC,gBAAOC,UACIlC,MAAMC,KAAKC,OAAO,cAAe,CACpCgC,KAAMA,MHQdC,SIXW,CACXrB,wBACWd,MAAMC,KAAKC,OAAO,gBAAiB,CACtCa,OAAQ,SAIhBe,gBAAOZ,UACIlB,MAAMC,KAAKC,OAAO,gBAAiB,CACtCa,OAAQ,SACRG,GAAIA"}
1
+ {"version":3,"file":"api.js","sources":["../src/api/modules/auth.js","../src/api/index.js","../src/api/modules/cart.js","../src/api/modules/compare.js","../src/api/modules/shop.js","../src/api/modules/wishlist.js"],"sourcesContent":["export default {\n me() {\n return $http.post($ziggy('auth.me'));\n },\n login(credentials) {\n return $http.post($ziggy('auth.login'), credentials);\n },\n logout() {\n return $http.post($ziggy('auth.logout'));\n },\n reset(credentials) {\n return $http.post($ziggy('auth.password.email'), credentials);\n },\n resetSms(credentials) {\n return $http.post($ziggy('auth.password.sms'), credentials);\n },\n passwordUpdate(credentials) {\n return $http.post($ziggy('auth.password.update'), credentials);\n },\n registerShort(credentials) {\n return $http.post($ziggy('auth.register.short'), credentials);\n },\n registerFull(credentials) {\n return $http.post($ziggy('auth.register.full'), credentials);\n },\n registerForm() {\n return $http.post($ziggy('auth.register.form'));\n },\n update(credentials) {\n return $http.post($ziggy('auth.register.update'), credentials);\n },\n};\n","import auth from './modules/auth';\nimport cart from './modules/cart';\nimport compare from './modules/compare';\nimport shop from './modules/shop';\nimport wishlist from './modules/wishlist';\n\nexport default {\n auth,\n cart,\n compare,\n shop,\n wishlist\n};","export default {\n items() {\n return $http.post($ziggy('api.cart'), {\n action: 'get',\n });\n },\n\n add(item) {\n return $http.post($ziggy('api.cart'), {\n action: 'add',\n id: item.id,\n quantity: item.quantity,\n options: item.options ? item.options : false,\n extra: item.extra ? item.extra : false,\n });\n },\n\n options(item) {\n return $http.post($ziggy('api.cart'), {\n action: 'options',\n id: item.id,\n options: item.options,\n });\n },\n\n addBundle(item) {\n return $http.post($ziggy('api.cart'), {\n action: 'addBundle',\n id: item.id,\n second: item.second,\n third: item.third,\n });\n },\n\n remove(id) {\n return $http.post($ziggy('api.cart'), {\n action: 'remove',\n id: id,\n });\n },\n\n clear() {\n return $http.post($ziggy('api.cart'), {\n action: 'clear',\n });\n },\n\n quantity(item) {\n return $http.post($ziggy('api.cart'), {\n action: 'quantity',\n id: item.id,\n exact: item.exact,\n });\n },\n};\n","export default {\n items() {\n return $http.post($ziggy('api.compare'), {\n action: 'get',\n });\n },\n\n category(slug) {\n return $http.post($ziggy('api.compare'), {\n action: 'category',\n slug: slug,\n });\n },\n\n toggle(id) {\n return $http.post($ziggy('api.compare'), {\n action: 'toggle',\n id: id,\n });\n },\n\n delete(id) {\n return $http.post($ziggy('api.compare'), {\n action: 'delete',\n id: id,\n });\n },\n modal(id) {\n return $http.post($ziggy('api.compare'), {\n action: 'modal',\n id: id,\n });\n },\n};\n","export default {\n search(term) {\n return $http.post($ziggy(\"api.search\"), {\n term: term,\n });\n },\n}","export default {\n items() {\n return $http.post($ziggy(\"api.wishlist\"), {\n action: \"get\",\n });\n },\n\n toggle(id) {\n return $http.post($ziggy(\"api.wishlist\"), {\n action: \"toggle\",\n id: id\n });\n },\n}"],"names":["auth","me","$http","post","$ziggy","login","credentials","logout","reset","resetSms","passwordUpdate","registerShort","registerFull","registerForm","update","cart","items","action","add","item","id","quantity","options","extra","addBundle","second","third","remove","clear","exact","compare","category","slug","toggle","modal","shop","search","term","wishlist"],"mappings":"aAAA,MCMe,CACXA,KDPW,CACXC,qBACWC,MAAMC,KAAKC,OAAO,aAE7BC,eAAMC,UACKJ,MAAMC,KAAKC,OAAO,cAAeE,IAE5CC,yBACWL,MAAMC,KAAKC,OAAO,iBAE7BI,eAAMF,UACKJ,MAAMC,KAAKC,OAAO,uBAAwBE,IAErDG,kBAASH,UACEJ,MAAMC,KAAKC,OAAO,qBAAsBE,IAEnDI,wBAAeJ,UACJJ,MAAMC,KAAKC,OAAO,wBAAyBE,IAEtDK,uBAAcL,UACHJ,MAAMC,KAAKC,OAAO,uBAAwBE,IAErDM,sBAAaN,UACFJ,MAAMC,KAAKC,OAAO,sBAAuBE,IAEpDO,+BACWX,MAAMC,KAAKC,OAAO,wBAE7BU,gBAAOR,UACIJ,MAAMC,KAAKC,OAAO,wBAAyBE,KCrBtDS,KCRW,CACXC,wBACWd,MAAMC,KAAKC,OAAO,YAAa,CAClCa,OAAQ,SAIhBC,aAAIC,UACOjB,MAAMC,KAAKC,OAAO,YAAa,CAClCa,OAAQ,MACRG,GAAID,EAAKC,GACTC,SAAUF,EAAKE,SACfC,UAASH,EAAKG,SAAUH,EAAKG,QAC7BC,QAAOJ,EAAKI,OAAQJ,EAAKI,SAIjCD,iBAAQH,UACGjB,MAAMC,KAAKC,OAAO,YAAa,CAClCa,OAAQ,UACRG,GAAID,EAAKC,GACTE,QAASH,EAAKG,WAItBE,mBAAUL,UACCjB,MAAMC,KAAKC,OAAO,YAAa,CAClCa,OAAQ,YACRG,GAAID,EAAKC,GACTK,OAAQN,EAAKM,OACbC,MAAOP,EAAKO,SAIpBC,gBAAOP,UACIlB,MAAMC,KAAKC,OAAO,YAAa,CAClCa,OAAQ,SACRG,GAAIA,KAIZQ,wBACW1B,MAAMC,KAAKC,OAAO,YAAa,CAClCa,OAAQ,WAIhBI,kBAASF,UACEjB,MAAMC,KAAKC,OAAO,YAAa,CAClCa,OAAQ,WACRG,GAAID,EAAKC,GACTS,MAAOV,EAAKU,UD1CpBC,QETW,CACXd,wBACWd,MAAMC,KAAKC,OAAO,eAAgB,CACrCa,OAAQ,SAIhBc,kBAASC,UACE9B,MAAMC,KAAKC,OAAO,eAAgB,CACrCa,OAAQ,WACRe,KAAMA,KAIdC,gBAAOb,UACIlB,MAAMC,KAAKC,OAAO,eAAgB,CACrCa,OAAQ,SACRG,GAAIA,qBAILA,UACIlB,MAAMC,KAAKC,OAAO,eAAgB,CACrCa,OAAQ,SACRG,GAAIA,KAGZc,eAAMd,UACKlB,MAAMC,KAAKC,OAAO,eAAgB,CACrCa,OAAQ,QACRG,GAAIA,MFpBZe,KGVW,CACXC,gBAAOC,UACInC,MAAMC,KAAKC,OAAO,cAAe,CACpCiC,KAAMA,MHQdC,SIXW,CACXtB,wBACWd,MAAMC,KAAKC,OAAO,gBAAiB,CACtCa,OAAQ,SAIhBgB,gBAAOb,UACIlB,MAAMC,KAAKC,OAAO,gBAAiB,CACtCa,OAAQ,SACRG,GAAIA"}
@@ -1,2 +1,2 @@
1
- "use strict";var t=require("vue").defineAsyncComponent((function(){return new Promise((function(t,e){$http.post($ziggy("api.wishlist"),{action:"list"}).then((function(e){t({template:e.data,mounted:function(){window.lazyImages.update()}})}))}))}));module.exports=t;
1
+ "use strict";var e=require("vue"),o=e.defineAsyncComponent((function(){return new Promise((function(o,n){$http.post($ziggy("api.wishlist"),{action:"list"}).then((function(n){o({template:n.data,mounted:function(){window.lazyImages.update(),e.nextTick((function(){window.promoCodeCallback&&"function"==typeof window.promoCodeCallback&&window.promoCodeCallback(document.getElementById("viewed"))}))}})}))}))}));module.exports=o;
2
2
  //# sourceMappingURL=Wish.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Wish.js","sources":["../../../src/components/account/Wish.vue"],"sourcesContent":["<script>\nimport { defineAsyncComponent } from \"vue\";\n\nexport default defineAsyncComponent(\n () =>\n new Promise((resolve, reject) => {\n $http\n .post($ziggy(\"api.wishlist\"), {\n action: \"list\",\n })\n .then((response) => {\n resolve({\n template: response.data,\n mounted() {\n window.lazyImages.update();\n },\n });\n });\n })\n);\n</script>\n"],"names":["Promise","resolve","reject","$http","post","$ziggy","action","then","response","template","data","mounted","window","lazyImages","update"],"mappings":"wDAII,kBACI,IAAIA,SAAQ,SAACC,EAASC,GAClBC,MACKC,KAAKC,OAAO,gBAAiB,CAC1BC,OAAQ,SAEXC,MAAK,SAACC,GACHP,EAAQ,CACJQ,SAAUD,EAASE,KACnBC,mBACIC,OAAOC,WAAWC"}
1
+ {"version":3,"file":"Wish.js","sources":["../../../src/components/account/Wish.vue"],"sourcesContent":["<script>\nimport { defineAsyncComponent, nextTick } from \"vue\";\n\nexport default defineAsyncComponent(\n () =>\n new Promise((resolve, reject) => {\n $http\n .post($ziggy(\"api.wishlist\"), {\n action: \"list\",\n })\n .then((response) => {\n resolve({\n template: response.data,\n mounted() {\n window.lazyImages.update();\n\n nextTick(() => {\n if (window.promoCodeCallback && typeof window.promoCodeCallback === 'function') {\n window.promoCodeCallback(document.getElementById('viewed'));\n }\n });\n },\n });\n });\n })\n);\n</script>\n"],"names":["defineAsyncComponent","Promise","resolve","reject","$http","post","$ziggy","action","then","response","template","data","mounted","window","lazyImages","update","nextTick","promoCodeCallback","document","getElementById"],"mappings":"oCAGeA,wBACX,kBACI,IAAIC,SAAQ,SAACC,EAASC,GAClBC,MACKC,KAAKC,OAAO,gBAAiB,CAC1BC,OAAQ,SAEXC,MAAK,SAACC,GACHP,EAAQ,CACJQ,SAAUD,EAASE,KACnBC,mBACIC,OAAOC,WAAWC,SAElBC,YAAS,WACDH,OAAOI,mBAAyD,mBAA7BJ,OAAOI,mBAC1CJ,OAAOI,kBAAkBC,SAASC,eAAe"}
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("vue"),t=require("vuex"),o=require("formvuelate"),r=require("@formvuelate/plugin-vee-validate"),a=require("@perevorot/shop/dist/forms/FormText"),n=require("@perevorot/shop/dist/forms/FormPassword"),l=require("yup");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function c(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(o){if("default"!==o){var r=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,r.get?r:{enumerable:!0,get:function(){return e[o]}})}})),t.default=e,Object.freeze(t)}var s=i(r),u=i(a),d=i(n),f=c(l);function m(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==o)return;var r,a,n=[],l=!0,i=!1;try{for(o=o.call(e);!(l=(r=o.next()).done)&&(n.push(r.value),!t||n.length!==t);l=!0);}catch(e){i=!0,a=e}finally{try{l||null==o.return||o.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return p(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);"Object"===o&&e.constructor&&(o=e.constructor.name);if("Map"===o||"Set"===o)return Array.from(e);if("Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return p(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,r=new Array(t);o<t;o++)r[o]=e[o];return r}e.markRaw(u.default);var h=o.SchemaFormFactory([s.default({})]),v={props:m({loginCallback:{type:Function,default:function(){}},forgetType:{type:String,default:"email"},showPlaceholders:{type:Boolean,default:!1}},"showPlaceholders",{type:Boolean,default:!1}),name:"login",components:{SchemaForm:h},setup:function(r){var a,n=e.ref(!1),l=t.useStore(),i=e.ref(0),c=e.ref({}),s=e.computed((function(){return l.getters["auth/modal"]})),p=e.ref({email:{component:u.default,label:__("auth.login.form.email"),store:"login",model:"email",placeholder:r.showPlaceholders?__("auth.login.form.email"):""},password:{component:d.default,label:__("auth.login.form.password"),placeholder:r.showPlaceholders?__("auth.login.form.password"):""}}),h=f.object().shape({email:f.string().email(__("auth.validation.email")).required(__("auth.validation.required")),password:f.string().required(__("auth.validation.required"))}),v=e.ref({email:"",password:""});o.useSchemaForm(v);return m(a={loading:n,modal:s,schema:p,validation:h,reset:function(){l.commit("auth/modal","forget")},facebook:function(){window.location.href=$ziggy("auth.login.social",{provider:"facebook"})},google:function(){window.location.href=$ziggy("auth.login.social",{provider:"google"})}},"schema",p),m(a,"onSubmit",(function(){n.value=!0,l.dispatch("auth/login",{credentials:v.value,callback:function(){r.loginCallback&&r.loginCallback()},finally:function(){n.value=!1},catch:function(e){if(e.response.data&&e.response.data.errors){for(var t=0,o=Object.entries(e.response.data.errors);t<o.length;t++){var r=g(o[t],2),a=r[0],n=r[1];n[0]&&(c.value[a]=n[0])}v.value.password="",i.value++}}})})),m(a,"errors",c),m(a,"key",i),m(a,"model",v),m(a,"register",(function(){l.commit("auth/modal","registration")})),a}},y={class:"auth-login"},b={class:"title"},w={class:"href-forget-password"},k={class:"field"},_={class:"socials"},E={class:"description has-text-centered"},S={class:"buttons"},N=[e.createElementVNode("svg",{class:"icon fb-btn"},[e.createElementVNode("use",{"xlink:href":"#logo-facebook-icon"})],-1),e.createElementVNode("span",null,"Facebook",-1)],V=[e.createElementVNode("svg",{class:"icon google-btn"},[e.createElementVNode("use",{"xlink:href":"#logo-google-icon"})],-1),e.createElementVNode("span",null,"Google",-1)],C={class:"href-register"};v.render=function(t,o,r,a,n,l){var i=e.resolveComponent("SchemaForm"),c=e.resolveComponent("forget");return e.openBlock(),e.createElementBlock("div",y,[e.withDirectives(e.createElementVNode("div",null,[e.createElementVNode("div",b,e.toDisplayString(t.__("auth.login.title")),1),(e.openBlock(),e.createBlock(i,{schemaRowClasses:"field",schema:a.schema,"validation-schema":a.validation,"initial-errors":a.errors,key:a.key,onSubmit:a.onSubmit},{afterForm:e.withCtx((function(){return[e.createElementVNode("div",w,[e.createElementVNode("a",{onClick:o[0]||(o[0]=function(){return a.reset&&a.reset.apply(a,arguments)})},e.toDisplayString(t.__("auth.login.forget_password")),1)]),e.createElementVNode("div",k,[e.createElementVNode("button",{class:e.normalizeClass(["button is-link",{"is-loading":a.loading}]),type:"submit"},e.toDisplayString(t.__("auth.login.form.submit")),3)]),e.createElementVNode("div",_,[e.createElementVNode("div",E,e.toDisplayString(t.__("auth.login.socials")),1),e.createElementVNode("div",S,[e.createElementVNode("a",{class:"button",onClick:o[1]||(o[1]=function(){return a.facebook&&a.facebook.apply(a,arguments)})},N),e.createElementVNode("a",{class:"button",onClick:o[2]||(o[2]=function(){return a.google&&a.google.apply(a,arguments)})},V)])]),e.createElementVNode("div",C,[e.createElementVNode("a",{onClick:o[3]||(o[3]=function(){return a.register&&a.register.apply(a,arguments)})},e.toDisplayString(t.__("auth.login.signup")),1)])]})),_:1},8,["schema","validation-schema","initial-errors","onSubmit"]))],512),[[e.vShow,"login"==a.modal]]),"forget"==a.modal?(e.openBlock(),e.createBlock(c,{key:0,email:a.model.email,"forget-type":r.forgetType,"show-placeholders":r.showPlaceholders},null,8,["email","forget-type","show-placeholders"])):e.createCommentVNode("v-if",!0)])},module.exports=v;
1
+ "use strict";var e=require("vue"),t=require("vuex"),o=require("formvuelate"),r=require("@formvuelate/plugin-vee-validate"),a=require("@perevorot/shop/dist/forms/FormText"),n=require("@perevorot/shop/dist/forms/FormPassword"),l=require("yup");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function c(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(o){if("default"!==o){var r=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,r.get?r:{enumerable:!0,get:function(){return e[o]}})}})),t.default=e,Object.freeze(t)}var s=i(r),u=i(a),d=i(n),m=c(l);function f(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==o)return;var r,a,n=[],l=!0,i=!1;try{for(o=o.call(e);!(l=(r=o.next()).done)&&(n.push(r.value),!t||n.length!==t);l=!0);}catch(e){i=!0,a=e}finally{try{l||null==o.return||o.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return p(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);"Object"===o&&e.constructor&&(o=e.constructor.name);if("Map"===o||"Set"===o)return Array.from(e);if("Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return p(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,r=new Array(t);o<t;o++)r[o]=e[o];return r}e.markRaw(u.default);var h=o.SchemaFormFactory([s.default({})]),v={props:f({loginCallback:{type:Function,default:function(){}},forgetType:{type:String,default:"email"},showPlaceholders:{type:Boolean,default:!1}},"showPlaceholders",{type:Boolean,default:!1}),name:"login",components:{SchemaForm:h},setup:function(r){var a,n=e.ref(!1),l=t.useStore(),i=e.ref(0),c=e.ref({}),s=e.computed((function(){return l.getters["auth/modal"]})),p=e.ref({email:{component:u.default,label:__("auth.login.form.email"),store:"login",model:"email",placeholder:r.showPlaceholders?__("auth.login.form.email"):""},password:{component:d.default,label:__("auth.login.form.password"),placeholder:r.showPlaceholders?__("auth.login.form.password"):""}}),h=m.object().shape({email:m.string().email(__("auth.validation.email")).required(__("auth.validation.required")),password:m.string().required(__("auth.validation.required"))}),v=e.ref({email:"",password:""});o.useSchemaForm(v);return f(a={loading:n,modal:s,schema:p,validation:h,reset:function(){l.commit("auth/modal","forget")},facebook:function(){window.location.href=$ziggy("auth.login.social",{provider:"facebook"})},google:function(){window.location.href=$ziggy("auth.login.social",{provider:"google"})}},"schema",p),f(a,"onSubmit",(function(){n.value=!0,l.dispatch("auth/login",{credentials:v.value,callback:function(e){if(r.loginCallback&&r.loginCallback(),e.data&&e.data.user&&!e.data.user.is_login_tracked){var t={event:"login",user_id:e.data.user.id,method:"site"};$env.debug.ecommerce&&console.log(t),!$env.debug.ecommerce&&window.dataLayer&&(window.dataLayer.push({ecommerce:null}),window.dataLayer.push(t))}},finally:function(){n.value=!1},catch:function(e){if(e.response.data&&e.response.data.errors){for(var t=0,o=Object.entries(e.response.data.errors);t<o.length;t++){var r=g(o[t],2),a=r[0],n=r[1];n[0]&&(c.value[a]=n[0])}v.value.password="",i.value++}}})})),f(a,"errors",c),f(a,"key",i),f(a,"model",v),f(a,"register",(function(){l.commit("auth/modal","registration")})),a}},y={class:"auth-login"},b={class:"title"},w={class:"href-forget-password"},_={class:"field"},k={class:"socials"},E={class:"description has-text-centered"},S={class:"buttons"},N=[e.createElementVNode("svg",{class:"icon fb-btn"},[e.createElementVNode("use",{"xlink:href":"#logo-facebook-icon"})],-1),e.createElementVNode("span",null,"Facebook",-1)],V=[e.createElementVNode("svg",{class:"icon google-btn"},[e.createElementVNode("use",{"xlink:href":"#logo-google-icon"})],-1),e.createElementVNode("span",null,"Google",-1)],C={class:"href-register"};v.render=function(t,o,r,a,n,l){var i=e.resolveComponent("SchemaForm"),c=e.resolveComponent("forget");return e.openBlock(),e.createElementBlock("div",y,[e.withDirectives(e.createElementVNode("div",null,[e.createElementVNode("div",b,e.toDisplayString(t.__("auth.login.title")),1),(e.openBlock(),e.createBlock(i,{schemaRowClasses:"field",schema:a.schema,"validation-schema":a.validation,"initial-errors":a.errors,key:a.key,onSubmit:a.onSubmit},{afterForm:e.withCtx((function(){return[e.createElementVNode("div",w,[e.createElementVNode("a",{onClick:o[0]||(o[0]=function(){return a.reset&&a.reset.apply(a,arguments)})},e.toDisplayString(t.__("auth.login.forget_password")),1)]),e.createElementVNode("div",_,[e.createElementVNode("button",{class:e.normalizeClass(["button is-link",{"is-loading":a.loading}]),type:"submit"},e.toDisplayString(t.__("auth.login.form.submit")),3)]),e.createElementVNode("div",k,[e.createElementVNode("div",E,e.toDisplayString(t.__("auth.login.socials")),1),e.createElementVNode("div",S,[e.createElementVNode("a",{class:"button",onClick:o[1]||(o[1]=function(){return a.facebook&&a.facebook.apply(a,arguments)})},N),e.createElementVNode("a",{class:"button",onClick:o[2]||(o[2]=function(){return a.google&&a.google.apply(a,arguments)})},V)])]),e.createElementVNode("div",C,[e.createElementVNode("a",{onClick:o[3]||(o[3]=function(){return a.register&&a.register.apply(a,arguments)})},e.toDisplayString(t.__("auth.login.signup")),1)])]})),_:1},8,["schema","validation-schema","initial-errors","onSubmit"]))],512),[[e.vShow,"login"==a.modal]]),"forget"==a.modal?(e.openBlock(),e.createBlock(c,{key:0,email:a.model.email,"forget-type":r.forgetType,"show-placeholders":r.showPlaceholders},null,8,["email","forget-type","show-placeholders"])):e.createCommentVNode("v-if",!0)])},module.exports=v;
2
2
  //# sourceMappingURL=Login.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Login.js","sources":["../../../src/components/auth/Login.vue","../../../src/components/auth/Login.vue?vue&type=template&id=159a530e&lang.js"],"sourcesContent":["<template>\n <div class=\"auth-login\">\n <div v-show=\"modal == 'login'\">\n <div class=\"title\">{{ __('auth.login.title') }}</div>\n <SchemaForm schemaRowClasses=\"field\" :schema=\"schema\" :validation-schema=\"validation\" :initial-errors=\"errors\" :key=\"key\" @submit=\"onSubmit\">\n <template #afterForm>\n <div class=\"href-forget-password\">\n <a @click=\"reset\">{{ __('auth.login.forget_password') }}</a>\n </div>\n <div class=\"field\">\n <button class=\"button is-link\" type=\"submit\" v-bind:class=\"{ 'is-loading': loading }\">{{ __('auth.login.form.submit') }}</button>\n </div>\n <div class=\"socials\">\n <div class=\"description has-text-centered\">{{ __('auth.login.socials') }}</div>\n <div class=\"buttons\">\n <a class=\"button\" @click=\"facebook\">\n <svg class=\"icon fb-btn\">\n <use xlink:href=\"#logo-facebook-icon\" />\n </svg>\n <span>Facebook</span>\n </a>\n <a class=\"button\" @click=\"google\">\n <svg class=\"icon google-btn\">\n <use xlink:href=\"#logo-google-icon\" />\n </svg>\n <span>Google</span>\n </a>\n </div>\n </div>\n <div class=\"href-register\">\n <a @click=\"register\">{{ __('auth.login.signup') }}</a>\n </div>\n </template>\n </SchemaForm>\n </div>\n\n <forget v-if=\"modal == 'forget'\" :email=\"model.email\" :forget-type=\"forgetType\" :show-placeholders=\"showPlaceholders\"></forget>\n </div>\n</template>\n<script>\nimport { ref, markRaw, computed } from 'vue';\nimport { useStore } from 'vuex';\nimport { SchemaFormFactory, useSchemaForm } from 'formvuelate';\nimport VeeValidatePlugin from '@formvuelate/plugin-vee-validate';\nimport FormText from '@perevorot/shop/dist/forms/FormText';\nimport FormPassword from '@perevorot/shop/dist/forms/FormPassword';\nimport * as yup from 'yup';\n\nmarkRaw(FormText);\n\nconst SchemaForm = SchemaFormFactory([VeeValidatePlugin({})]);\n\nexport default {\n props: {\n loginCallback: {\n type: Function,\n default: () => { }\n },\n forgetType: {\n type: String,\n default: 'email'\n },\n showPlaceholders: {\n type: Boolean,\n default: false\n },\n showPlaceholders: {\n type: Boolean,\n default: false\n }\n },\n name: 'login',\n components: {\n SchemaForm\n },\n setup(props) {\n const loading = ref(false);\n const store = useStore();\n const key = ref(0);\n const errors = ref({});\n const modal = computed(() => store.getters['auth/modal']);\n\n const schema = ref({\n email: {\n component: FormText,\n label: __('auth.login.form.email'),\n store: 'login',\n model: 'email',\n placeholder: props.showPlaceholders ? __('auth.login.form.email') : '',\n },\n password: {\n component: FormPassword,\n label: __('auth.login.form.password'),\n placeholder: props.showPlaceholders ? __('auth.login.form.password') : '',\n }\n });\n\n const validation = yup.object().shape({\n email: yup.string().email(__('auth.validation.email')).required(__('auth.validation.required')),\n password: yup.string().required(__('auth.validation.required'))\n });\n\n const model = ref({\n email: '',\n password: ''\n });\n\n useSchemaForm(model);\n\n const reset = () => {\n store.commit('auth/modal', 'forget');\n };\n\n const register = () => {\n store.commit('auth/modal', 'registration');\n };\n\n const facebook = () => {\n window.location.href = $ziggy('auth.login.social', {\n provider: 'facebook'\n });\n };\n\n const google = () => {\n window.location.href = $ziggy('auth.login.social', {\n provider: 'google'\n });\n };\n\n const onSubmit = () => {\n loading.value = true;\n\n store.dispatch('auth/login', {\n credentials: model.value,\n callback: () => {\n if (props.loginCallback) {\n props.loginCallback();\n }\n },\n finally: () => {\n loading.value = false;\n },\n catch: (error) => {\n if (error.response.data && error.response.data.errors) {\n for (const [field, messages] of Object.entries(error.response.data.errors)) {\n if (messages[0]) {\n errors.value[field] = messages[0];\n }\n }\n\n model.value.password = '';\n\n key.value++;\n }\n }\n });\n };\n\n return {\n loading,\n modal,\n schema,\n validation,\n reset,\n facebook,\n google,\n schema,\n onSubmit,\n errors,\n key,\n model,\n register\n };\n }\n};\n</script>","<template>\n <div class=\"auth-login\">\n <div v-show=\"modal == 'login'\">\n <div class=\"title\">{{ __('auth.login.title') }}</div>\n <SchemaForm schemaRowClasses=\"field\" :schema=\"schema\" :validation-schema=\"validation\" :initial-errors=\"errors\" :key=\"key\" @submit=\"onSubmit\">\n <template #afterForm>\n <div class=\"href-forget-password\">\n <a @click=\"reset\">{{ __('auth.login.forget_password') }}</a>\n </div>\n <div class=\"field\">\n <button class=\"button is-link\" type=\"submit\" v-bind:class=\"{ 'is-loading': loading }\">{{ __('auth.login.form.submit') }}</button>\n </div>\n <div class=\"socials\">\n <div class=\"description has-text-centered\">{{ __('auth.login.socials') }}</div>\n <div class=\"buttons\">\n <a class=\"button\" @click=\"facebook\">\n <svg class=\"icon fb-btn\">\n <use xlink:href=\"#logo-facebook-icon\" />\n </svg>\n <span>Facebook</span>\n </a>\n <a class=\"button\" @click=\"google\">\n <svg class=\"icon google-btn\">\n <use xlink:href=\"#logo-google-icon\" />\n </svg>\n <span>Google</span>\n </a>\n </div>\n </div>\n <div class=\"href-register\">\n <a @click=\"register\">{{ __('auth.login.signup') }}</a>\n </div>\n </template>\n </SchemaForm>\n </div>\n\n <forget v-if=\"modal == 'forget'\" :email=\"model.email\" :forget-type=\"forgetType\" :show-placeholders=\"showPlaceholders\"></forget>\n </div>\n</template>\n<script>\nimport { ref, markRaw, computed } from 'vue';\nimport { useStore } from 'vuex';\nimport { SchemaFormFactory, useSchemaForm } from 'formvuelate';\nimport VeeValidatePlugin from '@formvuelate/plugin-vee-validate';\nimport FormText from '@perevorot/shop/dist/forms/FormText';\nimport FormPassword from '@perevorot/shop/dist/forms/FormPassword';\nimport * as yup from 'yup';\n\nmarkRaw(FormText);\n\nconst SchemaForm = SchemaFormFactory([VeeValidatePlugin({})]);\n\nexport default {\n props: {\n loginCallback: {\n type: Function,\n default: () => { }\n },\n forgetType: {\n type: String,\n default: 'email'\n },\n showPlaceholders: {\n type: Boolean,\n default: false\n },\n showPlaceholders: {\n type: Boolean,\n default: false\n }\n },\n name: 'login',\n components: {\n SchemaForm\n },\n setup(props) {\n const loading = ref(false);\n const store = useStore();\n const key = ref(0);\n const errors = ref({});\n const modal = computed(() => store.getters['auth/modal']);\n\n const schema = ref({\n email: {\n component: FormText,\n label: __('auth.login.form.email'),\n store: 'login',\n model: 'email',\n placeholder: props.showPlaceholders ? __('auth.login.form.email') : '',\n },\n password: {\n component: FormPassword,\n label: __('auth.login.form.password'),\n placeholder: props.showPlaceholders ? __('auth.login.form.password') : '',\n }\n });\n\n const validation = yup.object().shape({\n email: yup.string().email(__('auth.validation.email')).required(__('auth.validation.required')),\n password: yup.string().required(__('auth.validation.required'))\n });\n\n const model = ref({\n email: '',\n password: ''\n });\n\n useSchemaForm(model);\n\n const reset = () => {\n store.commit('auth/modal', 'forget');\n };\n\n const register = () => {\n store.commit('auth/modal', 'registration');\n };\n\n const facebook = () => {\n window.location.href = $ziggy('auth.login.social', {\n provider: 'facebook'\n });\n };\n\n const google = () => {\n window.location.href = $ziggy('auth.login.social', {\n provider: 'google'\n });\n };\n\n const onSubmit = () => {\n loading.value = true;\n\n store.dispatch('auth/login', {\n credentials: model.value,\n callback: () => {\n if (props.loginCallback) {\n props.loginCallback();\n }\n },\n finally: () => {\n loading.value = false;\n },\n catch: (error) => {\n if (error.response.data && error.response.data.errors) {\n for (const [field, messages] of Object.entries(error.response.data.errors)) {\n if (messages[0]) {\n errors.value[field] = messages[0];\n }\n }\n\n model.value.password = '';\n\n key.value++;\n }\n }\n });\n };\n\n return {\n loading,\n modal,\n schema,\n validation,\n reset,\n facebook,\n google,\n schema,\n onSubmit,\n errors,\n key,\n model,\n register\n };\n }\n};\n</script>"],"names":["markRaw","FormText","SchemaForm","SchemaFormFactory","VeeValidatePlugin","props","loginCallback","type","Function","forgetType","String","showPlaceholders","Boolean","name","components","setup","loading","ref","store","useStore","key","errors","modal","computed","getters","schema","email","component","label","__","model","placeholder","password","FormPassword","validation","yup","object","shape","string","required","useSchemaForm","reset","commit","facebook","window","location","href","$ziggy","provider","google","value","dispatch","credentials","callback","error","response","data","Object","entries","field","messages","_createElementVNode","_createElementBlock","_hoisted_1","_hoisted_2","_ctx","_createBlock","schemaRowClasses","$setup","onSubmit","afterForm","_hoisted_3","onClick","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_14","$props"],"mappings":"isDAgDAA,UAAQC,WAER,IAAMC,EAAaC,oBAAkB,CAACC,UAAkB,QAEzC,CACXC,SACIC,cAAe,CACXC,KAAMC,iBACG,cAEbC,WAAY,CACRF,KAAMG,eACG,SAEbC,iBAAkB,CACdJ,KAAMK,iBACG,uBAEK,CACdL,KAAMK,iBACG,IAGjBC,KAAM,QACNC,WAAY,CACRZ,WAAAA,GAEJa,eAAMV,SACIW,EAAUC,OAAI,GACdC,EAAQC,aACRC,EAAMH,MAAI,GACVI,EAASJ,MAAI,IACbK,EAAQC,YAAS,kBAAML,EAAMM,QAAQ,iBAErCC,EAASR,MAAI,CACfS,MAAO,CACHC,UAAW1B,UACX2B,MAAOC,GAAG,yBACVX,MAAO,QACPY,MAAO,QACPC,YAAa1B,EAAMM,iBAAmBkB,GAAG,yBAA2B,IAExEG,SAAU,CACNL,UAAWM,UACXL,MAAOC,GAAG,4BACVE,YAAa1B,EAAMM,iBAAmBkB,GAAG,4BAA8B,MAIzEK,EAAaC,EAAIC,SAASC,MAAM,CAClCX,MAAOS,EAAIG,SAASZ,MAAMG,GAAG,0BAA0BU,SAASV,GAAG,6BACnEG,SAAUG,EAAIG,SAASC,SAASV,GAAG,+BAGjCC,EAAQb,MAAI,CACdS,MAAO,GACPM,SAAU,KAGdQ,gBAAcV,eAoDVd,QAAAA,EACAM,MAAAA,EACAG,OAAAA,EACAS,WAAAA,EACAO,MAtDU,WACVvB,EAAMwB,OAAO,aAAc,WAsD3BC,SA/Ca,WACbC,OAAOC,SAASC,KAAOC,OAAO,oBAAqB,CAC/CC,SAAU,cA8CdC,OA1CW,WACXL,OAAOC,SAASC,KAAOC,OAAO,oBAAqB,CAC/CC,SAAU,sBAyCdvB,mBArCa,WACbT,EAAQkC,OAAQ,EAEhBhC,EAAMiC,SAAS,aAAc,CACzBC,YAAatB,EAAMoB,MACnBG,SAAU,WACFhD,EAAMC,eACND,EAAMC,yBAGL,WACLU,EAAQkC,OAAQ,SAEb,SAACI,MACAA,EAAMC,SAASC,MAAQF,EAAMC,SAASC,KAAKnC,OAAQ,eACnBoC,OAAOC,QAAQJ,EAAMC,SAASC,KAAKnC,uBAAS,iBAAhEsC,OAAOC,OACXA,EAAS,KACTvC,EAAO6B,MAAMS,GAASC,EAAS,IAIvC9B,EAAMoB,MAAMlB,SAAW,GAEvBZ,EAAI8B,4BAgBhB7B,aACAD,eACAU,mBAzDa,WACbZ,EAAMwB,OAAO,aAAc,gCCjHxB,uBAEQ,kBAGQ,iCAGA,kBAGA,oBACI,0CACA,cAEHmB,kCAAW,gBACPA,yCAAgB,6BAEpBA,iCAAM,mBAGNA,kCAAW,oBACPA,yCAAgB,2BAEpBA,iCAAM,uBAIP,2IA5B3BC,2BAAAC,oBACIF,iCACIA,2BAAAG,oBAAsBC,4CACtBC,iBAAYC,iBAAiB,QAAS1C,OAAQ2C,6BAA4BA,8BAA6BA,SAAShD,IAAKgD,MAAMC,SAAQD,aACpHE,qBACP,kBAAAT,2BAAAU,GACIV,0BAAIW,sCAAOJ,yDAAUH,yCAEzBJ,2BAAAY,GACIZ,uDAAc,+BAA6DO,aAA5C7D,KAAK,4BAAqD0D,qCAE7FJ,2BAAAa,GACIb,2BAAAc,oBAA8CV,+BAC9CJ,2BAAAe,GACIf,gCAAS,SAAUW,sCAAOJ,gDAM1BP,gCAAS,SAAUW,sCAAOJ,gDAQlCP,2BAAAgB,GACIhB,0BAAIW,sCAAOJ,+DAAaH,iIA5B3BG,qBAkCCA,uBAAdF,uBAAkCxC,MAAO0C,QAAM1C,oBAAqBoD,iCAAgCA"}
1
+ {"version":3,"file":"Login.js","sources":["../../../src/components/auth/Login.vue","../../../src/components/auth/Login.vue?vue&type=template&id=333cd1ae&lang.js"],"sourcesContent":["<template>\n <div class=\"auth-login\">\n <div v-show=\"modal == 'login'\">\n <div class=\"title\">{{ __('auth.login.title') }}</div>\n <SchemaForm schemaRowClasses=\"field\" :schema=\"schema\" :validation-schema=\"validation\" :initial-errors=\"errors\" :key=\"key\" @submit=\"onSubmit\">\n <template #afterForm>\n <div class=\"href-forget-password\">\n <a @click=\"reset\">{{ __('auth.login.forget_password') }}</a>\n </div>\n <div class=\"field\">\n <button class=\"button is-link\" type=\"submit\" v-bind:class=\"{ 'is-loading': loading }\">{{ __('auth.login.form.submit') }}</button>\n </div>\n <div class=\"socials\">\n <div class=\"description has-text-centered\">{{ __('auth.login.socials') }}</div>\n <div class=\"buttons\">\n <a class=\"button\" @click=\"facebook\">\n <svg class=\"icon fb-btn\">\n <use xlink:href=\"#logo-facebook-icon\" />\n </svg>\n <span>Facebook</span>\n </a>\n <a class=\"button\" @click=\"google\">\n <svg class=\"icon google-btn\">\n <use xlink:href=\"#logo-google-icon\" />\n </svg>\n <span>Google</span>\n </a>\n </div>\n </div>\n <div class=\"href-register\">\n <a @click=\"register\">{{ __('auth.login.signup') }}</a>\n </div>\n </template>\n </SchemaForm>\n </div>\n\n <forget v-if=\"modal == 'forget'\" :email=\"model.email\" :forget-type=\"forgetType\" :show-placeholders=\"showPlaceholders\"></forget>\n </div>\n</template>\n<script>\nimport { ref, markRaw, computed } from 'vue';\nimport { useStore } from 'vuex';\nimport { SchemaFormFactory, useSchemaForm } from 'formvuelate';\nimport VeeValidatePlugin from '@formvuelate/plugin-vee-validate';\nimport FormText from '@perevorot/shop/dist/forms/FormText';\nimport FormPassword from '@perevorot/shop/dist/forms/FormPassword';\nimport * as yup from 'yup';\n\nmarkRaw(FormText);\n\nconst SchemaForm = SchemaFormFactory([VeeValidatePlugin({})]);\n\nexport default {\n props: {\n loginCallback: {\n type: Function,\n default: () => { }\n },\n forgetType: {\n type: String,\n default: 'email'\n },\n showPlaceholders: {\n type: Boolean,\n default: false\n },\n showPlaceholders: {\n type: Boolean,\n default: false\n }\n },\n name: 'login',\n components: {\n SchemaForm\n },\n setup(props) {\n const loading = ref(false);\n const store = useStore();\n const key = ref(0);\n const errors = ref({});\n const modal = computed(() => store.getters['auth/modal']);\n\n const schema = ref({\n email: {\n component: FormText,\n label: __('auth.login.form.email'),\n store: 'login',\n model: 'email',\n placeholder: props.showPlaceholders ? __('auth.login.form.email') : '',\n },\n password: {\n component: FormPassword,\n label: __('auth.login.form.password'),\n placeholder: props.showPlaceholders ? __('auth.login.form.password') : '',\n }\n });\n\n const validation = yup.object().shape({\n email: yup.string().email(__('auth.validation.email')).required(__('auth.validation.required')),\n password: yup.string().required(__('auth.validation.required'))\n });\n\n const model = ref({\n email: '',\n password: ''\n });\n\n useSchemaForm(model);\n\n const reset = () => {\n store.commit('auth/modal', 'forget');\n };\n\n const register = () => {\n store.commit('auth/modal', 'registration');\n };\n\n const facebook = () => {\n window.location.href = $ziggy('auth.login.social', {\n provider: 'facebook'\n });\n };\n\n const google = () => {\n window.location.href = $ziggy('auth.login.social', {\n provider: 'google'\n });\n };\n\n const onSubmit = () => {\n loading.value = true;\n\n store.dispatch('auth/login', {\n credentials: model.value,\n callback: (response) => {\n if (props.loginCallback) {\n props.loginCallback();\n }\n\n if (response.data && response.data.user && !response.data.user.is_login_tracked) {\n let object = {\n event: 'login',\n user_id: response.data.user.id,\n method: 'site'\n };\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n }\n },\n finally: () => {\n loading.value = false;\n },\n catch: (error) => {\n if (error.response.data && error.response.data.errors) {\n for (const [field, messages] of Object.entries(error.response.data.errors)) {\n if (messages[0]) {\n errors.value[field] = messages[0];\n }\n }\n\n model.value.password = '';\n\n key.value++;\n }\n }\n });\n };\n\n return {\n loading,\n modal,\n schema,\n validation,\n reset,\n facebook,\n google,\n schema,\n onSubmit,\n errors,\n key,\n model,\n register\n };\n }\n};\n</script>","<template>\n <div class=\"auth-login\">\n <div v-show=\"modal == 'login'\">\n <div class=\"title\">{{ __('auth.login.title') }}</div>\n <SchemaForm schemaRowClasses=\"field\" :schema=\"schema\" :validation-schema=\"validation\" :initial-errors=\"errors\" :key=\"key\" @submit=\"onSubmit\">\n <template #afterForm>\n <div class=\"href-forget-password\">\n <a @click=\"reset\">{{ __('auth.login.forget_password') }}</a>\n </div>\n <div class=\"field\">\n <button class=\"button is-link\" type=\"submit\" v-bind:class=\"{ 'is-loading': loading }\">{{ __('auth.login.form.submit') }}</button>\n </div>\n <div class=\"socials\">\n <div class=\"description has-text-centered\">{{ __('auth.login.socials') }}</div>\n <div class=\"buttons\">\n <a class=\"button\" @click=\"facebook\">\n <svg class=\"icon fb-btn\">\n <use xlink:href=\"#logo-facebook-icon\" />\n </svg>\n <span>Facebook</span>\n </a>\n <a class=\"button\" @click=\"google\">\n <svg class=\"icon google-btn\">\n <use xlink:href=\"#logo-google-icon\" />\n </svg>\n <span>Google</span>\n </a>\n </div>\n </div>\n <div class=\"href-register\">\n <a @click=\"register\">{{ __('auth.login.signup') }}</a>\n </div>\n </template>\n </SchemaForm>\n </div>\n\n <forget v-if=\"modal == 'forget'\" :email=\"model.email\" :forget-type=\"forgetType\" :show-placeholders=\"showPlaceholders\"></forget>\n </div>\n</template>\n<script>\nimport { ref, markRaw, computed } from 'vue';\nimport { useStore } from 'vuex';\nimport { SchemaFormFactory, useSchemaForm } from 'formvuelate';\nimport VeeValidatePlugin from '@formvuelate/plugin-vee-validate';\nimport FormText from '@perevorot/shop/dist/forms/FormText';\nimport FormPassword from '@perevorot/shop/dist/forms/FormPassword';\nimport * as yup from 'yup';\n\nmarkRaw(FormText);\n\nconst SchemaForm = SchemaFormFactory([VeeValidatePlugin({})]);\n\nexport default {\n props: {\n loginCallback: {\n type: Function,\n default: () => { }\n },\n forgetType: {\n type: String,\n default: 'email'\n },\n showPlaceholders: {\n type: Boolean,\n default: false\n },\n showPlaceholders: {\n type: Boolean,\n default: false\n }\n },\n name: 'login',\n components: {\n SchemaForm\n },\n setup(props) {\n const loading = ref(false);\n const store = useStore();\n const key = ref(0);\n const errors = ref({});\n const modal = computed(() => store.getters['auth/modal']);\n\n const schema = ref({\n email: {\n component: FormText,\n label: __('auth.login.form.email'),\n store: 'login',\n model: 'email',\n placeholder: props.showPlaceholders ? __('auth.login.form.email') : '',\n },\n password: {\n component: FormPassword,\n label: __('auth.login.form.password'),\n placeholder: props.showPlaceholders ? __('auth.login.form.password') : '',\n }\n });\n\n const validation = yup.object().shape({\n email: yup.string().email(__('auth.validation.email')).required(__('auth.validation.required')),\n password: yup.string().required(__('auth.validation.required'))\n });\n\n const model = ref({\n email: '',\n password: ''\n });\n\n useSchemaForm(model);\n\n const reset = () => {\n store.commit('auth/modal', 'forget');\n };\n\n const register = () => {\n store.commit('auth/modal', 'registration');\n };\n\n const facebook = () => {\n window.location.href = $ziggy('auth.login.social', {\n provider: 'facebook'\n });\n };\n\n const google = () => {\n window.location.href = $ziggy('auth.login.social', {\n provider: 'google'\n });\n };\n\n const onSubmit = () => {\n loading.value = true;\n\n store.dispatch('auth/login', {\n credentials: model.value,\n callback: (response) => {\n if (props.loginCallback) {\n props.loginCallback();\n }\n\n if (response.data && response.data.user && !response.data.user.is_login_tracked) {\n let object = {\n event: 'login',\n user_id: response.data.user.id,\n method: 'site'\n };\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n }\n },\n finally: () => {\n loading.value = false;\n },\n catch: (error) => {\n if (error.response.data && error.response.data.errors) {\n for (const [field, messages] of Object.entries(error.response.data.errors)) {\n if (messages[0]) {\n errors.value[field] = messages[0];\n }\n }\n\n model.value.password = '';\n\n key.value++;\n }\n }\n });\n };\n\n return {\n loading,\n modal,\n schema,\n validation,\n reset,\n facebook,\n google,\n schema,\n onSubmit,\n errors,\n key,\n model,\n register\n };\n }\n};\n</script>"],"names":["markRaw","FormText","SchemaForm","SchemaFormFactory","VeeValidatePlugin","props","loginCallback","type","Function","forgetType","String","showPlaceholders","Boolean","name","components","setup","loading","ref","store","useStore","key","errors","modal","computed","getters","schema","email","component","label","__","model","placeholder","password","FormPassword","validation","yup","object","shape","string","required","useSchemaForm","reset","commit","facebook","window","location","href","$ziggy","provider","google","value","dispatch","credentials","callback","response","data","user","is_login_tracked","event","user_id","id","method","$env","debug","ecommerce","console","log","dataLayer","push","error","Object","entries","field","messages","_createElementVNode","_createElementBlock","_hoisted_1","_hoisted_2","_ctx","_createBlock","schemaRowClasses","$setup","onSubmit","afterForm","_hoisted_3","onClick","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_14","$props"],"mappings":"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"}
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("vue"),t=require("vuex"),r=require("formvuelate"),o=require("@formvuelate/plugin-vee-validate"),a=require("@perevorot/shop/dist/api"),n=require("@perevorot/shop/dist/helpers"),l=require("secure-ls");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=i(o),c=i(l);function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var o,a,n=[],l=!0,i=!1;try{for(r=r.call(e);!(l=(o=r.next()).done)&&(n.push(o.value),!t||n.length!==t);l=!0);}catch(e){i=!0,a=e}finally{try{l||null==r.return||r.return()}finally{if(i)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return m(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return m(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r<t;r++)o[r]=e[r];return o}var d={name:"registration",components:{SchemaForm:r.SchemaFormFactory([s.default({})])},setup:function(){var o,l=t.useStore(),i=e.ref(!1),s=e.ref(!0),m=e.ref(0),d=e.ref({}),f=e.ref(!1),v=e.ref(""),h=e.ref({}),g=e.ref({}),p=e.ref({});r.useSchemaForm(p);return a.auth.registerForm().then((function(e){if(e.data){var t=n.formParse(e.data);o=t.model,h.value=t.schema,p.value=t.model,g.value=t.validation,v.value=e.data.type}})).finally((function(){s.value=!1})),{loading:i,loadingForm:s,key:m,errors:d,schema:h,validation:g,onSubmit:function(){i.value=!0,l.dispatch("auth/register",{type:v.value?v.value.charAt(0).toUpperCase()+v.value.slice(1):"",credentials:p.value,finally:function(){i.value=!1},callback:function(){f.value=!0,p.value=o,m.value++;var e=new c.default({isCompression:!1}),t=e.get("forms");t.registration&&(t.registration={}),e.set("forms",t)},catch:function(e){if(e.response.data&&e.response.data.errors){for(var t=0,r=Object.entries(e.response.data.errors);t<r.length;t++){var o=u(r[t],2),a=o[0],n=o[1];n[0]&&(d.value[a]=n[0])}m.value++}}})},facebook:function(){window.location.href=$ziggy("auth.login.social",{provider:"facebook"})},google:function(){window.location.href=$ziggy("auth.login.social",{provider:"google"})},thanks:f,model:p,close:function(){l.commit("auth/modal",null),l.dispatch("auth/me")},type:v,login:function(){l.commit("auth/modal","login")}}}},f={key:0,class:"auth-registration"},v={class:"title"},h={class:"field"},g={class:"socials"},p={class:"description has-text-centered"},y={class:"buttons"},b=[e.createElementVNode("svg",{class:"icon fb-btn"},[e.createElementVNode("use",{"xlink:href":"#logo-facebook-icon"})],-1),e.createElementVNode("span",null,"Facebook",-1)],k=[e.createElementVNode("svg",{class:"icon google-btn"},[e.createElementVNode("use",{"xlink:href":"#logo-google-icon"})],-1),e.createElementVNode("span",null,"Google",-1)],E={class:"href-already-register"},N={class:"mt-3"};d.render=function(t,r,o,a,n,l){var i=e.resolveComponent("SchemaForm");return a.loadingForm?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("div",f,[e.createElementVNode("div",v,e.toDisplayString(t.__("auth.registration.title")),1),e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(a.model.user_type?"is-user-type-"+a.model.user_type.replaceAll("_","-"):null)},[(e.openBlock(),e.createBlock(i,{schemaRowClasses:"field",schema:a.schema,"validation-schema":a.validation,"initial-errors":a.errors,key:a.key,onSubmit:a.onSubmit},{afterForm:e.withCtx((function(){return[e.createElementVNode("div",h,[e.createElementVNode("button",{class:e.normalizeClass(["button is-link",{"is-loading":a.loading}]),type:"submit"},e.toDisplayString(t.__("auth.registration.form.submit"+("short"==a.type?"_short":""))),3)]),e.createElementVNode("div",g,[e.createElementVNode("div",p,e.toDisplayString(t.__("auth.login.socials")),1),e.createElementVNode("div",y,[e.createElementVNode("a",{class:"button",onClick:r[0]||(r[0]=function(){return a.facebook&&a.facebook.apply(a,arguments)})},b),e.createElementVNode("a",{class:"button",onClick:r[1]||(r[1]=function(){return a.google&&a.google.apply(a,arguments)})},k)])]),e.createElementVNode("div",E,[e.createElementVNode("a",{onClick:r[2]||(r[2]=function(){return a.login&&a.login.apply(a,arguments)})},e.toDisplayString(t.__("auth.registration.already")),1)])]})),_:1},8,["schema","validation-schema","initial-errors","onSubmit"]))],2),[[e.vShow,!a.thanks]]),e.withDirectives(e.createElementVNode("div",null,[e.createElementVNode("div",null,e.toDisplayString(t.__("auth.registration.thanks"+("short"==a.type?"_short":""),{email:a.model.email})),1),e.createElementVNode("div",N,[e.createElementVNode("button",{class:"button",onClick:r[3]||(r[3]=function(){return a.close&&a.close.apply(a,arguments)})},e.toDisplayString(t.__("auth.registration.continue")),1)])],512),[[e.vShow,a.thanks]])]))},module.exports=d;
1
+ "use strict";var e=require("vue"),t=require("vuex"),r=require("formvuelate"),o=require("@formvuelate/plugin-vee-validate"),a=require("@perevorot/shop/dist/api"),n=require("@perevorot/shop/dist/helpers"),i=require("secure-ls");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=l(o),c=l(i);function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var o,a,n=[],i=!0,l=!1;try{for(r=r.call(e);!(i=(o=r.next()).done)&&(n.push(o.value),!t||n.length!==t);i=!0);}catch(e){l=!0,a=e}finally{try{i||null==r.return||r.return()}finally{if(l)throw a}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return d(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return d(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r<t;r++)o[r]=e[r];return o}var m={name:"registration",components:{SchemaForm:r.SchemaFormFactory([s.default({})])},setup:function(){var o,i=t.useStore(),l=e.ref(!1),s=e.ref(!0),d=e.ref(0),m=e.ref({}),f=e.ref(!1),v=e.ref(""),h=e.ref({}),g=e.ref({}),p=e.ref({});r.useSchemaForm(p);return a.auth.registerForm().then((function(e){if(e.data){var t=n.formParse(e.data);o=t.model,h.value=t.schema,p.value=t.model,g.value=t.validation,v.value=e.data.type}})).finally((function(){s.value=!1})),{loading:l,loadingForm:s,key:d,errors:m,schema:h,validation:g,onSubmit:function(){l.value=!0,i.dispatch("auth/register",{type:v.value?v.value.charAt(0).toUpperCase()+v.value.slice(1):"",credentials:p.value,finally:function(){l.value=!1},callback:function(e){if(e.data&&e.data.user_id){var t={event:"sign_up",user_id:e.data.user_id,method:"site"};$env.debug.ecommerce&&console.log(t),!$env.debug.ecommerce&&window.dataLayer&&(window.dataLayer.push({ecommerce:null}),window.dataLayer.push(t))}f.value=!0,p.value=o,d.value++;var r=new c.default({isCompression:!1}),a=r.get("forms");a.registration&&(a.registration={}),r.set("forms",a)},catch:function(e){if(e.response.data&&e.response.data.errors){for(var t=0,r=Object.entries(e.response.data.errors);t<r.length;t++){var o=u(r[t],2),a=o[0],n=o[1];n[0]&&(m.value[a]=n[0])}d.value++}}})},facebook:function(){window.location.href=$ziggy("auth.login.social",{provider:"facebook"})},google:function(){window.location.href=$ziggy("auth.login.social",{provider:"google"})},thanks:f,model:p,close:function(){i.commit("auth/modal",null),i.dispatch("auth/me")},type:v,login:function(){i.commit("auth/modal","login")}}}},f={key:0,class:"auth-registration"},v={class:"title"},h={class:"field"},g={class:"socials"},p={class:"description has-text-centered"},y={class:"buttons"},b=[e.createElementVNode("svg",{class:"icon fb-btn"},[e.createElementVNode("use",{"xlink:href":"#logo-facebook-icon"})],-1),e.createElementVNode("span",null,"Facebook",-1)],k=[e.createElementVNode("svg",{class:"icon google-btn"},[e.createElementVNode("use",{"xlink:href":"#logo-google-icon"})],-1),e.createElementVNode("span",null,"Google",-1)],E={class:"href-already-register"},N={class:"mt-3"};m.render=function(t,r,o,a,n,i){var l=e.resolveComponent("SchemaForm");return a.loadingForm?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("div",f,[e.createElementVNode("div",v,e.toDisplayString(t.__("auth.registration.title")),1),e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(a.model.user_type?"is-user-type-"+a.model.user_type.replaceAll("_","-"):null)},[(e.openBlock(),e.createBlock(l,{schemaRowClasses:"field",schema:a.schema,"validation-schema":a.validation,"initial-errors":a.errors,key:a.key,onSubmit:a.onSubmit},{afterForm:e.withCtx((function(){return[e.createElementVNode("div",h,[e.createElementVNode("button",{class:e.normalizeClass(["button is-link",{"is-loading":a.loading}]),type:"submit"},e.toDisplayString(t.__("auth.registration.form.submit"+("short"==a.type?"_short":""))),3)]),e.createElementVNode("div",g,[e.createElementVNode("div",p,e.toDisplayString(t.__("auth.login.socials")),1),e.createElementVNode("div",y,[e.createElementVNode("a",{class:"button",onClick:r[0]||(r[0]=function(){return a.facebook&&a.facebook.apply(a,arguments)})},b),e.createElementVNode("a",{class:"button",onClick:r[1]||(r[1]=function(){return a.google&&a.google.apply(a,arguments)})},k)])]),e.createElementVNode("div",E,[e.createElementVNode("a",{onClick:r[2]||(r[2]=function(){return a.login&&a.login.apply(a,arguments)})},e.toDisplayString(t.__("auth.registration.already")),1)])]})),_:1},8,["schema","validation-schema","initial-errors","onSubmit"]))],2),[[e.vShow,!a.thanks]]),e.withDirectives(e.createElementVNode("div",null,[e.createElementVNode("div",null,e.toDisplayString(t.__("auth.registration.thanks"+("short"==a.type?"_short":""),{email:a.model.email})),1),e.createElementVNode("div",N,[e.createElementVNode("button",{class:"button",onClick:r[3]||(r[3]=function(){return a.close&&a.close.apply(a,arguments)})},e.toDisplayString(t.__("auth.registration.continue")),1)])],512),[[e.vShow,a.thanks]])]))},module.exports=m;
2
2
  //# sourceMappingURL=Registration.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Registration.js","sources":["../../../src/components/auth/Registration.vue","../../../src/components/auth/Registration.vue?vue&type=template&id=eb84107e&lang.js"],"sourcesContent":["<template>\n <div class=\"auth-registration\" v-if=\"!loadingForm\">\n <div class=\"title\">{{ __('auth.registration.title') }}</div>\n <div v-show=\"!thanks\" v-bind:class=\"model.user_type ? 'is-user-type-' + model.user_type.replaceAll('_', '-') : null\">\n <SchemaForm schemaRowClasses=\"field\" :schema=\"schema\" :validation-schema=\"validation\" :initial-errors=\"errors\" :key=\"key\" @submit=\"onSubmit\">\n <template #afterForm>\n <div class=\"field\">\n <button class=\"button is-link\" type=\"submit\" v-bind:class=\"{ 'is-loading': loading }\">\n {{ __('auth.registration.form.submit' + (type == 'short' ? '_short' : '')) }}\n </button>\n </div>\n <div class=\"socials\">\n <div class=\"description has-text-centered\">\n {{ __('auth.login.socials') }}\n </div>\n <div class=\"buttons\">\n <a class=\"button\" @click=\"facebook\">\n <svg class=\"icon fb-btn\">\n <use xlink:href=\"#logo-facebook-icon\" />\n </svg>\n <span>Facebook</span>\n </a>\n <a class=\"button\" @click=\"google\"\n ><svg class=\"icon google-btn\">\n <use xlink:href=\"#logo-google-icon\" />\n </svg>\n <span>Google</span>\n </a>\n </div>\n </div>\n <div class=\"href-already-register\">\n <a @click=\"login\">{{ __('auth.registration.already') }}</a>\n </div>\n </template>\n </SchemaForm>\n </div>\n <div v-show=\"thanks\">\n <div>\n {{\n __('auth.registration.thanks' + (type == 'short' ? '_short' : ''), {\n email: model.email\n })\n }}\n </div>\n <div class=\"mt-3\">\n <button class=\"button\" @click=\"close\">\n {{ __('auth.registration.continue') }}\n </button>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref } from 'vue';\nimport { useStore } from 'vuex';\nimport { SchemaFormFactory, useSchemaForm } from 'formvuelate';\nimport VeeValidatePlugin from '@formvuelate/plugin-vee-validate';\nimport { auth as api } from '@perevorot/shop/dist/api';\nimport { formParse } from '@perevorot/shop/dist/helpers';\nimport SecureLS from 'secure-ls';\n\nconst SchemaForm = SchemaFormFactory([VeeValidatePlugin({})]);\n\nexport default {\n name: 'registration',\n components: {\n SchemaForm\n },\n setup() {\n const store = useStore();\n const loading = ref(false);\n const loadingForm = ref(true);\n const key = ref(0);\n const errors = ref({});\n const thanks = ref(false);\n const type = ref('');\n const schema = ref({});\n const validation = ref({});\n const model = ref({});\n\n let emptyModel;\n\n useSchemaForm(model);\n\n const onSubmit = () => {\n loading.value = true;\n\n store.dispatch('auth/register', {\n type: type.value ? type.value.charAt(0).toUpperCase() + type.value.slice(1) : '',\n credentials: model.value,\n finally: () => {\n loading.value = false;\n },\n callback: () => {\n thanks.value = true;\n\n model.value = emptyModel;\n\n key.value++;\n\n let ls = new SecureLS({\n isCompression: false\n });\n\n let forms = ls.get('forms');\n\n if (forms.registration) {\n forms.registration = {};\n }\n\n ls.set('forms', forms);\n },\n catch: (error) => {\n if (error.response.data && error.response.data.errors) {\n for (const [field, messages] of Object.entries(error.response.data.errors)) {\n if (messages[0]) {\n errors.value[field] = messages[0];\n }\n }\n\n key.value++;\n }\n }\n });\n };\n\n const close = () => {\n store.commit('auth/modal', null);\n store.dispatch('auth/me');\n };\n\n const facebook = () => {\n window.location.href = $ziggy('auth.login.social', {\n provider: 'facebook'\n });\n };\n\n const google = () => {\n window.location.href = $ziggy('auth.login.social', {\n provider: 'google'\n });\n };\n\n const login = () => {\n store.commit('auth/modal', 'login');\n };\n\n api.registerForm()\n .then((response) => {\n if (response.data) {\n const form = formParse(response.data);\n\n emptyModel = form.model;\n\n schema.value = form.schema;\n model.value = form.model;\n validation.value = form.validation;\n\n type.value = response.data.type;\n }\n })\n .finally(() => {\n loadingForm.value = false;\n });\n\n return {\n loading,\n loadingForm,\n key,\n errors,\n schema,\n validation,\n onSubmit,\n facebook,\n google,\n thanks,\n model,\n close,\n type,\n login\n };\n }\n};\n</script>","<template>\n <div class=\"auth-registration\" v-if=\"!loadingForm\">\n <div class=\"title\">{{ __('auth.registration.title') }}</div>\n <div v-show=\"!thanks\" v-bind:class=\"model.user_type ? 'is-user-type-' + model.user_type.replaceAll('_', '-') : null\">\n <SchemaForm schemaRowClasses=\"field\" :schema=\"schema\" :validation-schema=\"validation\" :initial-errors=\"errors\" :key=\"key\" @submit=\"onSubmit\">\n <template #afterForm>\n <div class=\"field\">\n <button class=\"button is-link\" type=\"submit\" v-bind:class=\"{ 'is-loading': loading }\">\n {{ __('auth.registration.form.submit' + (type == 'short' ? '_short' : '')) }}\n </button>\n </div>\n <div class=\"socials\">\n <div class=\"description has-text-centered\">\n {{ __('auth.login.socials') }}\n </div>\n <div class=\"buttons\">\n <a class=\"button\" @click=\"facebook\">\n <svg class=\"icon fb-btn\">\n <use xlink:href=\"#logo-facebook-icon\" />\n </svg>\n <span>Facebook</span>\n </a>\n <a class=\"button\" @click=\"google\"\n ><svg class=\"icon google-btn\">\n <use xlink:href=\"#logo-google-icon\" />\n </svg>\n <span>Google</span>\n </a>\n </div>\n </div>\n <div class=\"href-already-register\">\n <a @click=\"login\">{{ __('auth.registration.already') }}</a>\n </div>\n </template>\n </SchemaForm>\n </div>\n <div v-show=\"thanks\">\n <div>\n {{\n __('auth.registration.thanks' + (type == 'short' ? '_short' : ''), {\n email: model.email\n })\n }}\n </div>\n <div class=\"mt-3\">\n <button class=\"button\" @click=\"close\">\n {{ __('auth.registration.continue') }}\n </button>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref } from 'vue';\nimport { useStore } from 'vuex';\nimport { SchemaFormFactory, useSchemaForm } from 'formvuelate';\nimport VeeValidatePlugin from '@formvuelate/plugin-vee-validate';\nimport { auth as api } from '@perevorot/shop/dist/api';\nimport { formParse } from '@perevorot/shop/dist/helpers';\nimport SecureLS from 'secure-ls';\n\nconst SchemaForm = SchemaFormFactory([VeeValidatePlugin({})]);\n\nexport default {\n name: 'registration',\n components: {\n SchemaForm\n },\n setup() {\n const store = useStore();\n const loading = ref(false);\n const loadingForm = ref(true);\n const key = ref(0);\n const errors = ref({});\n const thanks = ref(false);\n const type = ref('');\n const schema = ref({});\n const validation = ref({});\n const model = ref({});\n\n let emptyModel;\n\n useSchemaForm(model);\n\n const onSubmit = () => {\n loading.value = true;\n\n store.dispatch('auth/register', {\n type: type.value ? type.value.charAt(0).toUpperCase() + type.value.slice(1) : '',\n credentials: model.value,\n finally: () => {\n loading.value = false;\n },\n callback: () => {\n thanks.value = true;\n\n model.value = emptyModel;\n\n key.value++;\n\n let ls = new SecureLS({\n isCompression: false\n });\n\n let forms = ls.get('forms');\n\n if (forms.registration) {\n forms.registration = {};\n }\n\n ls.set('forms', forms);\n },\n catch: (error) => {\n if (error.response.data && error.response.data.errors) {\n for (const [field, messages] of Object.entries(error.response.data.errors)) {\n if (messages[0]) {\n errors.value[field] = messages[0];\n }\n }\n\n key.value++;\n }\n }\n });\n };\n\n const close = () => {\n store.commit('auth/modal', null);\n store.dispatch('auth/me');\n };\n\n const facebook = () => {\n window.location.href = $ziggy('auth.login.social', {\n provider: 'facebook'\n });\n };\n\n const google = () => {\n window.location.href = $ziggy('auth.login.social', {\n provider: 'google'\n });\n };\n\n const login = () => {\n store.commit('auth/modal', 'login');\n };\n\n api.registerForm()\n .then((response) => {\n if (response.data) {\n const form = formParse(response.data);\n\n emptyModel = form.model;\n\n schema.value = form.schema;\n model.value = form.model;\n validation.value = form.validation;\n\n type.value = response.data.type;\n }\n })\n .finally(() => {\n loadingForm.value = false;\n });\n\n return {\n loading,\n loadingForm,\n key,\n errors,\n schema,\n validation,\n onSubmit,\n facebook,\n google,\n thanks,\n model,\n close,\n type,\n login\n };\n }\n};\n</script>"],"names":["name","components","SchemaForm","SchemaFormFactory","VeeValidatePlugin","setup","emptyModel","store","useStore","loading","ref","loadingForm","key","errors","thanks","type","schema","validation","model","useSchemaForm","api","registerForm","then","response","data","form","formParse","value","onSubmit","dispatch","charAt","toUpperCase","slice","credentials","callback","ls","SecureLS","isCompression","forms","get","registration","set","error","Object","entries","field","messages","facebook","window","location","href","$ziggy","provider","google","close","commit","login","_createElementVNode","$setup","_createElementBlock","_hoisted_1","_hoisted_2","_ctx","user_type","replaceAll","_createBlock","schemaRowClasses","afterForm","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","onClick","_hoisted_13","_hoisted_14"],"mappings":"4wCA6DA,MAEe,CACXA,KAAM,eACNC,WAAY,CACRC,WALWC,oBAAkB,CAACC,UAAkB,OAOpDC,qBAYQC,EAXEC,EAAQC,aACRC,EAAUC,OAAI,GACdC,EAAcD,OAAI,GAClBE,EAAMF,MAAI,GACVG,EAASH,MAAI,IACbI,EAASJ,OAAI,GACbK,EAAOL,MAAI,IACXM,EAASN,MAAI,IACbO,EAAaP,MAAI,IACjBQ,EAAQR,MAAI,IAIlBS,gBAAcD,UAiEdE,OAAIC,eACCC,MAAK,SAACC,MACCA,EAASC,KAAM,KACTC,EAAOC,YAAUH,EAASC,MAEhClB,EAAamB,EAAKP,MAElBF,EAAOW,MAAQF,EAAKT,OACpBE,EAAMS,MAAQF,EAAKP,MACnBD,EAAWU,MAAQF,EAAKR,WAExBF,EAAKY,MAAQJ,EAASC,KAAKT,kBAG1B,WACLJ,EAAYgB,OAAQ,KAGrB,CACHlB,QAAAA,EACAE,YAAAA,EACAC,IAAAA,EACAC,OAAAA,EACAG,OAAAA,EACAC,WAAAA,EACAW,SAxFa,WACbnB,EAAQkB,OAAQ,EAEhBpB,EAAMsB,SAAS,gBAAiB,CAC5Bd,KAAMA,EAAKY,MAAQZ,EAAKY,MAAMG,OAAO,GAAGC,cAAgBhB,EAAKY,MAAMK,MAAM,GAAK,GAC9EC,YAAaf,EAAMS,cACV,WACLlB,EAAQkB,OAAQ,GAEpBO,SAAU,WACNpB,EAAOa,OAAQ,EAEfT,EAAMS,MAAQrB,EAEdM,EAAIe,YAEAQ,EAAK,IAAIC,UAAS,CAClBC,eAAe,IAGfC,EAAQH,EAAGI,IAAI,SAEfD,EAAME,eACNF,EAAME,aAAe,IAGzBL,EAAGM,IAAI,QAASH,UAEb,SAACI,MACAA,EAAMnB,SAASC,MAAQkB,EAAMnB,SAASC,KAAKX,OAAQ,eACnB8B,OAAOC,QAAQF,EAAMnB,SAASC,KAAKX,uBAAS,iBAAhEgC,OAAOC,OACXA,EAAS,KACTjC,EAAOc,MAAMkB,GAASC,EAAS,IAIvClC,EAAIe,aAqDhBoB,SA1Ca,WACbC,OAAOC,SAASC,KAAOC,OAAO,oBAAqB,CAC/CC,SAAU,cAyCdC,OArCW,WACXL,OAAOC,SAASC,KAAOC,OAAO,oBAAqB,CAC/CC,SAAU,YAoCdtC,OAAAA,EACAI,MAAAA,EACAoC,MAnDU,WACV/C,EAAMgD,OAAO,aAAc,MAC3BhD,EAAMsB,SAAS,YAkDfd,KAAAA,EACAyC,MApCU,WACVjD,EAAMgD,OAAO,aAAc,4BC/IxB,8BACI,kBAIY,kBAKA,oBACI,0CAGA,cAEHE,kCAAW,gBACPA,yCAAgB,6BAEpBA,iCAAM,mBAGLA,kCAAW,oBACRA,yCAAgB,2BAEpBA,iCAAM,uBAIP,kCAcR,qFA3CmBC,6DAAtCC,2BAAAC,GACIH,2BAAAI,oBAAsBC,qDACtBL,mDAAoCC,QAAMK,0BAA8BL,QAAMK,UAAUC,2CACpFC,iBAAYC,iBAAiB,QAASlD,OAAQ0C,6BAA4BA,8BAA6BA,SAAS9C,IAAK8C,MAAM9B,SAAQ8B,aACpHS,qBACP,kBAAAV,2BAAAW,GACIX,uDAAc,+BAA6DC,aAA5C3C,KAAK,4BAC7B+C,+CAAsCJ,2BAGjDD,2BAAAY,GACIZ,2BAAAa,oBACOR,+BAEPL,2BAAAc,GACId,gCAAS,SAAUe,sCAAOd,gDAM1BD,gCAAS,SAAUe,sCAAOd,gDAQlCD,2BAAAgB,GACIhB,0BAAIe,sCAAOd,yDAAUI,+HA5BvBJ,6BAiCdD,iCACIA,kDAEQK,0CAAiCJ,+CAKzCD,2BAAAiB,GACIjB,qCAAc,SAAUe,sCAAOd,yDACxBI,yDAVFJ"}
1
+ {"version":3,"file":"Registration.js","sources":["../../../src/components/auth/Registration.vue","../../../src/components/auth/Registration.vue?vue&type=template&id=40b43442&lang.js"],"sourcesContent":["<template>\n <div class=\"auth-registration\" v-if=\"!loadingForm\">\n <div class=\"title\">{{ __('auth.registration.title') }}</div>\n <div v-show=\"!thanks\" v-bind:class=\"model.user_type ? 'is-user-type-' + model.user_type.replaceAll('_', '-') : null\">\n <SchemaForm schemaRowClasses=\"field\" :schema=\"schema\" :validation-schema=\"validation\" :initial-errors=\"errors\" :key=\"key\" @submit=\"onSubmit\">\n <template #afterForm>\n <div class=\"field\">\n <button class=\"button is-link\" type=\"submit\" v-bind:class=\"{ 'is-loading': loading }\">\n {{ __('auth.registration.form.submit' + (type == 'short' ? '_short' : '')) }}\n </button>\n </div>\n <div class=\"socials\">\n <div class=\"description has-text-centered\">\n {{ __('auth.login.socials') }}\n </div>\n <div class=\"buttons\">\n <a class=\"button\" @click=\"facebook\">\n <svg class=\"icon fb-btn\">\n <use xlink:href=\"#logo-facebook-icon\" />\n </svg>\n <span>Facebook</span>\n </a>\n <a class=\"button\" @click=\"google\"><svg class=\"icon google-btn\">\n <use xlink:href=\"#logo-google-icon\" />\n </svg>\n <span>Google</span>\n </a>\n </div>\n </div>\n <div class=\"href-already-register\">\n <a @click=\"login\">{{ __('auth.registration.already') }}</a>\n </div>\n </template>\n </SchemaForm>\n </div>\n <div v-show=\"thanks\">\n <div>\n {{\n __('auth.registration.thanks' + (type == 'short' ? '_short' : ''), {\n email: model.email\n })\n }}\n </div>\n <div class=\"mt-3\">\n <button class=\"button\" @click=\"close\">\n {{ __('auth.registration.continue') }}\n </button>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref } from 'vue';\nimport { useStore } from 'vuex';\nimport { SchemaFormFactory, useSchemaForm } from 'formvuelate';\nimport VeeValidatePlugin from '@formvuelate/plugin-vee-validate';\nimport { auth as api } from '@perevorot/shop/dist/api';\nimport { formParse } from '@perevorot/shop/dist/helpers';\nimport SecureLS from 'secure-ls';\n\nconst SchemaForm = SchemaFormFactory([VeeValidatePlugin({})]);\n\nexport default {\n name: 'registration',\n components: {\n SchemaForm\n },\n setup() {\n const store = useStore();\n const loading = ref(false);\n const loadingForm = ref(true);\n const key = ref(0);\n const errors = ref({});\n const thanks = ref(false);\n const type = ref('');\n const schema = ref({});\n const validation = ref({});\n const model = ref({});\n\n let emptyModel;\n\n useSchemaForm(model);\n\n const onSubmit = () => {\n loading.value = true;\n\n store.dispatch('auth/register', {\n type: type.value ? type.value.charAt(0).toUpperCase() + type.value.slice(1) : '',\n credentials: model.value,\n finally: () => {\n loading.value = false;\n },\n callback: (response) => {\n if (response.data && response.data.user_id) {\n let object = {\n event: 'sign_up',\n user_id: response.data.user_id,\n method: 'site',\n };\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n }\n\n thanks.value = true;\n\n model.value = emptyModel;\n\n key.value++;\n\n let ls = new SecureLS({\n isCompression: false\n });\n\n let forms = ls.get('forms');\n\n if (forms.registration) {\n forms.registration = {};\n }\n\n ls.set('forms', forms);\n },\n catch: (error) => {\n if (error.response.data && error.response.data.errors) {\n for (const [field, messages] of Object.entries(error.response.data.errors)) {\n if (messages[0]) {\n errors.value[field] = messages[0];\n }\n }\n\n key.value++;\n }\n }\n });\n };\n\n const close = () => {\n store.commit('auth/modal', null);\n store.dispatch('auth/me');\n };\n\n const facebook = () => {\n window.location.href = $ziggy('auth.login.social', {\n provider: 'facebook'\n });\n };\n\n const google = () => {\n window.location.href = $ziggy('auth.login.social', {\n provider: 'google'\n });\n };\n\n const login = () => {\n store.commit('auth/modal', 'login');\n };\n\n api.registerForm()\n .then((response) => {\n if (response.data) {\n const form = formParse(response.data);\n\n emptyModel = form.model;\n\n schema.value = form.schema;\n model.value = form.model;\n validation.value = form.validation;\n\n type.value = response.data.type;\n }\n })\n .finally(() => {\n loadingForm.value = false;\n });\n\n return {\n loading,\n loadingForm,\n key,\n errors,\n schema,\n validation,\n onSubmit,\n facebook,\n google,\n thanks,\n model,\n close,\n type,\n login\n };\n }\n};\n</script>","<template>\n <div class=\"auth-registration\" v-if=\"!loadingForm\">\n <div class=\"title\">{{ __('auth.registration.title') }}</div>\n <div v-show=\"!thanks\" v-bind:class=\"model.user_type ? 'is-user-type-' + model.user_type.replaceAll('_', '-') : null\">\n <SchemaForm schemaRowClasses=\"field\" :schema=\"schema\" :validation-schema=\"validation\" :initial-errors=\"errors\" :key=\"key\" @submit=\"onSubmit\">\n <template #afterForm>\n <div class=\"field\">\n <button class=\"button is-link\" type=\"submit\" v-bind:class=\"{ 'is-loading': loading }\">\n {{ __('auth.registration.form.submit' + (type == 'short' ? '_short' : '')) }}\n </button>\n </div>\n <div class=\"socials\">\n <div class=\"description has-text-centered\">\n {{ __('auth.login.socials') }}\n </div>\n <div class=\"buttons\">\n <a class=\"button\" @click=\"facebook\">\n <svg class=\"icon fb-btn\">\n <use xlink:href=\"#logo-facebook-icon\" />\n </svg>\n <span>Facebook</span>\n </a>\n <a class=\"button\" @click=\"google\"><svg class=\"icon google-btn\">\n <use xlink:href=\"#logo-google-icon\" />\n </svg>\n <span>Google</span>\n </a>\n </div>\n </div>\n <div class=\"href-already-register\">\n <a @click=\"login\">{{ __('auth.registration.already') }}</a>\n </div>\n </template>\n </SchemaForm>\n </div>\n <div v-show=\"thanks\">\n <div>\n {{\n __('auth.registration.thanks' + (type == 'short' ? '_short' : ''), {\n email: model.email\n })\n }}\n </div>\n <div class=\"mt-3\">\n <button class=\"button\" @click=\"close\">\n {{ __('auth.registration.continue') }}\n </button>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref } from 'vue';\nimport { useStore } from 'vuex';\nimport { SchemaFormFactory, useSchemaForm } from 'formvuelate';\nimport VeeValidatePlugin from '@formvuelate/plugin-vee-validate';\nimport { auth as api } from '@perevorot/shop/dist/api';\nimport { formParse } from '@perevorot/shop/dist/helpers';\nimport SecureLS from 'secure-ls';\n\nconst SchemaForm = SchemaFormFactory([VeeValidatePlugin({})]);\n\nexport default {\n name: 'registration',\n components: {\n SchemaForm\n },\n setup() {\n const store = useStore();\n const loading = ref(false);\n const loadingForm = ref(true);\n const key = ref(0);\n const errors = ref({});\n const thanks = ref(false);\n const type = ref('');\n const schema = ref({});\n const validation = ref({});\n const model = ref({});\n\n let emptyModel;\n\n useSchemaForm(model);\n\n const onSubmit = () => {\n loading.value = true;\n\n store.dispatch('auth/register', {\n type: type.value ? type.value.charAt(0).toUpperCase() + type.value.slice(1) : '',\n credentials: model.value,\n finally: () => {\n loading.value = false;\n },\n callback: (response) => {\n if (response.data && response.data.user_id) {\n let object = {\n event: 'sign_up',\n user_id: response.data.user_id,\n method: 'site',\n };\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n }\n\n thanks.value = true;\n\n model.value = emptyModel;\n\n key.value++;\n\n let ls = new SecureLS({\n isCompression: false\n });\n\n let forms = ls.get('forms');\n\n if (forms.registration) {\n forms.registration = {};\n }\n\n ls.set('forms', forms);\n },\n catch: (error) => {\n if (error.response.data && error.response.data.errors) {\n for (const [field, messages] of Object.entries(error.response.data.errors)) {\n if (messages[0]) {\n errors.value[field] = messages[0];\n }\n }\n\n key.value++;\n }\n }\n });\n };\n\n const close = () => {\n store.commit('auth/modal', null);\n store.dispatch('auth/me');\n };\n\n const facebook = () => {\n window.location.href = $ziggy('auth.login.social', {\n provider: 'facebook'\n });\n };\n\n const google = () => {\n window.location.href = $ziggy('auth.login.social', {\n provider: 'google'\n });\n };\n\n const login = () => {\n store.commit('auth/modal', 'login');\n };\n\n api.registerForm()\n .then((response) => {\n if (response.data) {\n const form = formParse(response.data);\n\n emptyModel = form.model;\n\n schema.value = form.schema;\n model.value = form.model;\n validation.value = form.validation;\n\n type.value = response.data.type;\n }\n })\n .finally(() => {\n loadingForm.value = false;\n });\n\n return {\n loading,\n loadingForm,\n key,\n errors,\n schema,\n validation,\n onSubmit,\n facebook,\n google,\n thanks,\n model,\n close,\n type,\n login\n };\n }\n};\n</script>"],"names":["name","components","SchemaForm","SchemaFormFactory","VeeValidatePlugin","setup","emptyModel","store","useStore","loading","ref","loadingForm","key","errors","thanks","type","schema","validation","model","useSchemaForm","api","registerForm","then","response","data","form","formParse","value","onSubmit","dispatch","charAt","toUpperCase","slice","credentials","callback","user_id","object","event","method","$env","debug","ecommerce","console","log","window","dataLayer","push","ls","SecureLS","isCompression","forms","get","registration","set","error","Object","entries","field","messages","facebook","location","href","$ziggy","provider","google","close","commit","login","_createElementVNode","$setup","_createElementBlock","_hoisted_1","_hoisted_2","_ctx","user_type","replaceAll","_createBlock","schemaRowClasses","afterForm","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","onClick","_hoisted_13","_hoisted_14"],"mappings":"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"}
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("vue"),o=require("vuex"),t={name:"user",props:{resetToken:{type:String,default:""},resetEmail:{type:String,default:""},tokenValid:{type:Boolean,default:!1},forgetType:{type:String,default:"email"},showPlaceholders:{type:Boolean,default:!1}},setup:function(t){var l=o.useStore(),n=e.computed((function(){return l.getters["auth/me"]})),r=e.computed((function(){return l.getters["auth/modal"]})),a=e.computed((function(){return Object.keys(n.value).length>0})),s=e.ref(!1),c=e.computed((function(){return l.getters["auth/account"]})),i=e.ref(""),d=e.ref("");e.provide("presetedResetToken",i),e.provide("presetedResetEmail",d);var u=function(){l.commit("auth/modal",null),l.dispatch("auth/me")};return l.dispatch("auth/me",{finally:function(){s.value=!0}}),window.addEventListener("keyup",(function(e){r.value&&"Escape"===e.key&&u()})),t.resetToken&&l.commit("auth/modal","reset"),{mounted:s,user:n,logged:a,modal:r,open:function(){l.commit("auth/modal","login")},close:u,register:function(){l.commit("auth/modal","registration")},logout:function(){l.dispatch("auth/logout")},routes:c}}},l={key:0,class:"auth-user"},n={class:"modal-content"},r=[e.createElementVNode("svg",{class:"icon close"},[e.createElementVNode("use",{"xlink:href":"#close"})],-1)],a={class:"box"},s={class:"tabs"},c={href:"#register"},i={key:1,class:"auth-user is-logged"},d={class:"dropdown is-right is-hoverable"},u={class:"dropdown-trigger"},m=["href"],p=e.createElementVNode("i",{class:"fas fa-user"},null,-1),g=e.createElementVNode("span",{class:"icon is-small"},[e.createElementVNode("i",{class:"fas fa-angle-down","aria-hidden":"true"})],-1),f={class:"dropdown-menu",role:"menu"},h={class:"dropdown-content"},k=["href"],v={key:0,class:"icon"},E=["xlink:href"],V={key:1,class:"badge"},N={key:1,class:"dropdown-divider"},y=e.createElementVNode("hr",{class:"dropdown-divider"},null,-1),B=e.createElementVNode("svg",{class:"icon"},[e.createElementVNode("use",{"xlink:href":"#icon-logout"})],-1);t.render=function(o,t,w,C,S,b){var x=e.resolveComponent("login"),_=e.resolveComponent("registration"),D=e.resolveComponent("reset");return C.mounted&&!C.logged?(e.openBlock(),e.createElementBlock("div",l,[e.renderSlot(o.$slots,"login",{open:C.open,label:o.__("auth.login.login")},(function(){return[e.createElementVNode("a",{href:"#login",class:"button",onClick:t[0]||(t[0]=function(){return C.open&&C.open.apply(C,arguments)})},e.toDisplayString(o.__("auth.login.login")),1)]})),e.createElementVNode("div",{class:e.normalizeClass(["modal",{"is-active":C.modal}])},[e.createElementVNode("div",{class:"modal-background",onClick:t[1]||(t[1]=function(){return C.close&&C.close.apply(C,arguments)})}),e.createElementVNode("div",n,[e.createElementVNode("button",{class:"modal-close is-large",onClick:t[2]||(t[2]=function(){return C.close&&C.close.apply(C,arguments)})},r),e.createElementVNode("div",a,[e.renderSlot(o.$slots,"hero"),e.createElementVNode("div",s,[e.createElementVNode("ul",null,[e.createElementVNode("li",{class:e.normalizeClass({"is-active":"login"==C.modal||"forget"==C.modal})},[e.createElementVNode("a",{href:"#login",onClick:t[3]||(t[3]=function(){return C.open&&C.open.apply(C,arguments)})},e.toDisplayString(o.__("auth.login.login")),1)],2),e.createElementVNode("li",{class:e.normalizeClass({"is-active":"registration"==C.modal}),onClick:t[4]||(t[4]=function(){return C.register&&C.register.apply(C,arguments)})},[e.createElementVNode("a",c,e.toDisplayString(o.__("auth.login.signup")),1)],2)])]),(e.openBlock(),e.createBlock(e.KeepAlive,null,["login"==C.modal||"forget"==C.modal?(e.openBlock(),e.createBlock(x,{key:0,"forget-type":w.forgetType,"show-placeholders":w.showPlaceholders},null,8,["forget-type","show-placeholders"])):e.createCommentVNode("v-if",!0)],1024)),(e.openBlock(),e.createBlock(e.KeepAlive,null,["registration"==C.modal?(e.openBlock(),e.createBlock(_,{key:0})):e.createCommentVNode("v-if",!0)],1024)),e.withDirectives(e.createVNode(D,{"show-placeholders":w.showPlaceholders},null,8,["show-placeholders"]),[[e.vShow,"reset"==C.modal]])])])],2)])):C.mounted?(e.openBlock(),e.createElementBlock("div",i,[e.createElementVNode("div",d,[e.createElementVNode("div",u,[e.createElementVNode("a",{class:"button",href:C.routes[0].path},[e.renderSlot(o.$slots,"user",{user:C.user.name?C.user.name:C.user.email},(function(){return[e.createElementVNode("span",null,[p,e.createTextVNode(" "+e.toDisplayString(C.user.name?C.user.name:C.user.email),1)]),g]}))],8,m)]),e.createElementVNode("div",f,[e.createElementVNode("div",h,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.routes,(function(o,t){return e.openBlock(),e.createElementBlock("div",{key:t},[o.text?(e.openBlock(),e.createElementBlock("a",{key:0,href:o.path,class:"dropdown-item"},[o.icon?(e.openBlock(),e.createElementBlock("svg",v,[e.createElementVNode("use",{"xlink:href":"#"+o.icon},null,8,E)])):e.createCommentVNode("v-if",!0),e.createElementVNode("span",null,e.toDisplayString(o.text),1),o.badge?(e.openBlock(),e.createElementBlock("span",V,e.toDisplayString(o.badge),1)):e.createCommentVNode("v-if",!0)],8,k)):(e.openBlock(),e.createElementBlock("hr",N))])})),128)),y,e.createElementVNode("a",{class:"dropdown-item",onClick:t[5]||(t[5]=function(){return C.logout&&C.logout.apply(C,arguments)})},[B,e.createElementVNode("span",null,e.toDisplayString(o.__("auth.user.menu.logout")),1)])])])])])):e.createCommentVNode("v-if",!0)},module.exports=t;
1
+ "use strict";var e=require("vue"),o=require("vuex"),t={name:"user",props:{resetToken:{type:String,default:""},resetEmail:{type:String,default:""},tokenValid:{type:Boolean,default:!1},forgetType:{type:String,default:"email"},showPlaceholders:{type:Boolean,default:!1}},setup:function(t){var l=o.useStore(),n=e.computed((function(){return l.getters["auth/me"]})),a=e.computed((function(){return l.getters["auth/modal"]})),r=e.computed((function(){return Object.keys(n.value).length>0})),c=e.ref(!1),s=e.computed((function(){return l.getters["auth/account"]})),i=e.ref(""),d=e.ref("");e.provide("presetedResetToken",i),e.provide("presetedResetEmail",d);var u=function(){l.commit("auth/modal",null),l.dispatch("auth/me")};return l.dispatch("auth/me",{finally:function(){if(c.value=!0,r.value)if(n.value.is_social_registration_tracked)if(n.value.is_login_tracked){var e={user_id:n.value.id};$env.debug.ecommerce&&console.log(e),!$env.debug.ecommerce&&window.dataLayer&&(window.dataLayer.push({ecommerce:null}),window.dataLayer.push(e))}else{var o={event:"login",user_id:n.value.id,method:n.value.social_provider?n.value.social_provider:"site"};$env.debug.ecommerce&&console.log(o),!$env.debug.ecommerce&&window.dataLayer&&(window.dataLayer.push({ecommerce:null}),window.dataLayer.push(o))}else{var t={event:"sign_up",user_id:n.value.id,method:n.value.social_provider};$env.debug.ecommerce&&console.log(t),!$env.debug.ecommerce&&window.dataLayer&&(window.dataLayer.push({ecommerce:null}),window.dataLayer.push(t))}}}),window.addEventListener("keyup",(function(e){a.value&&"Escape"===e.key&&u()})),t.resetToken&&l.commit("auth/modal","reset"),{mounted:c,user:n,logged:r,modal:a,open:function(){l.commit("auth/modal","login")},close:u,register:function(){l.commit("auth/modal","registration")},logout:function(){l.dispatch("auth/logout")},routes:s}}},l={key:0,class:"auth-user"},n={class:"modal-content"},a=[e.createElementVNode("svg",{class:"icon close"},[e.createElementVNode("use",{"xlink:href":"#close"})],-1)],r={class:"box"},c={class:"tabs"},s={href:"#register"},i={key:1,class:"auth-user is-logged"},d={class:"dropdown is-right is-hoverable"},u={class:"dropdown-trigger"},m=["href"],p=e.createElementVNode("i",{class:"fas fa-user"},null,-1),g=e.createElementVNode("span",{class:"icon is-small"},[e.createElementVNode("i",{class:"fas fa-angle-down","aria-hidden":"true"})],-1),v={class:"dropdown-menu",role:"menu"},h={class:"dropdown-content"},f=["href"],k={key:0,class:"icon"},y=["xlink:href"],E={key:1,class:"badge"},w={key:1,class:"dropdown-divider"},V=e.createElementVNode("hr",{class:"dropdown-divider"},null,-1),N=e.createElementVNode("svg",{class:"icon"},[e.createElementVNode("use",{"xlink:href":"#icon-logout"})],-1);t.render=function(o,t,B,_,b,C){var S=e.resolveComponent("login"),L=e.resolveComponent("registration"),x=e.resolveComponent("reset");return _.mounted&&!_.logged?(e.openBlock(),e.createElementBlock("div",l,[e.renderSlot(o.$slots,"login",{open:_.open,label:o.__("auth.login.login")},(function(){return[e.createElementVNode("a",{href:"#login",class:"button",onClick:t[0]||(t[0]=function(){return _.open&&_.open.apply(_,arguments)})},e.toDisplayString(o.__("auth.login.login")),1)]})),e.createElementVNode("div",{class:e.normalizeClass(["modal",{"is-active":_.modal}])},[e.createElementVNode("div",{class:"modal-background",onClick:t[1]||(t[1]=function(){return _.close&&_.close.apply(_,arguments)})}),e.createElementVNode("div",n,[e.createElementVNode("button",{class:"modal-close is-large",onClick:t[2]||(t[2]=function(){return _.close&&_.close.apply(_,arguments)})},a),e.createElementVNode("div",r,[e.renderSlot(o.$slots,"hero"),e.createElementVNode("div",c,[e.createElementVNode("ul",null,[e.createElementVNode("li",{class:e.normalizeClass({"is-active":"login"==_.modal||"forget"==_.modal})},[e.createElementVNode("a",{href:"#login",onClick:t[3]||(t[3]=function(){return _.open&&_.open.apply(_,arguments)})},e.toDisplayString(o.__("auth.login.login")),1)],2),e.createElementVNode("li",{class:e.normalizeClass({"is-active":"registration"==_.modal}),onClick:t[4]||(t[4]=function(){return _.register&&_.register.apply(_,arguments)})},[e.createElementVNode("a",s,e.toDisplayString(o.__("auth.login.signup")),1)],2)])]),(e.openBlock(),e.createBlock(e.KeepAlive,null,["login"==_.modal||"forget"==_.modal?(e.openBlock(),e.createBlock(S,{key:0,"forget-type":B.forgetType,"show-placeholders":B.showPlaceholders},null,8,["forget-type","show-placeholders"])):e.createCommentVNode("v-if",!0)],1024)),(e.openBlock(),e.createBlock(e.KeepAlive,null,["registration"==_.modal?(e.openBlock(),e.createBlock(L,{key:0})):e.createCommentVNode("v-if",!0)],1024)),e.withDirectives(e.createVNode(x,{"show-placeholders":B.showPlaceholders},null,8,["show-placeholders"]),[[e.vShow,"reset"==_.modal]])])])],2)])):_.mounted?(e.openBlock(),e.createElementBlock("div",i,[e.createElementVNode("div",d,[e.createElementVNode("div",u,[e.createElementVNode("a",{class:"button",href:_.routes[0].path},[e.renderSlot(o.$slots,"user",{user:_.user.name?_.user.name:_.user.email},(function(){return[e.createElementVNode("span",null,[p,e.createTextVNode(" "+e.toDisplayString(_.user.name?_.user.name:_.user.email),1)]),g]}))],8,m)]),e.createElementVNode("div",v,[e.createElementVNode("div",h,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(_.routes,(function(o,t){return e.openBlock(),e.createElementBlock("div",{key:t},[o.text?(e.openBlock(),e.createElementBlock("a",{key:0,href:o.path,class:"dropdown-item"},[o.icon?(e.openBlock(),e.createElementBlock("svg",k,[e.createElementVNode("use",{"xlink:href":"#"+o.icon},null,8,y)])):e.createCommentVNode("v-if",!0),e.createElementVNode("span",null,e.toDisplayString(o.text),1),o.badge?(e.openBlock(),e.createElementBlock("span",E,e.toDisplayString(o.badge),1)):e.createCommentVNode("v-if",!0)],8,f)):(e.openBlock(),e.createElementBlock("hr",w))])})),128)),V,e.createElementVNode("a",{class:"dropdown-item",onClick:t[5]||(t[5]=function(){return _.logout&&_.logout.apply(_,arguments)})},[N,e.createElementVNode("span",null,e.toDisplayString(o.__("auth.user.menu.logout")),1)])])])])])):e.createCommentVNode("v-if",!0)},module.exports=t;
2
2
  //# sourceMappingURL=User.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"User.js","sources":["../../../src/components/auth/User.vue","../../../src/components/auth/User.vue?vue&type=template&id=a9f93de2&lang.js"],"sourcesContent":["<template>\n <div class=\"auth-user\" v-if=\"mounted && !logged\">\n <slot name=\"login\" :open=\"open\" :label=\"__('auth.login.login')\">\n <a href=\"#login\" class=\"button\" @click=\"open\">{{ __('auth.login.login') }}</a>\n </slot>\n <div class=\"modal\" v-bind:class=\"{ 'is-active': modal }\">\n <div class=\"modal-background\" @click=\"close\"></div>\n <div class=\"modal-content\">\n <button class=\"modal-close is-large\" @click=\"close\">\n <svg class=\"icon close\">\n <use xlink:href=\"#close\" />\n </svg>\n </button>\n <div class=\"box\">\n <slot name=\"hero\"></slot>\n <div class=\"tabs\">\n <ul>\n <li v-bind:class=\"{\n 'is-active': modal == 'login' || modal == 'forget'\n }\">\n <a href=\"#login\" @click=\"open\">{{ __('auth.login.login') }}</a>\n </li>\n <li v-bind:class=\"{\n 'is-active': modal == 'registration'\n }\" @click=\"register\">\n <a href=\"#register\">{{ __('auth.login.signup') }}</a>\n </li>\n </ul>\n </div>\n <keep-alive>\n <login v-if=\"modal == 'login' || modal == 'forget'\" :forget-type=\"forgetType\" :show-placeholders=\"showPlaceholders\"></login>\n </keep-alive>\n <keep-alive>\n <registration v-if=\"modal == 'registration'\"></registration>\n </keep-alive>\n <reset v-show=\"modal == 'reset'\" :show-placeholders=\"showPlaceholders\"></reset>\n </div>\n </div>\n </div>\n </div>\n <div class=\"auth-user is-logged\" v-else-if=\"mounted\">\n <div class=\"dropdown is-right is-hoverable\">\n <div class=\"dropdown-trigger\">\n <a class=\"button\" :href=\"routes[0].path\">\n <slot name=\"user\" :user=\"user.name ? user.name : user.email\">\n <span>\n <i class=\"fas fa-user\"></i>\n {{ user.name ? user.name : user.email }}\n </span>\n <span class=\"icon is-small\">\n <i class=\"fas fa-angle-down\" aria-hidden=\"true\"></i>\n </span>\n </slot>\n </a>\n </div>\n <div class=\"dropdown-menu\" role=\"menu\">\n <div class=\"dropdown-content\">\n <div v-for=\"(item, key) in routes\" v-bind:key=\"key\">\n <a :href=\"item.path\" v-if=\"item.text\" class=\"dropdown-item\">\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 class=\"dropdown-divider\" v-else />\n </div>\n <hr class=\"dropdown-divider\" />\n <a class=\"dropdown-item\" @click=\"logout\">\n <svg class=\"icon\">\n <use xlink:href=\"#icon-logout\" />\n </svg>\n <span>{{ __('auth.user.menu.logout') }}</span>\n </a>\n </div>\n </div>\n </div>\n </div>\n</template>\n\n<script>\nimport { ref, computed, provide } from 'vue';\nimport { useStore } from 'vuex';\n\nexport default {\n name: 'user',\n props: {\n resetToken: {\n type: String,\n default: ''\n },\n resetEmail: {\n type: String,\n default: ''\n },\n tokenValid: {\n type: Boolean,\n default: false\n },\n forgetType: {\n type: String,\n default: 'email'\n },\n showPlaceholders: {\n type: Boolean,\n default: false\n }\n },\n setup(props) {\n const store = useStore();\n const user = computed(() => store.getters['auth/me']);\n const modal = computed(() => store.getters['auth/modal']);\n const logged = computed(() => Object.keys(user.value).length > 0);\n const mounted = ref(false);\n const routes = computed(() => store.getters['auth/account']);\n const presetedResetToken = ref('');\n const presetedResetEmail = ref('');\n\n provide('presetedResetToken', presetedResetToken);\n provide('presetedResetEmail', presetedResetEmail);\n\n const open = () => {\n store.commit('auth/modal', 'login');\n };\n\n const close = () => {\n store.commit('auth/modal', null);\n store.dispatch('auth/me');\n };\n\n const logout = () => {\n store.dispatch('auth/logout');\n };\n\n const register = () => {\n store.commit('auth/modal', 'registration');\n };\n\n store.dispatch('auth/me', {\n finally: () => {\n mounted.value = true;\n }\n });\n\n window.addEventListener('keyup', (e) => {\n if (modal.value && e.key === 'Escape') {\n close();\n }\n });\n\n if (props.resetToken) {\n store.commit('auth/modal', 'reset');\n }\n\n return {\n mounted,\n user,\n logged,\n modal,\n open,\n close,\n register,\n logout,\n routes\n };\n }\n};\n</script>","<template>\n <div class=\"auth-user\" v-if=\"mounted && !logged\">\n <slot name=\"login\" :open=\"open\" :label=\"__('auth.login.login')\">\n <a href=\"#login\" class=\"button\" @click=\"open\">{{ __('auth.login.login') }}</a>\n </slot>\n <div class=\"modal\" v-bind:class=\"{ 'is-active': modal }\">\n <div class=\"modal-background\" @click=\"close\"></div>\n <div class=\"modal-content\">\n <button class=\"modal-close is-large\" @click=\"close\">\n <svg class=\"icon close\">\n <use xlink:href=\"#close\" />\n </svg>\n </button>\n <div class=\"box\">\n <slot name=\"hero\"></slot>\n <div class=\"tabs\">\n <ul>\n <li v-bind:class=\"{\n 'is-active': modal == 'login' || modal == 'forget'\n }\">\n <a href=\"#login\" @click=\"open\">{{ __('auth.login.login') }}</a>\n </li>\n <li v-bind:class=\"{\n 'is-active': modal == 'registration'\n }\" @click=\"register\">\n <a href=\"#register\">{{ __('auth.login.signup') }}</a>\n </li>\n </ul>\n </div>\n <keep-alive>\n <login v-if=\"modal == 'login' || modal == 'forget'\" :forget-type=\"forgetType\" :show-placeholders=\"showPlaceholders\"></login>\n </keep-alive>\n <keep-alive>\n <registration v-if=\"modal == 'registration'\"></registration>\n </keep-alive>\n <reset v-show=\"modal == 'reset'\" :show-placeholders=\"showPlaceholders\"></reset>\n </div>\n </div>\n </div>\n </div>\n <div class=\"auth-user is-logged\" v-else-if=\"mounted\">\n <div class=\"dropdown is-right is-hoverable\">\n <div class=\"dropdown-trigger\">\n <a class=\"button\" :href=\"routes[0].path\">\n <slot name=\"user\" :user=\"user.name ? user.name : user.email\">\n <span>\n <i class=\"fas fa-user\"></i>\n {{ user.name ? user.name : user.email }}\n </span>\n <span class=\"icon is-small\">\n <i class=\"fas fa-angle-down\" aria-hidden=\"true\"></i>\n </span>\n </slot>\n </a>\n </div>\n <div class=\"dropdown-menu\" role=\"menu\">\n <div class=\"dropdown-content\">\n <div v-for=\"(item, key) in routes\" v-bind:key=\"key\">\n <a :href=\"item.path\" v-if=\"item.text\" class=\"dropdown-item\">\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 class=\"dropdown-divider\" v-else />\n </div>\n <hr class=\"dropdown-divider\" />\n <a class=\"dropdown-item\" @click=\"logout\">\n <svg class=\"icon\">\n <use xlink:href=\"#icon-logout\" />\n </svg>\n <span>{{ __('auth.user.menu.logout') }}</span>\n </a>\n </div>\n </div>\n </div>\n </div>\n</template>\n\n<script>\nimport { ref, computed, provide } from 'vue';\nimport { useStore } from 'vuex';\n\nexport default {\n name: 'user',\n props: {\n resetToken: {\n type: String,\n default: ''\n },\n resetEmail: {\n type: String,\n default: ''\n },\n tokenValid: {\n type: Boolean,\n default: false\n },\n forgetType: {\n type: String,\n default: 'email'\n },\n showPlaceholders: {\n type: Boolean,\n default: false\n }\n },\n setup(props) {\n const store = useStore();\n const user = computed(() => store.getters['auth/me']);\n const modal = computed(() => store.getters['auth/modal']);\n const logged = computed(() => Object.keys(user.value).length > 0);\n const mounted = ref(false);\n const routes = computed(() => store.getters['auth/account']);\n const presetedResetToken = ref('');\n const presetedResetEmail = ref('');\n\n provide('presetedResetToken', presetedResetToken);\n provide('presetedResetEmail', presetedResetEmail);\n\n const open = () => {\n store.commit('auth/modal', 'login');\n };\n\n const close = () => {\n store.commit('auth/modal', null);\n store.dispatch('auth/me');\n };\n\n const logout = () => {\n store.dispatch('auth/logout');\n };\n\n const register = () => {\n store.commit('auth/modal', 'registration');\n };\n\n store.dispatch('auth/me', {\n finally: () => {\n mounted.value = true;\n }\n });\n\n window.addEventListener('keyup', (e) => {\n if (modal.value && e.key === 'Escape') {\n close();\n }\n });\n\n if (props.resetToken) {\n store.commit('auth/modal', 'reset');\n }\n\n return {\n mounted,\n user,\n logged,\n modal,\n open,\n close,\n register,\n logout,\n routes\n };\n }\n};\n</script>"],"names":["name","props","resetToken","type","String","resetEmail","tokenValid","Boolean","forgetType","showPlaceholders","setup","store","useStore","user","computed","getters","modal","logged","Object","keys","value","length","mounted","ref","routes","presetedResetToken","presetedResetEmail","provide","close","commit","dispatch","window","addEventListener","e","key","open","register","logout","_createElementVNode","href","role","$setup","_createElementBlock","_hoisted_1","_renderSlot","label","_ctx","onClick","_hoisted_2","_hoisted_5","_hoisted_6","_hoisted_7","_createBlock","$props","_createVNode","_hoisted_8","_hoisted_9","_hoisted_10","path","email","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_15","item","text","icon","_hoisted_17","badge","_hoisted_19","_hoisted_20","_hoisted_21","_hoisted_22"],"mappings":"sDAoFe,CACXA,KAAM,OACNC,MAAO,CACHC,WAAY,CACRC,KAAMC,eACG,IAEbC,WAAY,CACRF,KAAMC,eACG,IAEbE,WAAY,CACRH,KAAMI,iBACG,GAEbC,WAAY,CACRL,KAAMC,eACG,SAEbK,iBAAkB,CACdN,KAAMI,iBACG,IAGjBG,eAAMT,OACIU,EAAQC,aACRC,EAAOC,YAAS,kBAAMH,EAAMI,QAAQ,cACpCC,EAAQF,YAAS,kBAAMH,EAAMI,QAAQ,iBACrCE,EAASH,YAAS,kBAAMI,OAAOC,KAAKN,EAAKO,OAAOC,OAAS,KACzDC,EAAUC,OAAI,GACdC,EAASV,YAAS,kBAAMH,EAAMI,QAAQ,mBACtCU,EAAqBF,MAAI,IACzBG,EAAqBH,MAAI,IAE/BI,UAAQ,qBAAsBF,GAC9BE,UAAQ,qBAAsBD,OAMxBE,EAAQ,WACVjB,EAAMkB,OAAO,aAAc,MAC3BlB,EAAMmB,SAAS,mBAWnBnB,EAAMmB,SAAS,UAAW,SACb,WACLR,EAAQF,OAAQ,KAIxBW,OAAOC,iBAAiB,SAAS,SAACC,GAC1BjB,EAAMI,OAAmB,WAAVa,EAAEC,KACjBN,OAIJ3B,EAAMC,YACNS,EAAMkB,OAAO,aAAc,SAGxB,CACHP,QAAAA,EACAT,KAAAA,EACAI,OAAAA,EACAD,MAAAA,EACAmB,KAtCS,WACTxB,EAAMkB,OAAO,aAAc,UAsC3BD,MAAAA,EACAQ,SA3Ba,WACbzB,EAAMkB,OAAO,aAAc,iBA2B3BQ,OAhCW,WACX1B,EAAMmB,SAAS,gBAgCfN,OAAAA,oBClKG,sBAMQ,oBAEHc,kCAAW,eACPA,yCAAgB,0BAGb,gBAEI,WAUIC,KAAK,4BAezB,gCACI,2CACI,iCAIKD,gCAAS,0BAGbA,mCAAY,kBACRA,gCAAS,kCAAgC,uBAK9C,gBAAgBE,KAAK,iBACjB,8CAGY,wCAIC,wBAEN,sBAEdF,iCAAU,+BAENA,kCAAW,SACPA,yCAAgB,iKArEXG,YAAYA,wBAAzCC,2BAAAC,GACIC,+BAAoBT,KAAMM,OAAOI,MAAOC,2BAAxC,kBACIR,0BAAGC,KAAK,eAAe,SAAUQ,sCAAON,uDAASK,iCAErDR,oDAAW,qBAAqCG,aAC5CH,kCAAW,mBAAoBS,sCAAON,wCACtCH,2BAAAU,GACIV,qCAAc,uBAAwBS,sCAAON,0CAK7CH,2BAAAW,GACIL,8BACAN,2BAAAY,GACIZ,gCACIA,uGAGIA,0BAAGC,KAAK,SAAUQ,sCAAON,uDAASK,iCAEtCR,yFAEIS,sCAAON,8CACPH,yBAAAa,oBAAuBL,qDAInCM,yCACiBX,mBAAoBA,uBAAjCW,qCAAkEC,iCAAgCA,wHAEtGD,gDACwBX,uBAApBW,mFAEJE,qCAAqDD,qEAAtCZ,sBAKaA,yBAA5CC,2BAAAa,GACIjB,2BAAAkB,GACIlB,2BAAAmB,GACInB,gCAAS,SAAUC,KAAME,YAAUiB,OAC/Bd,8BAAmB/B,KAAM4B,OAAKzC,KAAOyC,OAAKzC,KAAOyC,OAAKkB,QAAtD,kBACIrB,kCACIsB,0CACGnB,OAAKzC,KAAOyC,OAAKzC,KAAOyC,OAAKkB,YAEpCE,cAMZvB,2BAAAwB,GACIxB,2BAAAyB,oBACIrB,kDAA2BD,mBAAduB,EAAM9B,wBAAnBQ,4BAA0CR,IAAKA,IAChB8B,EAAKC,oBAAhCvB,gCAAIH,KAAMyB,EAAKN,WAA6B,kBAChBM,EAAKE,oBAA7BxB,2BAAAyB,GACI7B,6CAAwB0B,EAAKE,mDAEjC5B,mDAAS0B,EAAKC,SACYD,EAAKI,qBAA/B1B,4BAAA2B,oBAAyCL,EAAKI,iEAElD1B,0BAAA4B,eAEJC,EACAjC,gCAAS,gBAAiBS,sCAAON,0CAC7B+B,EAGAlC,mDAASQ"}
1
+ {"version":3,"file":"User.js","sources":["../../../src/components/auth/User.vue","../../../src/components/auth/User.vue?vue&type=template&id=6f339bea&lang.js"],"sourcesContent":["<template>\n <div class=\"auth-user\" v-if=\"mounted && !logged\">\n <slot name=\"login\" :open=\"open\" :label=\"__('auth.login.login')\">\n <a href=\"#login\" class=\"button\" @click=\"open\">{{ __('auth.login.login') }}</a>\n </slot>\n <div class=\"modal\" v-bind:class=\"{ 'is-active': modal }\">\n <div class=\"modal-background\" @click=\"close\"></div>\n <div class=\"modal-content\">\n <button class=\"modal-close is-large\" @click=\"close\">\n <svg class=\"icon close\">\n <use xlink:href=\"#close\" />\n </svg>\n </button>\n <div class=\"box\">\n <slot name=\"hero\"></slot>\n <div class=\"tabs\">\n <ul>\n <li v-bind:class=\"{\n 'is-active': modal == 'login' || modal == 'forget'\n }\">\n <a href=\"#login\" @click=\"open\">{{ __('auth.login.login') }}</a>\n </li>\n <li v-bind:class=\"{\n 'is-active': modal == 'registration'\n }\" @click=\"register\">\n <a href=\"#register\">{{ __('auth.login.signup') }}</a>\n </li>\n </ul>\n </div>\n <keep-alive>\n <login v-if=\"modal == 'login' || modal == 'forget'\" :forget-type=\"forgetType\" :show-placeholders=\"showPlaceholders\"></login>\n </keep-alive>\n <keep-alive>\n <registration v-if=\"modal == 'registration'\"></registration>\n </keep-alive>\n <reset v-show=\"modal == 'reset'\" :show-placeholders=\"showPlaceholders\"></reset>\n </div>\n </div>\n </div>\n </div>\n <div class=\"auth-user is-logged\" v-else-if=\"mounted\">\n <div class=\"dropdown is-right is-hoverable\">\n <div class=\"dropdown-trigger\">\n <a class=\"button\" :href=\"routes[0].path\">\n <slot name=\"user\" :user=\"user.name ? user.name : user.email\">\n <span>\n <i class=\"fas fa-user\"></i>\n {{ user.name ? user.name : user.email }}\n </span>\n <span class=\"icon is-small\">\n <i class=\"fas fa-angle-down\" aria-hidden=\"true\"></i>\n </span>\n </slot>\n </a>\n </div>\n <div class=\"dropdown-menu\" role=\"menu\">\n <div class=\"dropdown-content\">\n <div v-for=\"(item, key) in routes\" v-bind:key=\"key\">\n <a :href=\"item.path\" v-if=\"item.text\" class=\"dropdown-item\">\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 class=\"dropdown-divider\" v-else />\n </div>\n <hr class=\"dropdown-divider\" />\n <a class=\"dropdown-item\" @click=\"logout\">\n <svg class=\"icon\">\n <use xlink:href=\"#icon-logout\" />\n </svg>\n <span>{{ __('auth.user.menu.logout') }}</span>\n </a>\n </div>\n </div>\n </div>\n </div>\n</template>\n\n<script>\nimport { ref, computed, provide, isVNode } from 'vue';\nimport { useStore } from 'vuex';\n\nexport default {\n name: 'user',\n props: {\n resetToken: {\n type: String,\n default: ''\n },\n resetEmail: {\n type: String,\n default: ''\n },\n tokenValid: {\n type: Boolean,\n default: false\n },\n forgetType: {\n type: String,\n default: 'email'\n },\n showPlaceholders: {\n type: Boolean,\n default: false\n }\n },\n setup(props) {\n const store = useStore();\n const user = computed(() => store.getters['auth/me']);\n const modal = computed(() => store.getters['auth/modal']);\n const logged = computed(() => Object.keys(user.value).length > 0);\n const mounted = ref(false);\n const routes = computed(() => store.getters['auth/account']);\n const presetedResetToken = ref('');\n const presetedResetEmail = ref('');\n\n provide('presetedResetToken', presetedResetToken);\n provide('presetedResetEmail', presetedResetEmail);\n\n const open = () => {\n store.commit('auth/modal', 'login');\n };\n\n const close = () => {\n store.commit('auth/modal', null);\n store.dispatch('auth/me');\n };\n\n const logout = () => {\n store.dispatch('auth/logout');\n };\n\n const register = () => {\n store.commit('auth/modal', 'registration');\n };\n\n store.dispatch('auth/me', {\n finally: () => {\n mounted.value = true;\n\n if (logged.value) {\n if (!user.value.is_social_registration_tracked) {\n let object = {\n event: 'sign_up',\n user_id: user.value.id,\n method: user.value.social_provider\n };\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n } else if (!user.value.is_login_tracked) {\n let object = {\n event: 'login',\n user_id: user.value.id,\n method: user.value.social_provider ? user.value.social_provider : 'site'\n };\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n } else {\n let object = {\n user_id: user.value.id\n };\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n }\n }\n }\n });\n\n window.addEventListener('keyup', (e) => {\n if (modal.value && e.key === 'Escape') {\n close();\n }\n });\n\n if (props.resetToken) {\n store.commit('auth/modal', 'reset');\n }\n\n return {\n mounted,\n user,\n logged,\n modal,\n open,\n close,\n register,\n logout,\n routes\n };\n }\n};\n</script>","<template>\n <div class=\"auth-user\" v-if=\"mounted && !logged\">\n <slot name=\"login\" :open=\"open\" :label=\"__('auth.login.login')\">\n <a href=\"#login\" class=\"button\" @click=\"open\">{{ __('auth.login.login') }}</a>\n </slot>\n <div class=\"modal\" v-bind:class=\"{ 'is-active': modal }\">\n <div class=\"modal-background\" @click=\"close\"></div>\n <div class=\"modal-content\">\n <button class=\"modal-close is-large\" @click=\"close\">\n <svg class=\"icon close\">\n <use xlink:href=\"#close\" />\n </svg>\n </button>\n <div class=\"box\">\n <slot name=\"hero\"></slot>\n <div class=\"tabs\">\n <ul>\n <li v-bind:class=\"{\n 'is-active': modal == 'login' || modal == 'forget'\n }\">\n <a href=\"#login\" @click=\"open\">{{ __('auth.login.login') }}</a>\n </li>\n <li v-bind:class=\"{\n 'is-active': modal == 'registration'\n }\" @click=\"register\">\n <a href=\"#register\">{{ __('auth.login.signup') }}</a>\n </li>\n </ul>\n </div>\n <keep-alive>\n <login v-if=\"modal == 'login' || modal == 'forget'\" :forget-type=\"forgetType\" :show-placeholders=\"showPlaceholders\"></login>\n </keep-alive>\n <keep-alive>\n <registration v-if=\"modal == 'registration'\"></registration>\n </keep-alive>\n <reset v-show=\"modal == 'reset'\" :show-placeholders=\"showPlaceholders\"></reset>\n </div>\n </div>\n </div>\n </div>\n <div class=\"auth-user is-logged\" v-else-if=\"mounted\">\n <div class=\"dropdown is-right is-hoverable\">\n <div class=\"dropdown-trigger\">\n <a class=\"button\" :href=\"routes[0].path\">\n <slot name=\"user\" :user=\"user.name ? user.name : user.email\">\n <span>\n <i class=\"fas fa-user\"></i>\n {{ user.name ? user.name : user.email }}\n </span>\n <span class=\"icon is-small\">\n <i class=\"fas fa-angle-down\" aria-hidden=\"true\"></i>\n </span>\n </slot>\n </a>\n </div>\n <div class=\"dropdown-menu\" role=\"menu\">\n <div class=\"dropdown-content\">\n <div v-for=\"(item, key) in routes\" v-bind:key=\"key\">\n <a :href=\"item.path\" v-if=\"item.text\" class=\"dropdown-item\">\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 class=\"dropdown-divider\" v-else />\n </div>\n <hr class=\"dropdown-divider\" />\n <a class=\"dropdown-item\" @click=\"logout\">\n <svg class=\"icon\">\n <use xlink:href=\"#icon-logout\" />\n </svg>\n <span>{{ __('auth.user.menu.logout') }}</span>\n </a>\n </div>\n </div>\n </div>\n </div>\n</template>\n\n<script>\nimport { ref, computed, provide, isVNode } from 'vue';\nimport { useStore } from 'vuex';\n\nexport default {\n name: 'user',\n props: {\n resetToken: {\n type: String,\n default: ''\n },\n resetEmail: {\n type: String,\n default: ''\n },\n tokenValid: {\n type: Boolean,\n default: false\n },\n forgetType: {\n type: String,\n default: 'email'\n },\n showPlaceholders: {\n type: Boolean,\n default: false\n }\n },\n setup(props) {\n const store = useStore();\n const user = computed(() => store.getters['auth/me']);\n const modal = computed(() => store.getters['auth/modal']);\n const logged = computed(() => Object.keys(user.value).length > 0);\n const mounted = ref(false);\n const routes = computed(() => store.getters['auth/account']);\n const presetedResetToken = ref('');\n const presetedResetEmail = ref('');\n\n provide('presetedResetToken', presetedResetToken);\n provide('presetedResetEmail', presetedResetEmail);\n\n const open = () => {\n store.commit('auth/modal', 'login');\n };\n\n const close = () => {\n store.commit('auth/modal', null);\n store.dispatch('auth/me');\n };\n\n const logout = () => {\n store.dispatch('auth/logout');\n };\n\n const register = () => {\n store.commit('auth/modal', 'registration');\n };\n\n store.dispatch('auth/me', {\n finally: () => {\n mounted.value = true;\n\n if (logged.value) {\n if (!user.value.is_social_registration_tracked) {\n let object = {\n event: 'sign_up',\n user_id: user.value.id,\n method: user.value.social_provider\n };\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n } else if (!user.value.is_login_tracked) {\n let object = {\n event: 'login',\n user_id: user.value.id,\n method: user.value.social_provider ? user.value.social_provider : 'site'\n };\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n } else {\n let object = {\n user_id: user.value.id\n };\n\n if ($env.debug.ecommerce) {\n console.log(object);\n }\n\n if (!$env.debug.ecommerce && window.dataLayer) {\n window.dataLayer.push({\n ecommerce: null\n });\n\n window.dataLayer.push(object);\n }\n }\n }\n }\n });\n\n window.addEventListener('keyup', (e) => {\n if (modal.value && e.key === 'Escape') {\n close();\n }\n });\n\n if (props.resetToken) {\n store.commit('auth/modal', 'reset');\n }\n\n return {\n mounted,\n user,\n logged,\n modal,\n open,\n close,\n register,\n logout,\n routes\n };\n }\n};\n</script>"],"names":["name","props","resetToken","type","String","resetEmail","tokenValid","Boolean","forgetType","showPlaceholders","setup","store","useStore","user","computed","getters","modal","logged","Object","keys","value","length","mounted","ref","routes","presetedResetToken","presetedResetEmail","provide","close","commit","dispatch","is_social_registration_tracked","is_login_tracked","object","user_id","id","$env","debug","ecommerce","console","log","window","dataLayer","push","event","method","social_provider","addEventListener","e","key","open","register","logout","_createElementVNode","href","role","$setup","_createElementBlock","_hoisted_1","_renderSlot","label","_ctx","onClick","_hoisted_2","_hoisted_5","_hoisted_6","_hoisted_7","_createBlock","$props","_createVNode","_hoisted_8","_hoisted_9","_hoisted_10","path","email","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_15","item","text","icon","_hoisted_17","badge","_hoisted_19","_hoisted_20","_hoisted_21","_hoisted_22"],"mappings":"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"}
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("vue"),t=require("vuex"),r=require("@perevorot/shop/dist/api"),o=require("simplebar"),n=require("secure-ls");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=l(o),c=l(n);var s=e.defineComponent({name:"search",props:{q:{type:String,default:""},placeholder:{type:String,default:""},placeholderMobile:{type:String,default:""},parameter:{type:String,default:"/q{separator}"},isHistory:{type:Boolean,default:!0},isToggleDropdownOnClose:{type:Boolean,default:!0},htmlClass:{type:String,default:""}},setup:function(o){var n=new c.default({isCompression:!1}),l=o.q;if(l){var s=document.createElement("textarea");s.innerHTML=l,l=s.value}var i=e.ref(!1),d=e.ref(l),u=e.ref([]),p=e.ref([]),m=e.ref(0),h=e.ref(-1),v=e.ref(!1),f=e.ref(),y=e.ref(""),g=e.ref(),k=e.ref(n.get("search")),w=e.ref([]),E=t.useStore(),B=e.computed((function(){return E.getters["auth/me"]})),V=[],N=function(){clearTimeout(void 0),h.value=-1,d.value.trim()?(i.value=!0,d.value.trim()&&r.shop.search(d.value).then((function(e){e.data&&(C(),u.value=e.data.products,m.value=e.data.total,y.value=e.data.separator,p.value=e.data.byCategory,new a.default(g.value))})).finally((function(){i.value=!1}))):(u.value=[],i.value=!1)},C=function(){if(d.value.length>1){var e=n.get("search")?n.get("search"):[];-1!==e.indexOf(d.value)&&(e=e.filter((function(e){return e!==d.value}))),e.length>4&&(e=e.slice(0,4)),e.unshift(d.value),n.set("search",e),k.value=e}};e.onBeforeUpdate((function(){V=[]})),e.watch((function(){return d.value}),(function(){v.value=!0,h.value=-1,N()}));var S=e.computed((function(){return d.value?$env.locale.url+"/search"+_.value:$env.locale.url+"/search"})),_=e.computed((function(){return o.parameter.replace("{separator}",y.value)+d.value.toLowerCase()})),D=function(e){e.target.closest(".cart")||(o.isToggleDropdownOnClose&&(v.value=!1,o.htmlClass&&document.querySelector("html").classList.remove(o.htmlClass)),h.value=-1)};window.addEventListener("click",D);var L,b=e.computed((function(){return d.value.length>3?w.value.filter((function(e){return-1!==e.search.indexOf(d.value)})):[]})),q=(L=function(){var e,t,r,n=document.getElementById("menu");return n&&n.querySelectorAll("[data-search]").forEach((function(e){var t=e.textContent.trim(),r=e.dataset.search;w.value.push({name:(r?r+" / ":"")+t,search:t.toLowerCase(),href:e.closest("a").href})})),o.q&&N(),r?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)},function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return Promise.resolve(L.apply(this,e))}catch(e){return Promise.reject(e)}});document.addEventListener("DOMContentLoaded",q,!1);var x=e.ref(o.placeholder);if(o.placeholderMobile){var H=function(){var e=window.matchMedia("(max-width: 768px)").matches;x.value=e?o.placeholderMobile:o.placeholder};window.addEventListener("resize",H,{passive:!0}),H()}return{isLoading:i,term:d,results:u,next:function(){h.value<u.value.length-1&&h.value++},prev:function(){h.value>=0&&h.value--},current:h,add:function(e){h.value>=0&&(e.preventDefault(),V[h.value].add())},cartRefs:function(e){e&&V.push(e)},isDropdown:v,preventCaret:function(e){(38==e.which||40==e.which||32==e.which&&h.value>=0)&&e.preventDefault()},esc:function(e){f.value.blur(),D(e)},input:f,dropdown:function(){v.value=!0,h.value=-1,o.htmlClass&&document.querySelector("html").classList.add(o.htmlClass)},total:m,searchUrl:S,searchHrefWithParameter:_,open:function(){h.value>=0?window.location.href=u.value[h.value].href:window.location.href=S.value},categories:b,byCategory:p,dropdownContent:g,history:k,clearSearchHistory:function(e){n.remove("search"),k.value=[],f.value.focus()},setSearchHistory:function(e){e.value=e},user:B,clear:function(){d.value="",f.value.focus()},placeholderMobilized:x}}}),i={class:"dropdown-trigger"},d=["placeholder"],u={class:"icon is-small is-right"},p=[e.createElementVNode("i",{class:"fas fa-search"},null,-1)],m={key:1,class:"dropdown-menu"},h={class:"dropdown-content"},v={class:"history-list"},f={class:"dropdown-item history-list-title"},y=["onClick"],g={class:"dropdown-item history-list-clear"},k={class:"dropdown-menu"},w={class:"dropdown-content",style:{"max-height":"600px",overflow:"auto"},ref:"dropdownContent"},E={key:0,class:"results-list"},B=["href"],V={key:0,class:"dropdown-divider"},N={key:1,class:"results-list-category"},C={class:"dropdown-item categories-list-title"},S=["href"],_={key:2,class:"results-list-total"},D={class:"dropdown-item mb-3 mt-2"},L=e.createElementVNode("br",null,null,-1),b=["href"],q={key:3,class:"products-list"},x={class:"dropdown-item products-list-title"},H={class:"columns"},M={class:"column"},T={class:"title"},P=["href"],K=["innerHTML"],$={key:0,class:"price_old"},z=["innerHTML"],O={class:"code"},F={key:1,class:"quantity"},R={key:2,class:"no-quantity"},U={key:0,class:"column is-narrow"},W={key:1,class:"column is-eol"},j={key:0,class:"dropdown-content"},A={class:"dropdown-item"},I=["innerHTML"];s.render=function(t,r,o,n,l,a){var c=e.resolveComponent("cart-add");return e.openBlock(),e.createElementBlock("div",{class:"shop-search",onClick:r[10]||(r[10]=function(e){return e.stopPropagation()})},[e.createElementVNode("div",{class:e.normalizeClass(["dropdown",{"is-active":t.isDropdown,"is-dropdown-visible":t.isDropdown&&(t.history.length&&!t.term||t.results.length||t.categories.length||t.term&&!t.isLoading&&!t.results.length&&!t.categories.length)}])},[t.htmlClass?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:"overlay search-overlay",onClick:r[0]||(r[0]=function(e){return t.esc(e)})})),e.createElementVNode("div",i,[e.createElementVNode("div",{class:e.normalizeClass(["control has-icons-right",{"is-loading":t.isLoading}])},[e.withDirectives(e.createElementVNode("input",{class:"input",type:"text","onUpdate:modelValue":r[1]||(r[1]=function(e){return t.term=e}),ref:"input",placeholder:t.placeholderMobilized,onKeyup:[r[2]||(r[2]=e.withKeys((function(){return t.next&&t.next.apply(t,arguments)}),["arrow-down"])),r[3]||(r[3]=e.withKeys((function(){return t.prev&&t.prev.apply(t,arguments)}),["arrow-up"])),r[4]||(r[4]=e.withKeys((function(e){return t.add(e)}),["space"])),r[5]||(r[5]=e.withKeys((function(){return t.open&&t.open.apply(t,arguments)}),["enter"])),r[6]||(r[6]=e.withKeys((function(e){return t.esc(e)}),["esc"]))],onClick:r[7]||(r[7]=function(){return t.dropdown&&t.dropdown.apply(t,arguments)}),onKeydown:r[8]||(r[8]=function(e){return t.preventCaret(e)})},null,40,d),[[e.vModelText,t.term]]),e.renderSlot(t.$slots,"clear",{clear:t.clear,term:t.term}),e.renderSlot(t.$slots,"icon",{isLoading:t.isLoading},(function(){return[e.withDirectives(e.createElementVNode("span",u,p,512),[[e.vShow,!t.isLoading]])]}))],2)]),t.isHistory&&t.isDropdown&&t.history.length&&!t.term?(e.openBlock(),e.createElementBlock("div",m,[e.createElementVNode("div",h,[e.createElementVNode("div",v,[e.createElementVNode("div",f,[e.createElementVNode("p",null,e.toDisplayString(t.__("shop.search.history")),1)]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.history,(function(r,o){return e.openBlock(),e.createElementBlock("div",{class:"dropdown-item",key:o},[e.createElementVNode("a",{onClick:function(e){return t.term=r}},e.toDisplayString(r),9,y)])})),128)),e.createElementVNode("div",g,[e.createElementVNode("a",{onClick:r[9]||(r[9]=function(e){return t.clearSearchHistory(e)})},e.toDisplayString(t.__("shop.search.history_clear")),1)])])])])):e.createCommentVNode("v-if",!0),e.withDirectives(e.createElementVNode("div",k,[e.withDirectives(e.createElementVNode("div",w,[e.renderSlot(t.$slots,"results-header"),t.categories.length?(e.openBlock(),e.createElementBlock("div",E,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.categories,(function(t,r){return e.openBlock(),e.createElementBlock("div",{class:"dropdown-item",key:r},[e.createElementVNode("div",null,[e.createElementVNode("a",{href:t.href},e.toDisplayString(t.name),9,B)])])})),128)),t.byCategory.length?(e.openBlock(),e.createElementBlock("hr",V)):e.createCommentVNode("v-if",!0)])):e.createCommentVNode("v-if",!0),t.byCategory.length?(e.openBlock(),e.createElementBlock("div",N,[e.createElementVNode("div",C,e.toDisplayString(t.__("shop.search.categories")),1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.byCategory,(function(r,o){return e.openBlock(),e.createElementBlock("div",{class:"dropdown-item",key:o},[e.renderSlot(t.$slots,"item-category",{item:r,searchHrefWithParameter:t.searchHrefWithParameter},(function(){return[e.createElementVNode("div",null,[e.createElementVNode("a",{href:r.href+t.searchHrefWithParameter},e.toDisplayString(r.name),9,S)]),e.createElementVNode("div",null,e.toDisplayString(t.__("shop.search.category_found",{count:r.count})),1)]}))])})),128))])):e.createCommentVNode("v-if",!0),t.total?(e.openBlock(),e.createElementBlock("div",_,[e.createElementVNode("p",D,[e.createTextVNode(e.toDisplayString(t.__("shop.search.total_found",{total:t.total}))+" ",1),L,e.createElementVNode("a",{href:t.searchUrl},e.toDisplayString(t.__("shop.search.open_results")),9,b)])])):e.createCommentVNode("v-if",!0),t.results.length?(e.openBlock(),e.createElementBlock("div",q,[e.createElementVNode("div",x,e.toDisplayString(t.__("shop.search.products")),1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.results,(function(r,o){return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["dropdown-item",{"is-active":t.current==o}]),key:r.id},[e.renderSlot(t.$slots,"item",{user:t.user,item:r,cartRefs:t.cartRefs},(function(){return[e.createElementVNode("div",H,[e.createElementVNode("div",M,[e.createElementVNode("div",T,[e.createElementVNode("a",{href:r.href},e.toDisplayString(r.name),9,P)]),e.createElementVNode("div",{class:"price",innerHTML:r.price},null,8,K),r.price_old?(e.openBlock(),e.createElementBlock("div",$,[e.createElementVNode("span",{innerHTML:r.price_old},null,8,z)])):e.createCommentVNode("v-if",!0),e.createElementVNode("div",O,e.toDisplayString(r.code),1),r.quantity?(e.openBlock(),e.createElementBlock("div",F,e.toDisplayString(t.__("shop.search.in_stock")),1)):(e.openBlock(),e.createElementBlock("span",R,e.toDisplayString(t.__("shop.search.out_stock")),1))]),r.is_eol?(e.openBlock(),e.createElementBlock("div",W,e.toDisplayString(t.__("shop.search.eol")),1)):(e.openBlock(),e.createElementBlock("div",U,[e.createVNode(c,{id:r.id,"is-change-quantity":!1,"is-already-in-cart":!1,ref_for:!0,ref:t.cartRefs},null,8,["id"])]))])]}))],2)})),128))])):e.createCommentVNode("v-if",!0)],512),[[e.vShow,t.results.length||t.categories.length]]),t.isLoading||t.results.length||t.categories.length?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("div",j,[e.createElementVNode("div",A,[e.createElementVNode("div",{class:"no-results",innerHTML:t.__("shop.search.no_results")},null,8,I)])]))],512),[[e.vShow,t.results.length||t.term]])],2)])},module.exports=s;
1
+ "use strict";var e=require("vue"),t=require("vuex"),r=require("@perevorot/shop/dist/api"),o=require("simplebar"),n=require("secure-ls");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=a(o),c=a(n);var i=e.defineComponent({name:"search",props:{q:{type:String,default:""},placeholder:{type:String,default:""},placeholderMobile:{type:String,default:""},parameter:{type:String,default:"/q{separator}"},isHistory:{type:Boolean,default:!0},isToggleDropdownOnClose:{type:Boolean,default:!0},htmlClass:{type:String,default:""}},setup:function(o){var n=new c.default({isCompression:!1}),a=o.q;if(a){var i=document.createElement("textarea");i.innerHTML=a,a=i.value}var s=e.ref(!1),d=e.ref(a),u=e.ref([]),p=e.ref([]),m=e.ref(0),h=e.ref(-1),v=e.ref(!1),f=e.ref(),y=e.ref(""),g=e.ref(),w=e.ref(n.get("search")),k=e.ref([]),E=t.useStore(),C=e.computed((function(){return E.getters["auth/me"]})),B=e.ref(null),V=[],N=!1,_=function(){clearTimeout(void 0),h.value=-1,d.value.trim()?(s.value=!0,d.value.trim()&&r.shop.search(d.value).then((function(t){if(t.data){if(L(),u.value=t.data.products,m.value=t.data.total,y.value=t.data.separator,p.value=t.data.byCategory,new l.default(g.value),!N&&v.value){N=!0;var r={event:"search_start"};$env.debug.ecommerce&&console.log(r),!$env.debug.ecommerce&&window.dataLayer&&(window.dataLayer.push({ecommerce:null}),window.dataLayer.push(r))}if(!u.value.length&&!M.value.length&&v.value){var o={event:"search_no_results",search_query:d.value};$env.debug.ecommerce&&console.log(o),!$env.debug.ecommerce&&window.dataLayer&&(window.dataLayer.push({ecommerce:null}),window.dataLayer.push(o))}e.nextTick((function(){window.promoCodeCallback&&"function"==typeof window.promoCodeCallback&&window.promoCodeCallback(B.value,".dropdown-item:not(.products-list-title)")}))}})).finally((function(){s.value=!1}))):(u.value=[],s.value=!1)},L=function(){if(d.value.length>1){var e=n.get("search")?n.get("search"):[];-1!==e.indexOf(d.value)&&(e=e.filter((function(e){return e!==d.value}))),e.length>4&&(e=e.slice(0,4)),e.unshift(d.value),n.set("search",e),w.value=e}};e.onBeforeUpdate((function(){V=[]})),e.watch((function(){return d.value}),(function(){v.value=!0,h.value=-1,_()}));var S=e.computed((function(){return d.value?$env.locale.url+"/search"+D.value:$env.locale.url+"/search"})),D=e.computed((function(){return o.parameter.replace("{separator}",y.value)+d.value.toLowerCase()})),b=function(e){e.target.closest(".cart")||(o.isToggleDropdownOnClose&&(v.value=!1,o.htmlClass&&document.querySelector("html").classList.remove(o.htmlClass)),h.value=-1)};window.addEventListener("click",b);var q,M=e.computed((function(){return d.value.length>3?k.value.filter((function(e){return-1!==e.search.indexOf(d.value)})):[]})),x=(q=function(){var e,t,r,n=document.getElementById("menu");return n&&n.querySelectorAll("[data-search]").forEach((function(e){var t=e.textContent.trim(),r=e.dataset.search;k.value.push({name:(r?r+" / ":"")+t,search:t.toLowerCase(),href:e.closest("a").href})})),o.q&&_(),r?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)},function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return Promise.resolve(q.apply(this,e))}catch(e){return Promise.reject(e)}});document.addEventListener("DOMContentLoaded",x,!1);var H=e.ref(o.placeholder);if(o.placeholderMobile){var T=function(){var e=window.matchMedia("(max-width: 768px)").matches;H.value=e?o.placeholderMobile:o.placeholder};window.addEventListener("resize",T,{passive:!0}),T()}return{isLoading:s,term:d,results:u,next:function(){h.value<u.value.length-1&&h.value++},prev:function(){h.value>=0&&h.value--},current:h,add:function(e){h.value>=0&&(e.preventDefault(),V[h.value].add())},cartRefs:function(e){e&&V.push(e)},isDropdown:v,preventCaret:function(e){(38==e.which||40==e.which||32==e.which&&h.value>=0)&&e.preventDefault()},esc:function(e){f.value.blur(),b(e)},input:f,dropdown:function(){v.value=!0,h.value=-1,o.htmlClass&&document.querySelector("html").classList.add(o.htmlClass)},total:m,searchUrl:S,searchHrefWithParameter:D,open:function(){h.value>=0?window.location.href=u.value[h.value].href:window.location.href=S.value},categories:M,byCategory:p,dropdownContent:g,history:w,clearSearchHistory:function(e){n.remove("search"),w.value=[],f.value.focus()},setSearchHistory:function(e){e.value=e},user:C,clear:function(){d.value="",f.value.focus()},placeholderMobilized:H,opener:function(e,t,r){!function(e,t){var r={event:"search_success",search_query:d.value,search_type:e,eventCallback:t};$env.debug.ecommerce&&console.log(r),!$env.debug.ecommerce&&window.dataLayer&&(window.dataLayer.push({ecommerce:null}),window.dataLayer.push(r)),window.dataLayer&&!$env.debug.ecommerce||t&&setTimeout(t,300)}(t,r||function(){e&&(window.location.href=e)})},productsListElement:B}}}),s={class:"dropdown-trigger"},d=["placeholder"],u={class:"icon is-small is-right"},p=[e.createElementVNode("i",{class:"fas fa-search"},null,-1)],m={key:1,class:"dropdown-menu"},h={class:"dropdown-content"},v={class:"history-list"},f={class:"dropdown-item history-list-title"},y=["onClick"],g={class:"dropdown-item history-list-clear"},w={class:"dropdown-menu"},k={class:"dropdown-content",style:{"max-height":"600px",overflow:"auto"},ref:"dropdownContent"},E={key:0,class:"results-list"},C=["href","onClick"],B={key:0,class:"dropdown-divider"},V={key:1,class:"results-list-category"},N={class:"dropdown-item categories-list-title"},_=["href","onClick"],L={key:2,class:"results-list-total"},S={class:"dropdown-item mb-3 mt-2"},D=e.createElementVNode("br",null,null,-1),b=["href"],q={key:3,class:"products-list",ref:"productsListElement"},M={class:"dropdown-item products-list-title"},x={class:"columns"},H={class:"column"},T={class:"title"},$=["href","onClick"],P=["innerHTML"],K={key:0,class:"price_old"},z=["innerHTML"],O={class:"code"},W={key:1,class:"quantity"},F={key:2,class:"no-quantity"},R={key:0,class:"column is-narrow"},U={key:1,class:"column is-eol"},j={key:0,class:"dropdown-content"},A={class:"dropdown-item"},I=["innerHTML"];i.render=function(t,r,o,n,a,l){var c=e.resolveComponent("cart-add");return e.openBlock(),e.createElementBlock("div",{class:"shop-search",onClick:r[10]||(r[10]=function(e){return e.stopPropagation()})},[e.createElementVNode("div",{class:e.normalizeClass(["dropdown",{"is-active":t.isDropdown,"is-dropdown-visible":t.isDropdown&&(t.history.length&&!t.term||t.results.length||t.categories.length||t.term&&!t.isLoading&&!t.results.length&&!t.categories.length)}])},[t.htmlClass?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:"overlay search-overlay",onClick:r[0]||(r[0]=function(e){return t.esc(e)})})),e.createElementVNode("div",s,[e.createElementVNode("div",{class:e.normalizeClass(["control has-icons-right",{"is-loading":t.isLoading}])},[e.withDirectives(e.createElementVNode("input",{class:"input",type:"text","onUpdate:modelValue":r[1]||(r[1]=function(e){return t.term=e}),ref:"input",placeholder:t.placeholderMobilized,onKeyup:[r[2]||(r[2]=e.withKeys((function(){return t.next&&t.next.apply(t,arguments)}),["arrow-down"])),r[3]||(r[3]=e.withKeys((function(){return t.prev&&t.prev.apply(t,arguments)}),["arrow-up"])),r[4]||(r[4]=e.withKeys((function(e){return t.add(e)}),["space"])),r[5]||(r[5]=e.withKeys((function(e){return t.opener(null,"results_page",t.open)}),["enter"])),r[6]||(r[6]=e.withKeys((function(e){return t.esc(e)}),["esc"]))],onClick:r[7]||(r[7]=function(){return t.dropdown&&t.dropdown.apply(t,arguments)}),onKeydown:r[8]||(r[8]=function(e){return t.preventCaret(e)})},null,40,d),[[e.vModelText,t.term]]),e.renderSlot(t.$slots,"clear",{clear:t.clear,term:t.term}),e.renderSlot(t.$slots,"icon",{isLoading:t.isLoading},(function(){return[e.withDirectives(e.createElementVNode("span",u,p,512),[[e.vShow,!t.isLoading]])]}))],2)]),t.isHistory&&t.isDropdown&&t.history.length&&!t.term?(e.openBlock(),e.createElementBlock("div",m,[e.createElementVNode("div",h,[e.createElementVNode("div",v,[e.createElementVNode("div",f,[e.createElementVNode("p",null,e.toDisplayString(t.__("shop.search.history")),1)]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.history,(function(r,o){return e.openBlock(),e.createElementBlock("div",{class:"dropdown-item",key:o},[e.createElementVNode("a",{onClick:function(e){return t.term=r}},e.toDisplayString(r),9,y)])})),128)),e.createElementVNode("div",g,[e.createElementVNode("a",{onClick:r[9]||(r[9]=function(e){return t.clearSearchHistory(e)})},e.toDisplayString(t.__("shop.search.history_clear")),1)])])])])):e.createCommentVNode("v-if",!0),e.withDirectives(e.createElementVNode("div",w,[e.withDirectives(e.createElementVNode("div",k,[e.renderSlot(t.$slots,"results-header"),t.categories.length?(e.openBlock(),e.createElementBlock("div",E,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.categories,(function(r,o){return e.openBlock(),e.createElementBlock("div",{class:"dropdown-item",key:o},[e.createElementVNode("div",null,[e.createElementVNode("a",{href:r.href,onClick:e.withModifiers((function(e){return t.opener(r.href,"category")}),["prevent"])},e.toDisplayString(r.name),9,C)])])})),128)),t.byCategory.length?(e.openBlock(),e.createElementBlock("hr",B)):e.createCommentVNode("v-if",!0)])):e.createCommentVNode("v-if",!0),t.byCategory.length?(e.openBlock(),e.createElementBlock("div",V,[e.createElementVNode("div",N,e.toDisplayString(t.__("shop.search.categories")),1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.byCategory,(function(r,o){return e.openBlock(),e.createElementBlock("div",{class:"dropdown-item",key:o},[e.renderSlot(t.$slots,"item-category",{item:r,searchHrefWithParameter:t.searchHrefWithParameter,opener:t.opener},(function(){return[e.createElementVNode("div",null,[e.createElementVNode("a",{href:r.href+t.searchHrefWithParameter,onClick:e.withModifiers((function(e){return t.opener(r.href+t.searchHrefWithParameter,"category")}),["prevent"])},e.toDisplayString(r.name),9,_)]),e.createElementVNode("div",null,e.toDisplayString(t.__("shop.search.category_found",{count:r.count})),1)]}))])})),128))])):e.createCommentVNode("v-if",!0),t.total?(e.openBlock(),e.createElementBlock("div",L,[e.createElementVNode("p",S,[e.createTextVNode(e.toDisplayString(t.__("shop.search.total_found",{total:t.total}))+" ",1),D,e.createElementVNode("a",{href:t.searchUrl},e.toDisplayString(t.__("shop.search.open_results")),9,b)])])):e.createCommentVNode("v-if",!0),t.results.length?(e.openBlock(),e.createElementBlock("div",q,[e.createElementVNode("div",M,e.toDisplayString(t.__("shop.search.products")),1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.results,(function(r,o){return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["dropdown-item",{"is-active":t.current==o}]),key:r.id},[e.renderSlot(t.$slots,"item",{user:t.user,item:r,cartRefs:t.cartRefs,opener:t.opener},(function(){return[e.createElementVNode("div",x,[e.createElementVNode("div",H,[e.createElementVNode("div",T,[e.createElementVNode("a",{href:r.href,onClick:e.withModifiers((function(e){return t.opener(r.href,"product")}),["prevent"])},e.toDisplayString(r.name),9,$)]),e.createElementVNode("div",{class:"price",innerHTML:r.price},null,8,P),r.price_old?(e.openBlock(),e.createElementBlock("div",K,[e.createElementVNode("span",{innerHTML:r.price_old},null,8,z)])):e.createCommentVNode("v-if",!0),e.createElementVNode("div",O,e.toDisplayString(r.code),1),r.quantity?(e.openBlock(),e.createElementBlock("div",W,e.toDisplayString(t.__("shop.search.in_stock")),1)):(e.openBlock(),e.createElementBlock("span",F,e.toDisplayString(t.__("shop.search.out_stock")),1))]),r.is_eol?(e.openBlock(),e.createElementBlock("div",U,e.toDisplayString(t.__("shop.search.eol")),1)):(e.openBlock(),e.createElementBlock("div",R,[e.createVNode(c,{id:r.id,"is-change-quantity":!1,"is-already-in-cart":!1,ref_for:!0,ref:t.cartRefs},null,8,["id"])]))])]}))],2)})),128))],512)):e.createCommentVNode("v-if",!0)],512),[[e.vShow,t.results.length||t.categories.length]]),t.isLoading||t.results.length||t.categories.length?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("div",j,[e.createElementVNode("div",A,[e.createElementVNode("div",{class:"no-results",innerHTML:t.__("shop.search.no_results")},null,8,I)])]))],512),[[e.vShow,t.results.length||t.term]])],2)])},module.exports=i;
2
2
  //# sourceMappingURL=Search.js.map