New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@vue-storefront/core

Package Overview
Dependencies
Maintainers
4
Versions
199
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vue-storefront/core - npm Package Compare versions

Comparing version 2.0.1-prealpha.344 to 2.0.1-prealpha.351

2

lib/index.cjs.js

@@ -15,2 +15,2 @@ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@vue/composition-api"),t=function(){return(t=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var u in t=arguments[r])Object.prototype.hasOwnProperty.call(t,u)&&(e[u]=t[u]);return e}).apply(this,arguments)};

and limitations under the License.
***************************************************************************** */function r(e,t,r,n){return new(r||(r=Promise))((function(u,a){function o(e){try{i(n.next(e))}catch(e){a(e)}}function c(e){try{i(n.throw(e))}catch(e){a(e)}}function i(e){e.done?u(e.value):new r((function(t){t(e.value)})).then(o,c)}i((n=n.apply(e,t||[])).next())}))}function n(e,t){var r,n,u,a,o={label:0,sent:function(){if(1&u[0])throw u[1];return u[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(a){return function(c){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,n&&(u=2&a[0]?n.return:a[0]?n.throw||((u=n.return)&&u.call(n),0):n.next)&&!(u=u.call(n,a[1])).done)return u;switch(n=0,u&&(a=[2&a[0],u.value]),a[0]){case 0:case 1:u=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,n=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(u=o.trys,(u=u.length>0&&u[u.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!u||a[1]>u[0]&&a[1]<u[3])){o.label=a[1];break}if(6===a[0]&&o.label<u[1]){o.label=u[1],u=a;break}if(u&&o.label<u[2]){o.label=u[2],o.ops.push(a);break}u[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],n=0}finally{r=u=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}var u=[],a=[],o=function(e){return e.$isServer?e.$ssrContext.nuxt.vsfState:window.__VSF_STATE__||{}},c=0,i=function(t){var o,i=e.getCurrentInstance(),s=i.$isServer;s&&!i.$ssrContext.nuxt.vsfState&&(i.$ssrContext.nuxt.vsfState={}),e.onServerPrefetch((function(){return r(void 0,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return[4,t()];case 1:return e.sent(),r="set-ssr-cache",n=function(e){var t=e.key,r=e.value;i.$ssrContext.nuxt.vsfState[t]=r},u.push({eventName:r,handler:n}),a.filter((function(e){return e.eventName===r})).forEach((function(e){n(e.value)})),a=a.filter((function(e){return e.eventName!==r})),[2]}var r,n}))}))})),!s&&(o=window.__VSF_STATE__?JSON.stringify(window.__VSF_STATE__).length:0,c===o||(c=o,0))&&t()};exports.useSSR=function(t){var r=e.getCurrentInstance();r.$isServer&&!r.$ssrContext.nuxt.vsfState&&(r.$ssrContext.nuxt.vsfState={});return{saveToInitialState:function(e){!function(e,t){var r=u.filter((function(t){return t.eventName===e}));r.forEach((function(e){e.handler(t)})),0===r.length&&a.push({eventName:e,value:t})}("set-ssr-cache",{key:t,value:e})},initialState:o(r)[t]}};var s;(s=exports.AgnosticOrderStatus||(exports.AgnosticOrderStatus={})).Open="Open",s.Pending="Pending",s.Confirmed="Confirmed",s.Shipped="Shipped",s.Complete="Complete",s.Cancelled="Cancelled",s.Refunded="Refunded",exports.apiClientFactory=function(e){var r=t(t({},e.defaultSettings),{overrides:{}});return{override:function(e){r.overrides=t(t({},r.overrides),e)},setup:function(n){r=t(t(t({},e.defaultSettings),{overrides:r.overrides}),n),e.onSetup(r)},update:function(n){r=t(t({},r),n),e.onSetup(r)},getSettings:function(){return Object.freeze(r)}}},exports.configureSSR=function(e){exports.useSSR=e.useSSR},exports.onSSR=i,exports.useCartFactory=function(t){var u=e.ref(null),a=e.ref(!1);return function(){var o=this,c=exports.useSSR("vsf-cart"),s=c.initialState,l=c.saveToInitialState;t.cart.value=s||null;var v=function(){return r(o,void 0,void 0,(function(){var e;return n(this,(function(r){switch(r.label){case 0:return a.value=!0,e=t.cart,[4,t.loadCart()];case 1:return e.value=r.sent(),l(t.cart.value),a.value=!1,[2]}}))}))};return i((function(){return r(o,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return t.cart.value?[3,2]:[4,v()];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))})),{cart:e.computed((function(){return t.cart.value})),isOnCart:function(e){return t.isOnCart({currentCart:t.cart.value,product:e})},addToCart:function(e,u){return r(o,void 0,void 0,(function(){var r;return n(this,(function(n){switch(n.label){case 0:return a.value=!0,[4,t.addToCart({currentCart:t.cart.value,product:e,quantity:u})];case 1:return r=n.sent(),t.cart.value=r,a.value=!1,[2]}}))}))},refreshCart:v,removeFromCart:function(e){return r(o,void 0,void 0,(function(){var r;return n(this,(function(n){switch(n.label){case 0:return a.value=!0,[4,t.removeFromCart({currentCart:t.cart.value,product:e})];case 1:return r=n.sent(),t.cart.value=r,a.value=!1,[2]}}))}))},clearCart:function(){return r(o,void 0,void 0,(function(){var e;return n(this,(function(r){switch(r.label){case 0:return a.value=!0,[4,t.clearCart({currentCart:t.cart.value})];case 1:return e=r.sent(),t.cart.value=e,a.value=!1,[2]}}))}))},updateQuantity:function(e,u){return r(o,void 0,void 0,(function(){var r;return n(this,(function(n){switch(n.label){case 0:return u&&u>0?(a.value=!0,[4,t.updateQuantity({currentCart:t.cart.value,product:e,quantity:u})]):[3,2];case 1:r=n.sent(),t.cart.value=r,a.value=!1,n.label=2;case 2:return[2]}}))}))},coupon:e.computed((function(){return u.value})),applyCoupon:function(e){return r(o,void 0,void 0,(function(){var r,o,c;return n(this,(function(n){switch(n.label){case 0:return n.trys.push([0,,2,3]),a.value=!0,[4,t.applyCoupon({currentCart:t.cart.value,coupon:e})];case 1:return r=n.sent(),o=r.updatedCart,c=r.updatedCoupon,t.cart.value=o,u.value=c,[3,3];case 2:return a.value=!1,[7];case 3:return[2]}}))}))},removeCoupon:function(){return r(o,void 0,void 0,(function(){var e,r,o;return n(this,(function(n){switch(n.label){case 0:return n.trys.push([0,,2,3]),a.value=!0,[4,t.removeCoupon({currentCart:t.cart.value})];case 1:return e=n.sent(),r=e.updatedCart,o=e.updatedCoupon,t.cart.value=r,u.value=o,a.value=!1,[3,3];case 2:return a.value=!1,[7];case 3:return[2]}}))}))},loading:e.computed((function(){return a.value}))}}},exports.useCategoryFactory=function(t){return function(u){var a=this,o=exports.useSSR(u),c=o.initialState,i=o.saveToInitialState,s=e.ref(c||[]),l=e.ref(!1);return{search:function(e){return r(a,void 0,void 0,(function(){var r;return n(this,(function(n){switch(n.label){case 0:return c||(l.value=!0),r=s,[4,t.categorySearch(e)];case 1:return r.value=n.sent(),i(s.value),l.value=!1,[2]}}))}))},loading:e.computed((function(){return l.value})),categories:e.computed((function(){return s.value}))}}},exports.useLocaleFactory=function(t){var u=this,a=e.ref(!1),o=e.ref(null),c=e.ref(null),i=e.ref(null),s=e.ref([]),l=e.ref([]),v=e.ref([]),f=function(e){return r(u,void 0,void 0,(function(){var r;return n(this,(function(n){switch(n.label){case 0:return a.value=!0,r=o,[4,t.setLocale(e)];case 1:return r.value=n.sent(),a.value=!1,[2]}}))}))},d=function(e){return r(u,void 0,void 0,(function(){var r;return n(this,(function(n){switch(n.label){case 0:return a.value=!0,r=c,[4,t.setCountry(e)];case 1:return r.value=n.sent(),a.value=!1,[2]}}))}))},p=function(e){return r(u,void 0,void 0,(function(){var r;return n(this,(function(n){switch(n.label){case 0:return a.value=!0,r=i,[4,t.setCurrency(e)];case 1:return r.value=n.sent(),a.value=!1,[2]}}))}))},h=function(){return r(u,void 0,void 0,(function(){var e;return n(this,(function(r){switch(r.label){case 0:return e=s,[4,t.loadAvailableLocales()];case 1:return e.value=r.sent(),[2]}}))}))},b=function(){return r(u,void 0,void 0,(function(){var e;return n(this,(function(r){switch(r.label){case 0:return e=l,[4,t.loadAvailableCountries()];case 1:return e.value=r.sent(),[2]}}))}))},S=function(){return r(u,void 0,void 0,(function(){var e;return n(this,(function(r){switch(r.label){case 0:return e=v,[4,t.loadAvailableCurrencies()];case 1:return e.value=r.sent(),[2]}}))}))};return function(){return{loadAvailableLocales:h,loadAvailableCountries:b,loadAvailableCurrencies:S,setCountry:d,setCurrency:p,setLocale:f,loading:e.computed((function(){return a.value})),locale:e.computed((function(){return o.value})),country:e.computed((function(){return c.value})),currency:e.computed((function(){return i.value})),availableLocales:e.computed((function(){return s.value})),availableCountries:e.computed((function(){return l.value})),availableCurrencies:e.computed((function(){return v.value}))}}},exports.useProductFactory=function(t){return function(u){var a=this,o=exports.useSSR(u),c=o.initialState,i=o.saveToInitialState,s=e.ref((null==c?void 0:c.data)||[]),l=e.ref((null==c?void 0:c.total)||0),v=e.ref(!1);return{products:e.computed((function(){return s.value})),totalProducts:e.computed((function(){return l.value})),search:function(e){return r(a,void 0,void 0,(function(){var r,u,a;return n(this,(function(n){switch(n.label){case 0:return c||(v.value=!0),[4,t.productsSearch(e)];case 1:return r=n.sent(),u=r.data,a=r.total,s.value=u,l.value=a,i({data:u,total:a}),v.value=!1,[2]}}))}))},loading:e.computed((function(){return v.value}))}}},exports.useUserFactory=function(t){var u=e.ref(null),a=e.ref(!1),o=e.computed((function(){return u.value&&Object.keys(u.value).length>0}));return function(){var c=this,s=exports.useSSR("vsf-user"),l=s.initialState,v=s.saveToInitialState;u.value=l||null;var f=function(){return r(c,void 0,void 0,(function(){var e,r;return n(this,(function(n){switch(n.label){case 0:a.value=!0,n.label=1;case 1:return n.trys.push([1,3,4,5]),e=u,[4,t.loadUser()];case 2:return e.value=n.sent(),v(u.value),[3,5];case 3:throw r=n.sent(),new Error(r);case 4:return a.value=!1,[7];case 5:return[2]}}))}))};return i((function(){return r(c,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return u.value?[3,2]:[4,f()];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))})),{user:e.computed((function(){return u.value})),updateUser:function(e){return r(c,void 0,void 0,(function(){var r,o;return n(this,(function(n){switch(n.label){case 0:a.value=!0,n.label=1;case 1:return n.trys.push([1,3,4,5]),r=u,[4,t.updateUser({currentUser:u.value,updatedUserData:e})];case 2:return r.value=n.sent(),[3,5];case 3:throw o=n.sent(),new Error(o);case 4:return a.value=!1,[7];case 5:return[2]}}))}))},register:function(e){return r(c,void 0,void 0,(function(){var r,o;return n(this,(function(n){switch(n.label){case 0:a.value=!0,n.label=1;case 1:return n.trys.push([1,3,4,5]),r=u,[4,t.register(e)];case 2:return r.value=n.sent(),[3,5];case 3:throw o=n.sent(),new Error(o);case 4:return a.value=!1,[7];case 5:return[2]}}))}))},login:function(e){return r(c,void 0,void 0,(function(){var r,o;return n(this,(function(n){switch(n.label){case 0:a.value=!0,n.label=1;case 1:return n.trys.push([1,3,4,5]),r=u,[4,t.logIn(e)];case 2:return r.value=n.sent(),[3,5];case 3:throw o=n.sent(),new Error(o);case 4:return a.value=!1,[7];case 5:return[2]}}))}))},logout:function(){return r(c,void 0,void 0,(function(){var e;return n(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,t.logOut()];case 1:return r.sent(),u.value={},[3,3];case 2:throw e=r.sent(),new Error(e);case 3:return[2]}}))}))},isAuthenticated:o,changePassword:function(e,o){return r(c,void 0,void 0,(function(){var r,c;return n(this,(function(n){switch(n.label){case 0:a.value=!0,n.label=1;case 1:return n.trys.push([1,3,4,5]),r=u,[4,t.changePassword({currentUser:u.value,currentPassword:e,newPassword:o})];case 2:return r.value=n.sent(),[3,5];case 3:throw c=n.sent(),new Error(c);case 4:return a.value=!1,[7];case 5:return[2]}}))}))},refreshUser:f,loading:e.computed((function(){return a.value}))}}},exports.useUserOrdersFactory=function(t){return function(){var u=this,a=exports.useSSR("vsf-user-orders"),o=a.initialState,c=a.saveToInitialState,i=e.ref((null==o?void 0:o.data)||[]),s=e.ref((null==o?void 0:o.total)||0),l=e.ref(!1);return{orders:e.computed((function(){return i.value})),totalOrders:e.computed((function(){return s.value})),searchOrders:function(e){return r(u,void 0,void 0,(function(){var r,u,a;return n(this,(function(n){switch(n.label){case 0:l.value=!0,n.label=1;case 1:return n.trys.push([1,,3,4]),[4,t.searchOrders(e)];case 2:return r=n.sent(),u=r.data,a=r.total,i.value=u,s.value=a,c({data:u,total:a}),[3,4];case 3:return l.value=!1,[7];case 4:return[2]}}))}))},loading:e.computed((function(){return l.value}))}}},exports.wrap=function(t){return e.isRef(t)?t:e.ref(t)};
***************************************************************************** */function r(e,t,r,n){return new(r||(r=Promise))((function(u,a){function o(e){try{i(n.next(e))}catch(e){a(e)}}function c(e){try{i(n.throw(e))}catch(e){a(e)}}function i(e){e.done?u(e.value):new r((function(t){t(e.value)})).then(o,c)}i((n=n.apply(e,t||[])).next())}))}function n(e,t){var r,n,u,a,o={label:0,sent:function(){if(1&u[0])throw u[1];return u[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(a){return function(c){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,n&&(u=2&a[0]?n.return:a[0]?n.throw||((u=n.return)&&u.call(n),0):n.next)&&!(u=u.call(n,a[1])).done)return u;switch(n=0,u&&(a=[2&a[0],u.value]),a[0]){case 0:case 1:u=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,n=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(u=o.trys,(u=u.length>0&&u[u.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!u||a[1]>u[0]&&a[1]<u[3])){o.label=a[1];break}if(6===a[0]&&o.label<u[1]){o.label=u[1],u=a;break}if(u&&o.label<u[2]){o.label=u[2],o.ops.push(a);break}u[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],n=0}finally{r=u=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}var u=[],a=[],o=function(e){return e.$isServer?e.$ssrContext.nuxt.vsfState:window.__VSF_STATE__||{}},c=0,i=function(t){var o,i=e.getCurrentInstance(),s=i.$isServer;s&&!i.$ssrContext.nuxt.vsfState&&(i.$ssrContext.nuxt.vsfState={}),e.onServerPrefetch((function(){return r(void 0,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return[4,t()];case 1:return e.sent(),r="set-ssr-cache",n=function(e){var t=e.key,r=e.value;i.$ssrContext.nuxt.vsfState[t]=r},u.push({eventName:r,handler:n}),a.filter((function(e){return e.eventName===r})).forEach((function(e){n(e.value)})),a=a.filter((function(e){return e.eventName!==r})),[2]}var r,n}))}))})),!s&&(o=window.__VSF_STATE__?JSON.stringify(window.__VSF_STATE__).length:0,c===o||(c=o,0))&&t()};exports.useSSR=function(t){var r=e.getCurrentInstance();r.$isServer&&!r.$ssrContext.nuxt.vsfState&&(r.$ssrContext.nuxt.vsfState={});return{saveToInitialState:function(e){!function(e,t){var r=u.filter((function(t){return t.eventName===e}));r.forEach((function(e){e.handler(t)})),0===r.length&&a.push({eventName:e,value:t})}("set-ssr-cache",{key:t,value:e})},initialState:o(r)[t]}};var s;(s=exports.AgnosticOrderStatus||(exports.AgnosticOrderStatus={})).Open="Open",s.Pending="Pending",s.Confirmed="Confirmed",s.Shipped="Shipped",s.Complete="Complete",s.Cancelled="Cancelled",s.Refunded="Refunded",exports.apiClientFactory=function(e){var r=t(t({},e.defaultSettings),{overrides:{}});return{override:function(e){r.overrides=t(t({},r.overrides),e)},setup:function(n){r=t(t(t({},e.defaultSettings),{overrides:r.overrides}),n),e.onSetup(r)},update:function(n){r=t(t({},r),n),e.onSetup(r)},getSettings:function(){return Object.freeze(r)}}},exports.configureSSR=function(e){exports.useSSR=e.useSSR},exports.onSSR=i,exports.useCartFactory=function(t){var u=e.ref(null),a=e.ref(!1);return function(){var o=this,c=exports.useSSR("vsf-cart"),s=c.initialState,l=c.saveToInitialState;t.cart.value=t.cart.value||s||null;var v=function(){return r(o,void 0,void 0,(function(){var e;return n(this,(function(r){switch(r.label){case 0:return a.value=!0,e=t.cart,[4,t.loadCart()];case 1:return e.value=r.sent(),l(t.cart.value),a.value=!1,[2]}}))}))};return i((function(){return r(o,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return t.cart.value?[3,2]:[4,v()];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))})),{cart:e.computed((function(){return t.cart.value})),isOnCart:function(e){return t.isOnCart({currentCart:t.cart.value,product:e})},addToCart:function(e,u){return r(o,void 0,void 0,(function(){var r;return n(this,(function(n){switch(n.label){case 0:return a.value=!0,[4,t.addToCart({currentCart:t.cart.value,product:e,quantity:u})];case 1:return r=n.sent(),t.cart.value=r,a.value=!1,[2]}}))}))},refreshCart:v,removeFromCart:function(e){return r(o,void 0,void 0,(function(){var r;return n(this,(function(n){switch(n.label){case 0:return a.value=!0,[4,t.removeFromCart({currentCart:t.cart.value,product:e})];case 1:return r=n.sent(),t.cart.value=r,a.value=!1,[2]}}))}))},clearCart:function(){return r(o,void 0,void 0,(function(){var e;return n(this,(function(r){switch(r.label){case 0:return a.value=!0,[4,t.clearCart({currentCart:t.cart.value})];case 1:return e=r.sent(),t.cart.value=e,a.value=!1,[2]}}))}))},updateQuantity:function(e,u){return r(o,void 0,void 0,(function(){var r;return n(this,(function(n){switch(n.label){case 0:return u&&u>0?(a.value=!0,[4,t.updateQuantity({currentCart:t.cart.value,product:e,quantity:u})]):[3,2];case 1:r=n.sent(),t.cart.value=r,a.value=!1,n.label=2;case 2:return[2]}}))}))},coupon:e.computed((function(){return u.value})),applyCoupon:function(e){return r(o,void 0,void 0,(function(){var r,o,c;return n(this,(function(n){switch(n.label){case 0:return n.trys.push([0,,2,3]),a.value=!0,[4,t.applyCoupon({currentCart:t.cart.value,coupon:e})];case 1:return r=n.sent(),o=r.updatedCart,c=r.updatedCoupon,t.cart.value=o,u.value=c,[3,3];case 2:return a.value=!1,[7];case 3:return[2]}}))}))},removeCoupon:function(){return r(o,void 0,void 0,(function(){var e,r,o;return n(this,(function(n){switch(n.label){case 0:return n.trys.push([0,,2,3]),a.value=!0,[4,t.removeCoupon({currentCart:t.cart.value})];case 1:return e=n.sent(),r=e.updatedCart,o=e.updatedCoupon,t.cart.value=r,u.value=o,a.value=!1,[3,3];case 2:return a.value=!1,[7];case 3:return[2]}}))}))},loading:e.computed((function(){return a.value}))}}},exports.useCategoryFactory=function(t){return function(u){var a=this,o=exports.useSSR(u),c=o.initialState,i=o.saveToInitialState,s=e.ref(c||[]),l=e.ref(!1);return{search:function(e){return r(a,void 0,void 0,(function(){var r;return n(this,(function(n){switch(n.label){case 0:return c||(l.value=!0),r=s,[4,t.categorySearch(e)];case 1:return r.value=n.sent(),i(s.value),l.value=!1,[2]}}))}))},loading:e.computed((function(){return l.value})),categories:e.computed((function(){return s.value}))}}},exports.useLocaleFactory=function(t){var u=this,a=e.ref(!1),o=e.ref(null),c=e.ref(null),i=e.ref(null),s=e.ref([]),l=e.ref([]),v=e.ref([]),f=function(e){return r(u,void 0,void 0,(function(){var r;return n(this,(function(n){switch(n.label){case 0:return a.value=!0,r=o,[4,t.setLocale(e)];case 1:return r.value=n.sent(),a.value=!1,[2]}}))}))},d=function(e){return r(u,void 0,void 0,(function(){var r;return n(this,(function(n){switch(n.label){case 0:return a.value=!0,r=c,[4,t.setCountry(e)];case 1:return r.value=n.sent(),a.value=!1,[2]}}))}))},p=function(e){return r(u,void 0,void 0,(function(){var r;return n(this,(function(n){switch(n.label){case 0:return a.value=!0,r=i,[4,t.setCurrency(e)];case 1:return r.value=n.sent(),a.value=!1,[2]}}))}))},h=function(){return r(u,void 0,void 0,(function(){var e;return n(this,(function(r){switch(r.label){case 0:return e=s,[4,t.loadAvailableLocales()];case 1:return e.value=r.sent(),[2]}}))}))},b=function(){return r(u,void 0,void 0,(function(){var e;return n(this,(function(r){switch(r.label){case 0:return e=l,[4,t.loadAvailableCountries()];case 1:return e.value=r.sent(),[2]}}))}))},S=function(){return r(u,void 0,void 0,(function(){var e;return n(this,(function(r){switch(r.label){case 0:return e=v,[4,t.loadAvailableCurrencies()];case 1:return e.value=r.sent(),[2]}}))}))};return function(){return{loadAvailableLocales:h,loadAvailableCountries:b,loadAvailableCurrencies:S,setCountry:d,setCurrency:p,setLocale:f,loading:e.computed((function(){return a.value})),locale:e.computed((function(){return o.value})),country:e.computed((function(){return c.value})),currency:e.computed((function(){return i.value})),availableLocales:e.computed((function(){return s.value})),availableCountries:e.computed((function(){return l.value})),availableCurrencies:e.computed((function(){return v.value}))}}},exports.useProductFactory=function(t){return function(u){var a=this,o=exports.useSSR(u),c=o.initialState,i=o.saveToInitialState,s=e.ref((null==c?void 0:c.data)||[]),l=e.ref((null==c?void 0:c.total)||0),v=e.ref(!1);return{products:e.computed((function(){return s.value})),totalProducts:e.computed((function(){return l.value})),search:function(e){return r(a,void 0,void 0,(function(){var r,u,a;return n(this,(function(n){switch(n.label){case 0:return c||(v.value=!0),[4,t.productsSearch(e)];case 1:return r=n.sent(),u=r.data,a=r.total,s.value=u,l.value=a,i({data:u,total:a}),v.value=!1,[2]}}))}))},loading:e.computed((function(){return v.value}))}}},exports.useUserFactory=function(t){var u=e.ref(null),a=e.ref(!1),o=e.computed((function(){return u.value&&Object.keys(u.value).length>0}));return function(){var c=this,s=exports.useSSR("vsf-user"),l=s.initialState,v=s.saveToInitialState;u.value=l||null;var f=function(){return r(c,void 0,void 0,(function(){var e,r;return n(this,(function(n){switch(n.label){case 0:a.value=!0,n.label=1;case 1:return n.trys.push([1,3,4,5]),e=u,[4,t.loadUser()];case 2:return e.value=n.sent(),v(u.value),[3,5];case 3:throw r=n.sent(),new Error(r);case 4:return a.value=!1,[7];case 5:return[2]}}))}))};return i((function(){return r(c,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return u.value?[3,2]:[4,f()];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))})),{user:e.computed((function(){return u.value})),updateUser:function(e){return r(c,void 0,void 0,(function(){var r,o;return n(this,(function(n){switch(n.label){case 0:a.value=!0,n.label=1;case 1:return n.trys.push([1,3,4,5]),r=u,[4,t.updateUser({currentUser:u.value,updatedUserData:e})];case 2:return r.value=n.sent(),[3,5];case 3:throw o=n.sent(),new Error(o);case 4:return a.value=!1,[7];case 5:return[2]}}))}))},register:function(e){return r(c,void 0,void 0,(function(){var r,o;return n(this,(function(n){switch(n.label){case 0:a.value=!0,n.label=1;case 1:return n.trys.push([1,3,4,5]),r=u,[4,t.register(e)];case 2:return r.value=n.sent(),[3,5];case 3:throw o=n.sent(),new Error(o);case 4:return a.value=!1,[7];case 5:return[2]}}))}))},login:function(e){return r(c,void 0,void 0,(function(){var r,o;return n(this,(function(n){switch(n.label){case 0:a.value=!0,n.label=1;case 1:return n.trys.push([1,3,4,5]),r=u,[4,t.logIn(e)];case 2:return r.value=n.sent(),[3,5];case 3:throw o=n.sent(),new Error(o);case 4:return a.value=!1,[7];case 5:return[2]}}))}))},logout:function(){return r(c,void 0,void 0,(function(){var e;return n(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,t.logOut()];case 1:return r.sent(),u.value={},[3,3];case 2:throw e=r.sent(),new Error(e);case 3:return[2]}}))}))},isAuthenticated:o,changePassword:function(e,o){return r(c,void 0,void 0,(function(){var r,c;return n(this,(function(n){switch(n.label){case 0:a.value=!0,n.label=1;case 1:return n.trys.push([1,3,4,5]),r=u,[4,t.changePassword({currentUser:u.value,currentPassword:e,newPassword:o})];case 2:return r.value=n.sent(),[3,5];case 3:throw c=n.sent(),new Error(c);case 4:return a.value=!1,[7];case 5:return[2]}}))}))},refreshUser:f,loading:e.computed((function(){return a.value}))}}},exports.useUserOrdersFactory=function(t){return function(){var u=this,a=exports.useSSR("vsf-user-orders"),o=a.initialState,c=a.saveToInitialState,i=e.ref((null==o?void 0:o.data)||[]),s=e.ref((null==o?void 0:o.total)||0),l=e.ref(!1);return{orders:e.computed((function(){return i.value})),totalOrders:e.computed((function(){return s.value})),searchOrders:function(e){return r(u,void 0,void 0,(function(){var r,u,a;return n(this,(function(n){switch(n.label){case 0:l.value=!0,n.label=1;case 1:return n.trys.push([1,,3,4]),[4,t.searchOrders(e)];case 2:return r=n.sent(),u=r.data,a=r.total,i.value=u,s.value=a,c({data:u,total:a}),[3,4];case 3:return l.value=!1,[7];case 4:return[2]}}))}))},loading:e.computed((function(){return l.value}))}}},exports.wrap=function(t){return e.isRef(t)?t:e.ref(t)};

@@ -15,2 +15,2 @@ import{getCurrentInstance as e,onServerPrefetch as t,isRef as n,ref as r,computed as u}from"@vue/composition-api";

and limitations under the License.
***************************************************************************** */var a=function(){return(a=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var u in t=arguments[n])Object.prototype.hasOwnProperty.call(t,u)&&(e[u]=t[u]);return e}).apply(this,arguments)};function i(e,t,n,r){return new(n||(n=Promise))((function(u,a){function i(e){try{c(r.next(e))}catch(e){a(e)}}function o(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?u(e.value):new n((function(t){t(e.value)})).then(i,o)}c((r=r.apply(e,t||[])).next())}))}function o(e,t){var n,r,u,a,i={label:0,sent:function(){if(1&u[0])throw u[1];return u[1]},trys:[],ops:[]};return a={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function o(a){return function(o){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(u=2&a[0]?r.return:a[0]?r.throw||((u=r.return)&&u.call(r),0):r.next)&&!(u=u.call(r,a[1])).done)return u;switch(r=0,u&&(a=[2&a[0],u.value]),a[0]){case 0:case 1:u=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(u=i.trys,(u=u.length>0&&u[u.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!u||a[1]>u[0]&&a[1]<u[3])){i.label=a[1];break}if(6===a[0]&&i.label<u[1]){i.label=u[1],u=a;break}if(u&&i.label<u[2]){i.label=u[2],i.ops.push(a);break}u[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=u=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,o])}}}var c,l=[],s=[],v=function(e){return e.$isServer?e.$ssrContext.nuxt.vsfState:window.__VSF_STATE__||{}},f=0,d=function(n){var r,u=e(),a=u.$isServer;a&&!u.$ssrContext.nuxt.vsfState&&(u.$ssrContext.nuxt.vsfState={}),t((function(){return i(void 0,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,n()];case 1:return e.sent(),t="set-ssr-cache",r=function(e){var t=e.key,n=e.value;u.$ssrContext.nuxt.vsfState[t]=n},l.push({eventName:t,handler:r}),s.filter((function(e){return e.eventName===t})).forEach((function(e){r(e.value)})),s=s.filter((function(e){return e.eventName!==t})),[2]}var t,r}))}))})),!a&&(r=window.__VSF_STATE__?JSON.stringify(window.__VSF_STATE__).length:0,f===r||(f=r,0))&&n()},h=function(t){var n=e();n.$isServer&&!n.$ssrContext.nuxt.vsfState&&(n.$ssrContext.nuxt.vsfState={});return{saveToInitialState:function(e){!function(e,t){var n=l.filter((function(t){return t.eventName===e}));n.forEach((function(e){e.handler(t)})),0===n.length&&s.push({eventName:e,value:t})}("set-ssr-cache",{key:t,value:e})},initialState:v(n)[t]}},p=function(e){h=e.useSSR};function b(e){return n(e)?e:r(e)}function w(e){var t=r(null),n=r(!1);return function(){var r=this,a=h("vsf-cart"),c=a.initialState,l=a.saveToInitialState;e.cart.value=c||null;var s=function(){return i(r,void 0,void 0,(function(){var t;return o(this,(function(r){switch(r.label){case 0:return n.value=!0,t=e.cart,[4,e.loadCart()];case 1:return t.value=r.sent(),l(e.cart.value),n.value=!1,[2]}}))}))};return d((function(){return i(r,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return e.cart.value?[3,2]:[4,s()];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))})),{cart:u((function(){return e.cart.value})),isOnCart:function(t){return e.isOnCart({currentCart:e.cart.value,product:t})},addToCart:function(t,u){return i(r,void 0,void 0,(function(){var r;return o(this,(function(a){switch(a.label){case 0:return n.value=!0,[4,e.addToCart({currentCart:e.cart.value,product:t,quantity:u})];case 1:return r=a.sent(),e.cart.value=r,n.value=!1,[2]}}))}))},refreshCart:s,removeFromCart:function(t){return i(r,void 0,void 0,(function(){var r;return o(this,(function(u){switch(u.label){case 0:return n.value=!0,[4,e.removeFromCart({currentCart:e.cart.value,product:t})];case 1:return r=u.sent(),e.cart.value=r,n.value=!1,[2]}}))}))},clearCart:function(){return i(r,void 0,void 0,(function(){var t;return o(this,(function(r){switch(r.label){case 0:return n.value=!0,[4,e.clearCart({currentCart:e.cart.value})];case 1:return t=r.sent(),e.cart.value=t,n.value=!1,[2]}}))}))},updateQuantity:function(t,u){return i(r,void 0,void 0,(function(){var r;return o(this,(function(a){switch(a.label){case 0:return u&&u>0?(n.value=!0,[4,e.updateQuantity({currentCart:e.cart.value,product:t,quantity:u})]):[3,2];case 1:r=a.sent(),e.cart.value=r,n.value=!1,a.label=2;case 2:return[2]}}))}))},coupon:u((function(){return t.value})),applyCoupon:function(u){return i(r,void 0,void 0,(function(){var r,a,i;return o(this,(function(o){switch(o.label){case 0:return o.trys.push([0,,2,3]),n.value=!0,[4,e.applyCoupon({currentCart:e.cart.value,coupon:u})];case 1:return r=o.sent(),a=r.updatedCart,i=r.updatedCoupon,e.cart.value=a,t.value=i,[3,3];case 2:return n.value=!1,[7];case 3:return[2]}}))}))},removeCoupon:function(){return i(r,void 0,void 0,(function(){var r,u,a;return o(this,(function(i){switch(i.label){case 0:return i.trys.push([0,,2,3]),n.value=!0,[4,e.removeCoupon({currentCart:e.cart.value})];case 1:return r=i.sent(),u=r.updatedCart,a=r.updatedCoupon,e.cart.value=u,t.value=a,n.value=!1,[3,3];case 2:return n.value=!1,[7];case 3:return[2]}}))}))},loading:u((function(){return n.value}))}}}function C(e){return function(t){var n=this,a=h(t),c=a.initialState,l=a.saveToInitialState,s=r(c||[]),v=r(!1);return{search:function(t){return i(n,void 0,void 0,(function(){var n;return o(this,(function(r){switch(r.label){case 0:return c||(v.value=!0),n=s,[4,e.categorySearch(t)];case 1:return n.value=r.sent(),l(s.value),v.value=!1,[2]}}))}))},loading:u((function(){return v.value})),categories:u((function(){return s.value}))}}}function y(e){var t=this,n=r(!1),a=r(null),c=r(null),l=r(null),s=r([]),v=r([]),f=r([]),d=function(r){return i(t,void 0,void 0,(function(){var t;return o(this,(function(u){switch(u.label){case 0:return n.value=!0,t=a,[4,e.setLocale(r)];case 1:return t.value=u.sent(),n.value=!1,[2]}}))}))},h=function(r){return i(t,void 0,void 0,(function(){var t;return o(this,(function(u){switch(u.label){case 0:return n.value=!0,t=c,[4,e.setCountry(r)];case 1:return t.value=u.sent(),n.value=!1,[2]}}))}))},p=function(r){return i(t,void 0,void 0,(function(){var t;return o(this,(function(u){switch(u.label){case 0:return n.value=!0,t=l,[4,e.setCurrency(r)];case 1:return t.value=u.sent(),n.value=!1,[2]}}))}))},b=function(){return i(t,void 0,void 0,(function(){var t;return o(this,(function(n){switch(n.label){case 0:return t=s,[4,e.loadAvailableLocales()];case 1:return t.value=n.sent(),[2]}}))}))},w=function(){return i(t,void 0,void 0,(function(){var t;return o(this,(function(n){switch(n.label){case 0:return t=v,[4,e.loadAvailableCountries()];case 1:return t.value=n.sent(),[2]}}))}))},C=function(){return i(t,void 0,void 0,(function(){var t;return o(this,(function(n){switch(n.label){case 0:return t=f,[4,e.loadAvailableCurrencies()];case 1:return t.value=n.sent(),[2]}}))}))};return function(){return{loadAvailableLocales:b,loadAvailableCountries:w,loadAvailableCurrencies:C,setCountry:h,setCurrency:p,setLocale:d,loading:u((function(){return n.value})),locale:u((function(){return a.value})),country:u((function(){return c.value})),currency:u((function(){return l.value})),availableLocales:u((function(){return s.value})),availableCountries:u((function(){return v.value})),availableCurrencies:u((function(){return f.value}))}}}function S(e){return function(t){var n=this,a=h(t),c=a.initialState,l=a.saveToInitialState,s=r((null==c?void 0:c.data)||[]),v=r((null==c?void 0:c.total)||0),f=r(!1);return{products:u((function(){return s.value})),totalProducts:u((function(){return v.value})),search:function(t){return i(n,void 0,void 0,(function(){var n,r,u;return o(this,(function(a){switch(a.label){case 0:return c||(f.value=!0),[4,e.productsSearch(t)];case 1:return n=a.sent(),r=n.data,u=n.total,s.value=r,v.value=u,l({data:r,total:u}),f.value=!1,[2]}}))}))},loading:u((function(){return f.value}))}}}function g(e){var t=r(null),n=r(!1),a=u((function(){return t.value&&Object.keys(t.value).length>0}));return function(){var r=this,c=h("vsf-user"),l=c.initialState,s=c.saveToInitialState;t.value=l||null;var v=function(){return i(r,void 0,void 0,(function(){var r,u;return o(this,(function(a){switch(a.label){case 0:n.value=!0,a.label=1;case 1:return a.trys.push([1,3,4,5]),r=t,[4,e.loadUser()];case 2:return r.value=a.sent(),s(t.value),[3,5];case 3:throw u=a.sent(),new Error(u);case 4:return n.value=!1,[7];case 5:return[2]}}))}))};return d((function(){return i(r,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return t.value?[3,2]:[4,v()];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))})),{user:u((function(){return t.value})),updateUser:function(u){return i(r,void 0,void 0,(function(){var r,a;return o(this,(function(i){switch(i.label){case 0:n.value=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),r=t,[4,e.updateUser({currentUser:t.value,updatedUserData:u})];case 2:return r.value=i.sent(),[3,5];case 3:throw a=i.sent(),new Error(a);case 4:return n.value=!1,[7];case 5:return[2]}}))}))},register:function(u){return i(r,void 0,void 0,(function(){var r,a;return o(this,(function(i){switch(i.label){case 0:n.value=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),r=t,[4,e.register(u)];case 2:return r.value=i.sent(),[3,5];case 3:throw a=i.sent(),new Error(a);case 4:return n.value=!1,[7];case 5:return[2]}}))}))},login:function(u){return i(r,void 0,void 0,(function(){var r,a;return o(this,(function(i){switch(i.label){case 0:n.value=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),r=t,[4,e.logIn(u)];case 2:return r.value=i.sent(),[3,5];case 3:throw a=i.sent(),new Error(a);case 4:return n.value=!1,[7];case 5:return[2]}}))}))},logout:function(){return i(r,void 0,void 0,(function(){var n;return o(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,e.logOut()];case 1:return r.sent(),t.value={},[3,3];case 2:throw n=r.sent(),new Error(n);case 3:return[2]}}))}))},isAuthenticated:a,changePassword:function(u,a){return i(r,void 0,void 0,(function(){var r,i;return o(this,(function(o){switch(o.label){case 0:n.value=!0,o.label=1;case 1:return o.trys.push([1,3,4,5]),r=t,[4,e.changePassword({currentUser:t.value,currentPassword:u,newPassword:a})];case 2:return r.value=o.sent(),[3,5];case 3:throw i=o.sent(),new Error(i);case 4:return n.value=!1,[7];case 5:return[2]}}))}))},refreshUser:v,loading:u((function(){return n.value}))}}}function m(e){return function(){var t=this,n=h("vsf-user-orders"),a=n.initialState,c=n.saveToInitialState,l=r((null==a?void 0:a.data)||[]),s=r((null==a?void 0:a.total)||0),v=r(!1);return{orders:u((function(){return l.value})),totalOrders:u((function(){return s.value})),searchOrders:function(n){return i(t,void 0,void 0,(function(){var t,r,u;return o(this,(function(a){switch(a.label){case 0:v.value=!0,a.label=1;case 1:return a.trys.push([1,,3,4]),[4,e.searchOrders(n)];case 2:return t=a.sent(),r=t.data,u=t.total,l.value=r,s.value=u,c({data:r,total:u}),[3,4];case 3:return v.value=!1,[7];case 4:return[2]}}))}))},loading:u((function(){return v.value}))}}}function x(e){var t=a(a({},e.defaultSettings),{overrides:{}});return{override:function(e){t.overrides=a(a({},t.overrides),e)},setup:function(n){t=a(a(a({},e.defaultSettings),{overrides:t.overrides}),n),e.onSetup(t)},update:function(n){t=a(a({},t),n),e.onSetup(t)},getSettings:function(){return Object.freeze(t)}}}!function(e){e.Open="Open",e.Pending="Pending",e.Confirmed="Confirmed",e.Shipped="Shipped",e.Complete="Complete",e.Cancelled="Cancelled",e.Refunded="Refunded"}(c||(c={}));export{c as AgnosticOrderStatus,x as apiClientFactory,p as configureSSR,d as onSSR,w as useCartFactory,C as useCategoryFactory,y as useLocaleFactory,S as useProductFactory,h as useSSR,g as useUserFactory,m as useUserOrdersFactory,b as wrap};
***************************************************************************** */var a=function(){return(a=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var u in t=arguments[n])Object.prototype.hasOwnProperty.call(t,u)&&(e[u]=t[u]);return e}).apply(this,arguments)};function i(e,t,n,r){return new(n||(n=Promise))((function(u,a){function i(e){try{c(r.next(e))}catch(e){a(e)}}function o(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?u(e.value):new n((function(t){t(e.value)})).then(i,o)}c((r=r.apply(e,t||[])).next())}))}function o(e,t){var n,r,u,a,i={label:0,sent:function(){if(1&u[0])throw u[1];return u[1]},trys:[],ops:[]};return a={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function o(a){return function(o){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(u=2&a[0]?r.return:a[0]?r.throw||((u=r.return)&&u.call(r),0):r.next)&&!(u=u.call(r,a[1])).done)return u;switch(r=0,u&&(a=[2&a[0],u.value]),a[0]){case 0:case 1:u=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(u=i.trys,(u=u.length>0&&u[u.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!u||a[1]>u[0]&&a[1]<u[3])){i.label=a[1];break}if(6===a[0]&&i.label<u[1]){i.label=u[1],u=a;break}if(u&&i.label<u[2]){i.label=u[2],i.ops.push(a);break}u[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=u=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,o])}}}var c,l=[],s=[],v=function(e){return e.$isServer?e.$ssrContext.nuxt.vsfState:window.__VSF_STATE__||{}},f=0,d=function(n){var r,u=e(),a=u.$isServer;a&&!u.$ssrContext.nuxt.vsfState&&(u.$ssrContext.nuxt.vsfState={}),t((function(){return i(void 0,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,n()];case 1:return e.sent(),t="set-ssr-cache",r=function(e){var t=e.key,n=e.value;u.$ssrContext.nuxt.vsfState[t]=n},l.push({eventName:t,handler:r}),s.filter((function(e){return e.eventName===t})).forEach((function(e){r(e.value)})),s=s.filter((function(e){return e.eventName!==t})),[2]}var t,r}))}))})),!a&&(r=window.__VSF_STATE__?JSON.stringify(window.__VSF_STATE__).length:0,f===r||(f=r,0))&&n()},h=function(t){var n=e();n.$isServer&&!n.$ssrContext.nuxt.vsfState&&(n.$ssrContext.nuxt.vsfState={});return{saveToInitialState:function(e){!function(e,t){var n=l.filter((function(t){return t.eventName===e}));n.forEach((function(e){e.handler(t)})),0===n.length&&s.push({eventName:e,value:t})}("set-ssr-cache",{key:t,value:e})},initialState:v(n)[t]}},p=function(e){h=e.useSSR};function b(e){return n(e)?e:r(e)}function w(e){var t=r(null),n=r(!1);return function(){var r=this,a=h("vsf-cart"),c=a.initialState,l=a.saveToInitialState;e.cart.value=e.cart.value||c||null;var s=function(){return i(r,void 0,void 0,(function(){var t;return o(this,(function(r){switch(r.label){case 0:return n.value=!0,t=e.cart,[4,e.loadCart()];case 1:return t.value=r.sent(),l(e.cart.value),n.value=!1,[2]}}))}))};return d((function(){return i(r,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return e.cart.value?[3,2]:[4,s()];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))})),{cart:u((function(){return e.cart.value})),isOnCart:function(t){return e.isOnCart({currentCart:e.cart.value,product:t})},addToCart:function(t,u){return i(r,void 0,void 0,(function(){var r;return o(this,(function(a){switch(a.label){case 0:return n.value=!0,[4,e.addToCart({currentCart:e.cart.value,product:t,quantity:u})];case 1:return r=a.sent(),e.cart.value=r,n.value=!1,[2]}}))}))},refreshCart:s,removeFromCart:function(t){return i(r,void 0,void 0,(function(){var r;return o(this,(function(u){switch(u.label){case 0:return n.value=!0,[4,e.removeFromCart({currentCart:e.cart.value,product:t})];case 1:return r=u.sent(),e.cart.value=r,n.value=!1,[2]}}))}))},clearCart:function(){return i(r,void 0,void 0,(function(){var t;return o(this,(function(r){switch(r.label){case 0:return n.value=!0,[4,e.clearCart({currentCart:e.cart.value})];case 1:return t=r.sent(),e.cart.value=t,n.value=!1,[2]}}))}))},updateQuantity:function(t,u){return i(r,void 0,void 0,(function(){var r;return o(this,(function(a){switch(a.label){case 0:return u&&u>0?(n.value=!0,[4,e.updateQuantity({currentCart:e.cart.value,product:t,quantity:u})]):[3,2];case 1:r=a.sent(),e.cart.value=r,n.value=!1,a.label=2;case 2:return[2]}}))}))},coupon:u((function(){return t.value})),applyCoupon:function(u){return i(r,void 0,void 0,(function(){var r,a,i;return o(this,(function(o){switch(o.label){case 0:return o.trys.push([0,,2,3]),n.value=!0,[4,e.applyCoupon({currentCart:e.cart.value,coupon:u})];case 1:return r=o.sent(),a=r.updatedCart,i=r.updatedCoupon,e.cart.value=a,t.value=i,[3,3];case 2:return n.value=!1,[7];case 3:return[2]}}))}))},removeCoupon:function(){return i(r,void 0,void 0,(function(){var r,u,a;return o(this,(function(i){switch(i.label){case 0:return i.trys.push([0,,2,3]),n.value=!0,[4,e.removeCoupon({currentCart:e.cart.value})];case 1:return r=i.sent(),u=r.updatedCart,a=r.updatedCoupon,e.cart.value=u,t.value=a,n.value=!1,[3,3];case 2:return n.value=!1,[7];case 3:return[2]}}))}))},loading:u((function(){return n.value}))}}}function C(e){return function(t){var n=this,a=h(t),c=a.initialState,l=a.saveToInitialState,s=r(c||[]),v=r(!1);return{search:function(t){return i(n,void 0,void 0,(function(){var n;return o(this,(function(r){switch(r.label){case 0:return c||(v.value=!0),n=s,[4,e.categorySearch(t)];case 1:return n.value=r.sent(),l(s.value),v.value=!1,[2]}}))}))},loading:u((function(){return v.value})),categories:u((function(){return s.value}))}}}function y(e){var t=this,n=r(!1),a=r(null),c=r(null),l=r(null),s=r([]),v=r([]),f=r([]),d=function(r){return i(t,void 0,void 0,(function(){var t;return o(this,(function(u){switch(u.label){case 0:return n.value=!0,t=a,[4,e.setLocale(r)];case 1:return t.value=u.sent(),n.value=!1,[2]}}))}))},h=function(r){return i(t,void 0,void 0,(function(){var t;return o(this,(function(u){switch(u.label){case 0:return n.value=!0,t=c,[4,e.setCountry(r)];case 1:return t.value=u.sent(),n.value=!1,[2]}}))}))},p=function(r){return i(t,void 0,void 0,(function(){var t;return o(this,(function(u){switch(u.label){case 0:return n.value=!0,t=l,[4,e.setCurrency(r)];case 1:return t.value=u.sent(),n.value=!1,[2]}}))}))},b=function(){return i(t,void 0,void 0,(function(){var t;return o(this,(function(n){switch(n.label){case 0:return t=s,[4,e.loadAvailableLocales()];case 1:return t.value=n.sent(),[2]}}))}))},w=function(){return i(t,void 0,void 0,(function(){var t;return o(this,(function(n){switch(n.label){case 0:return t=v,[4,e.loadAvailableCountries()];case 1:return t.value=n.sent(),[2]}}))}))},C=function(){return i(t,void 0,void 0,(function(){var t;return o(this,(function(n){switch(n.label){case 0:return t=f,[4,e.loadAvailableCurrencies()];case 1:return t.value=n.sent(),[2]}}))}))};return function(){return{loadAvailableLocales:b,loadAvailableCountries:w,loadAvailableCurrencies:C,setCountry:h,setCurrency:p,setLocale:d,loading:u((function(){return n.value})),locale:u((function(){return a.value})),country:u((function(){return c.value})),currency:u((function(){return l.value})),availableLocales:u((function(){return s.value})),availableCountries:u((function(){return v.value})),availableCurrencies:u((function(){return f.value}))}}}function S(e){return function(t){var n=this,a=h(t),c=a.initialState,l=a.saveToInitialState,s=r((null==c?void 0:c.data)||[]),v=r((null==c?void 0:c.total)||0),f=r(!1);return{products:u((function(){return s.value})),totalProducts:u((function(){return v.value})),search:function(t){return i(n,void 0,void 0,(function(){var n,r,u;return o(this,(function(a){switch(a.label){case 0:return c||(f.value=!0),[4,e.productsSearch(t)];case 1:return n=a.sent(),r=n.data,u=n.total,s.value=r,v.value=u,l({data:r,total:u}),f.value=!1,[2]}}))}))},loading:u((function(){return f.value}))}}}function g(e){var t=r(null),n=r(!1),a=u((function(){return t.value&&Object.keys(t.value).length>0}));return function(){var r=this,c=h("vsf-user"),l=c.initialState,s=c.saveToInitialState;t.value=l||null;var v=function(){return i(r,void 0,void 0,(function(){var r,u;return o(this,(function(a){switch(a.label){case 0:n.value=!0,a.label=1;case 1:return a.trys.push([1,3,4,5]),r=t,[4,e.loadUser()];case 2:return r.value=a.sent(),s(t.value),[3,5];case 3:throw u=a.sent(),new Error(u);case 4:return n.value=!1,[7];case 5:return[2]}}))}))};return d((function(){return i(r,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return t.value?[3,2]:[4,v()];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))})),{user:u((function(){return t.value})),updateUser:function(u){return i(r,void 0,void 0,(function(){var r,a;return o(this,(function(i){switch(i.label){case 0:n.value=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),r=t,[4,e.updateUser({currentUser:t.value,updatedUserData:u})];case 2:return r.value=i.sent(),[3,5];case 3:throw a=i.sent(),new Error(a);case 4:return n.value=!1,[7];case 5:return[2]}}))}))},register:function(u){return i(r,void 0,void 0,(function(){var r,a;return o(this,(function(i){switch(i.label){case 0:n.value=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),r=t,[4,e.register(u)];case 2:return r.value=i.sent(),[3,5];case 3:throw a=i.sent(),new Error(a);case 4:return n.value=!1,[7];case 5:return[2]}}))}))},login:function(u){return i(r,void 0,void 0,(function(){var r,a;return o(this,(function(i){switch(i.label){case 0:n.value=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),r=t,[4,e.logIn(u)];case 2:return r.value=i.sent(),[3,5];case 3:throw a=i.sent(),new Error(a);case 4:return n.value=!1,[7];case 5:return[2]}}))}))},logout:function(){return i(r,void 0,void 0,(function(){var n;return o(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,e.logOut()];case 1:return r.sent(),t.value={},[3,3];case 2:throw n=r.sent(),new Error(n);case 3:return[2]}}))}))},isAuthenticated:a,changePassword:function(u,a){return i(r,void 0,void 0,(function(){var r,i;return o(this,(function(o){switch(o.label){case 0:n.value=!0,o.label=1;case 1:return o.trys.push([1,3,4,5]),r=t,[4,e.changePassword({currentUser:t.value,currentPassword:u,newPassword:a})];case 2:return r.value=o.sent(),[3,5];case 3:throw i=o.sent(),new Error(i);case 4:return n.value=!1,[7];case 5:return[2]}}))}))},refreshUser:v,loading:u((function(){return n.value}))}}}function m(e){return function(){var t=this,n=h("vsf-user-orders"),a=n.initialState,c=n.saveToInitialState,l=r((null==a?void 0:a.data)||[]),s=r((null==a?void 0:a.total)||0),v=r(!1);return{orders:u((function(){return l.value})),totalOrders:u((function(){return s.value})),searchOrders:function(n){return i(t,void 0,void 0,(function(){var t,r,u;return o(this,(function(a){switch(a.label){case 0:v.value=!0,a.label=1;case 1:return a.trys.push([1,,3,4]),[4,e.searchOrders(n)];case 2:return t=a.sent(),r=t.data,u=t.total,l.value=r,s.value=u,c({data:r,total:u}),[3,4];case 3:return v.value=!1,[7];case 4:return[2]}}))}))},loading:u((function(){return v.value}))}}}function x(e){var t=a(a({},e.defaultSettings),{overrides:{}});return{override:function(e){t.overrides=a(a({},t.overrides),e)},setup:function(n){t=a(a(a({},e.defaultSettings),{overrides:t.overrides}),n),e.onSetup(t)},update:function(n){t=a(a({},t),n),e.onSetup(t)},getSettings:function(){return Object.freeze(t)}}}!function(e){e.Open="Open",e.Pending="Pending",e.Confirmed="Confirmed",e.Shipped="Shipped",e.Complete="Complete",e.Cancelled="Cancelled",e.Refunded="Refunded"}(c||(c={}));export{c as AgnosticOrderStatus,x as apiClientFactory,p as configureSSR,d as onSSR,w as useCartFactory,C as useCategoryFactory,y as useLocaleFactory,S as useProductFactory,h as useSSR,g as useUserFactory,m as useUserOrdersFactory,b as wrap};
{
"name": "@vue-storefront/core",
"version": "2.0.1-prealpha.344+f2311619e",
"version": "2.0.1-prealpha.351+3da0e3043",
"sideEffects": false,

@@ -26,3 +26,3 @@ "main": "lib/index.cjs.js",

},
"gitHead": "f2311619e0bbdf39526beb2fb89c755e67f1fa03"
"gitHead": "3da0e30435828ed5048d92352f5c828aced23084"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc