diff --git a/package.json b/package.json index c40c0311..fd7708f3 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "prod": "vite build" }, "devDependencies": { - "@appbaseio/reactivesearch-vue": "https://gitpkg.vercel.app/api/pkg?url=rapidez/reactivesearch/packages/vue&commit=fixes&scripts.postinstall=yarn%20install%20--ignore-scripts%20%26%26%20yarn%20run%20build-es&scripts.build-es=nps%20build.es", + "@appbaseio/reactivesearch-vue": "https://gitpkg.vercel.app/api/pkg?url=rapidez/reactivesearch/packages/vue&commit=v1.34.0-vue&scripts.postinstall=yarn%20install%20--ignore-scripts%20%26%26%20yarn%20run%20build-es&scripts.build-es=nps%20build.es", "@babel/core": "^7.23.9", "@hotwired/turbo": "^8.0.2", "@tailwindcss/forms": "^0.5.3", diff --git a/resources/js/package.js b/resources/js/package.js index 3de8dbea..78676917 100644 --- a/resources/js/package.js +++ b/resources/js/package.js @@ -170,11 +170,11 @@ function init() { }, hasCart() { - return this.cart?.id && this.cart.items.length + return this.cart?.id && this.cart.items?.length }, canOrder() { - return this.cart.items.every((item) => item.is_available) + return this.cart.items?.every((item) => item.is_available) }, }, watch: { diff --git a/resources/js/stores/useCart.js b/resources/js/stores/useCart.js index 612eb024..65740a1d 100644 --- a/resources/js/stores/useCart.js +++ b/resources/js/stores/useCart.js @@ -122,7 +122,7 @@ export const cart = computed({ getAttributeValues() .then((response) => { if (!response?.data?.customAttributeMetadata?.items) { - value.items = value.items.map((item) => { + value.items = value.items?.map((item) => { item.is_available = checkAvailability(item) return item @@ -138,7 +138,7 @@ export const cart = computed({ ]), ) - value.items = value.items.map((cartItem) => { + value.items = value.items?.map((cartItem) => { cartItem.is_available = checkAvailability(cartItem) cartItem.product.attribute_values = {} diff --git a/yarn.lock b/yarn.lock index a1d88827..adcd8b25 100644 --- a/yarn.lock +++ b/yarn.lock @@ -26,9 +26,9 @@ redux-thunk "^2.3.0" xdate "^0.8.2" -"@appbaseio/reactivesearch-vue@https://gitpkg.vercel.app/api/pkg?url=rapidez/reactivesearch/packages/vue&commit=fixes&scripts.postinstall=yarn%20install%20--ignore-scripts%20%26%26%20yarn%20run%20build-es&scripts.build-es=nps%20build.es": +"@appbaseio/reactivesearch-vue@https://gitpkg.vercel.app/api/pkg?url=rapidez/reactivesearch/packages/vue&commit=v1.34.0-vue&scripts.postinstall=yarn%20install%20--ignore-scripts%20%26%26%20yarn%20run%20build-es&scripts.build-es=nps%20build.es": version "2.0.0-alpha.4" - resolved "https://gitpkg.vercel.app/api/pkg?url=rapidez/reactivesearch/packages/vue&commit=fixes&scripts.postinstall=yarn%20install%20--ignore-scripts%20%26%26%20yarn%20run%20build-es&scripts.build-es=nps%20build.es#1ac0368c6aa09acacc48f18809498bad42b7607f" + resolved "https://gitpkg.vercel.app/api/pkg?url=rapidez/reactivesearch/packages/vue&commit=v1.34.0-vue&scripts.postinstall=yarn%20install%20--ignore-scripts%20%26%26%20yarn%20run%20build-es&scripts.build-es=nps%20build.es#aa3e3bf8a01901a56f123e8022c5df7e57798801" dependencies: "@appbaseio/reactivecore" "9.14.25" "@appbaseio/vue-emotion" "0.4.4" @@ -1783,8 +1783,16 @@ source-map@^0.7.2, source-map@^0.7.4: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.4.tgz#a9bbe705c9d8846f4e08ff6765acf0f1b0898656" integrity sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA== -"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: - name string-width-cjs +"string-width-cjs@npm:string-width@^4.2.0": + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -1802,7 +1810,14 @@ string-width@^5.0.1, string-width@^5.1.2: emoji-regex "^9.2.2" strip-ansi "^7.0.1" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + +strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -2073,8 +2088,16 @@ which@^2.0.1: dependencies: isexe "^2.0.0" -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: - name wrap-ansi-cjs +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + +wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==