flowrix 1.0.0
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.
- package/LICENSE +18 -0
- package/README.md +84 -0
- package/dist/module.d.mts +8 -0
- package/dist/module.json +9 -0
- package/dist/module.mjs +273 -0
- package/dist/runtime/composables/Blog/useBlogIndex.d.ts +111 -0
- package/dist/runtime/composables/Blog/useBlogIndex.js +86 -0
- package/dist/runtime/composables/Blog/useBlogMain.d.ts +13 -0
- package/dist/runtime/composables/Blog/useBlogMain.js +7 -0
- package/dist/runtime/composables/Blog/useBlogSidebar.d.ts +7 -0
- package/dist/runtime/composables/Blog/useBlogSidebar.js +37 -0
- package/dist/runtime/composables/Blog/useBlogSingle.d.ts +30 -0
- package/dist/runtime/composables/Blog/useBlogSingle.js +87 -0
- package/dist/runtime/composables/Blog/useMagazineCard.d.ts +13 -0
- package/dist/runtime/composables/Blog/useMagazineCard.js +14 -0
- package/dist/runtime/composables/Blog/useSingleBlogMain.d.ts +20 -0
- package/dist/runtime/composables/Blog/useSingleBlogMain.js +28 -0
- package/dist/runtime/composables/Brand/brand.d.ts +7 -0
- package/dist/runtime/composables/Brand/brand.js +45 -0
- package/dist/runtime/composables/Cart/useCartDetail.d.ts +49 -0
- package/dist/runtime/composables/Cart/useCartDetail.js +48 -0
- package/dist/runtime/composables/Category/useCategoryContent.d.ts +9 -0
- package/dist/runtime/composables/Category/useCategoryContent.js +15 -0
- package/dist/runtime/composables/Category/useCategoryGrid.d.ts +40 -0
- package/dist/runtime/composables/Category/useCategoryGrid.js +38 -0
- package/dist/runtime/composables/Category/useCategoryIndex.d.ts +33 -0
- package/dist/runtime/composables/Category/useCategoryIndex.js +65 -0
- package/dist/runtime/composables/Category/useCategoryTemplate2.d.ts +50 -0
- package/dist/runtime/composables/Category/useCategoryTemplate2.js +43 -0
- package/dist/runtime/composables/Category/useCategoryTemplate3.d.ts +66 -0
- package/dist/runtime/composables/Category/useCategoryTemplate3.js +45 -0
- package/dist/runtime/composables/Category/useCategoryTop.d.ts +18 -0
- package/dist/runtime/composables/Category/useCategoryTop.js +65 -0
- package/dist/runtime/composables/Checkout/PaymentMethods/useDirectDeposit.d.ts +3 -0
- package/dist/runtime/composables/Checkout/PaymentMethods/useDirectDeposit.js +22 -0
- package/dist/runtime/composables/Checkout/PaymentMethods/useEway.d.ts +8 -0
- package/dist/runtime/composables/Checkout/PaymentMethods/useEway.js +88 -0
- package/dist/runtime/composables/Checkout/PaymentMethods/useFlowrixpay.d.ts +13 -0
- package/dist/runtime/composables/Checkout/PaymentMethods/useFlowrixpay.js +155 -0
- package/dist/runtime/composables/Checkout/PaymentMethods/useOpayo.d.ts +9 -0
- package/dist/runtime/composables/Checkout/PaymentMethods/useOpayo.js +90 -0
- package/dist/runtime/composables/Checkout/PaymentMethods/usePaymentMethods.d.ts +15 -0
- package/dist/runtime/composables/Checkout/PaymentMethods/usePaymentMethods.js +146 -0
- package/dist/runtime/composables/Checkout/PaymentMethods/usePaypal.d.ts +3 -0
- package/dist/runtime/composables/Checkout/PaymentMethods/usePaypal.js +22 -0
- package/dist/runtime/composables/Checkout/PaymentMethods/useStripe.d.ts +7 -0
- package/dist/runtime/composables/Checkout/PaymentMethods/useStripe.js +43 -0
- package/dist/runtime/composables/Checkout/PaymentMethods/useZippay.d.ts +3 -0
- package/dist/runtime/composables/Checkout/PaymentMethods/useZippay.js +22 -0
- package/dist/runtime/composables/Checkout/useBillingAddress.d.ts +19 -0
- package/dist/runtime/composables/Checkout/useBillingAddress.js +82 -0
- package/dist/runtime/composables/Checkout/useCheckout.d.ts +186 -0
- package/dist/runtime/composables/Checkout/useCheckout.js +366 -0
- package/dist/runtime/composables/Checkout/useCreateAccount.d.ts +15 -0
- package/dist/runtime/composables/Checkout/useCreateAccount.js +61 -0
- package/dist/runtime/composables/Checkout/useDeliveryMethod.d.ts +4 -0
- package/dist/runtime/composables/Checkout/useDeliveryMethod.js +36 -0
- package/dist/runtime/composables/Checkout/useShippingAddress.d.ts +9 -0
- package/dist/runtime/composables/Checkout/useShippingAddress.js +121 -0
- package/dist/runtime/composables/Customer/useRegister.d.ts +18 -0
- package/dist/runtime/composables/Customer/useRegister.js +48 -0
- package/dist/runtime/composables/Extras/useCountry.d.ts +6 -0
- package/dist/runtime/composables/Extras/useCountry.js +11 -0
- package/dist/runtime/composables/Extras/useDateFormatter.d.ts +4 -0
- package/dist/runtime/composables/Extras/useDateFormatter.js +20 -0
- package/dist/runtime/composables/Extras/useNumberOnly.d.ts +5 -0
- package/dist/runtime/composables/Extras/useNumberOnly.js +21 -0
- package/dist/runtime/composables/Extras/usePasswordFormatter.d.ts +8 -0
- package/dist/runtime/composables/Extras/usePasswordFormatter.js +61 -0
- package/dist/runtime/composables/Extras/useSrcSets.d.ts +8 -0
- package/dist/runtime/composables/Extras/useSrcSets.js +26 -0
- package/dist/runtime/composables/Extras/useTogglePassword.d.ts +4 -0
- package/dist/runtime/composables/Extras/useTogglePassword.js +11 -0
- package/dist/runtime/composables/Footer/useFooter.d.ts +14 -0
- package/dist/runtime/composables/Footer/useFooter.js +61 -0
- package/dist/runtime/composables/Header/useHeader.d.ts +28 -0
- package/dist/runtime/composables/Header/useHeader.js +66 -0
- package/dist/runtime/composables/Menu/MainMenu.d.ts +4 -0
- package/dist/runtime/composables/Menu/MainMenu.js +17 -0
- package/dist/runtime/composables/Product/CustomProduct/useAttributeType.d.ts +3 -0
- package/dist/runtime/composables/Product/CustomProduct/useAttributeType.js +20 -0
- package/dist/runtime/composables/Product/CustomProduct/useAttributes.d.ts +70 -0
- package/dist/runtime/composables/Product/CustomProduct/useAttributes.js +68 -0
- package/dist/runtime/composables/Product/CustomProduct/useCustomProduct.d.ts +74 -0
- package/dist/runtime/composables/Product/CustomProduct/useCustomProduct.js +107 -0
- package/dist/runtime/composables/Product/CustomProduct/useCustomeScript.d.ts +159 -0
- package/dist/runtime/composables/Product/CustomProduct/useCustomeScript.js +2080 -0
- package/dist/runtime/composables/Product/CustomProduct/useSingleAttribute.d.ts +4 -0
- package/dist/runtime/composables/Product/CustomProduct/useSingleAttribute.js +27 -0
- package/dist/runtime/composables/Product/CustomProduct/useSingleStep.d.ts +68 -0
- package/dist/runtime/composables/Product/CustomProduct/useSingleStep.js +21 -0
- package/dist/runtime/composables/Product/CustomProduct/useSingleValue.d.ts +67 -0
- package/dist/runtime/composables/Product/CustomProduct/useSingleValue.js +15 -0
- package/dist/runtime/composables/Product/CustomProduct/useSteps.d.ts +74 -0
- package/dist/runtime/composables/Product/CustomProduct/useSteps.js +78 -0
- package/dist/runtime/composables/Product/simpleProduct/useSimpleProduct.d.ts +25 -0
- package/dist/runtime/composables/Product/simpleProduct/useSimpleProduct.js +77 -0
- package/dist/runtime/composables/Product/useProductCard.d.ts +13 -0
- package/dist/runtime/composables/Product/useProductCard.js +88 -0
- package/dist/runtime/composables/Product/useProductComponent.d.ts +5 -0
- package/dist/runtime/composables/Product/useProductComponent.js +21 -0
- package/dist/runtime/composables/Product/useProductSlug.d.ts +1 -0
- package/dist/runtime/composables/Product/useProductSlug.js +25 -0
- package/dist/runtime/composables/Product/useService.d.ts +17 -0
- package/dist/runtime/composables/Product/useService.js +67 -0
- package/dist/runtime/composables/Product/useTemplate.d.ts +5 -0
- package/dist/runtime/composables/Product/useTemplate.js +21 -0
- package/dist/runtime/composables/Samples/useSamples.d.ts +10 -0
- package/dist/runtime/composables/Samples/useSamples.js +36 -0
- package/dist/runtime/composables/SideBar/Filters/useFilters.d.ts +6 -0
- package/dist/runtime/composables/SideBar/Filters/useFilters.js +51 -0
- package/dist/runtime/composables/SideBar/Filters/useSorting.d.ts +5 -0
- package/dist/runtime/composables/SideBar/Filters/useSorting.js +27 -0
- package/dist/runtime/composables/SideBar/useSideBar.d.ts +8 -0
- package/dist/runtime/composables/SideBar/useSideBar.js +68 -0
- package/dist/runtime/composables/index.d.ts +74 -0
- package/dist/runtime/composables/index.js +74 -0
- package/dist/runtime/composables/types.d.ts +5 -0
- package/dist/runtime/composables/types.js +0 -0
- package/dist/runtime/composables/useAddToCart.d.ts +28 -0
- package/dist/runtime/composables/useAddToCart.js +114 -0
- package/dist/runtime/composables/useAddresses.d.ts +18 -0
- package/dist/runtime/composables/useAddresses.js +126 -0
- package/dist/runtime/composables/useAuth.d.ts +45 -0
- package/dist/runtime/composables/useAuth.js +180 -0
- package/dist/runtime/composables/useCards.d.ts +19 -0
- package/dist/runtime/composables/useCards.js +73 -0
- package/dist/runtime/composables/useClientApi.d.ts +23 -0
- package/dist/runtime/composables/useClientApi.js +53 -0
- package/dist/runtime/composables/useCountries.d.ts +12 -0
- package/dist/runtime/composables/useCountries.js +50 -0
- package/dist/runtime/composables/useDataLayer.d.ts +18 -0
- package/dist/runtime/composables/useDataLayer.js +385 -0
- package/dist/runtime/composables/useDynamicHtmlRenderer.d.ts +4 -0
- package/dist/runtime/composables/useDynamicHtmlRenderer.js +33 -0
- package/dist/runtime/composables/useLocation.d.ts +23 -0
- package/dist/runtime/composables/useLocation.js +32 -0
- package/dist/runtime/composables/useLocations.d.ts +12 -0
- package/dist/runtime/composables/useLocations.js +53 -0
- package/dist/runtime/composables/useMetaLayer.d.ts +10 -0
- package/dist/runtime/composables/useMetaLayer.js +263 -0
- package/dist/runtime/composables/useOrders.d.ts +21 -0
- package/dist/runtime/composables/useOrders.js +82 -0
- package/dist/runtime/composables/useQuotations.d.ts +14 -0
- package/dist/runtime/composables/useQuotations.js +50 -0
- package/dist/runtime/composables/useSearch.d.ts +7 -0
- package/dist/runtime/composables/useSearch.js +40 -0
- package/dist/runtime/composables/useSubscriptions.d.ts +13 -0
- package/dist/runtime/composables/useSubscriptions.js +58 -0
- package/dist/runtime/composables/useTikTokDatalayer.d.ts +8 -0
- package/dist/runtime/composables/useTikTokDatalayer.js +165 -0
- package/dist/runtime/composables/useWebforms.d.ts +16 -0
- package/dist/runtime/composables/useWebforms.js +75 -0
- package/dist/runtime/composables/useWishlists.d.ts +38 -0
- package/dist/runtime/composables/useWishlists.js +191 -0
- package/dist/runtime/middleware/flowrix.d.ts +6 -0
- package/dist/runtime/middleware/flowrix.js +40 -0
- package/dist/runtime/plugin.d.ts +2 -0
- package/dist/runtime/plugin.js +4 -0
- package/dist/runtime/plugins/persistedstate.client.d.ts +2 -0
- package/dist/runtime/plugins/persistedstate.client.js +9 -0
- package/dist/runtime/server/api/albums.d.ts +2 -0
- package/dist/runtime/server/api/albums.js +18 -0
- package/dist/runtime/server/api/auth/forgot.d.ts +5 -0
- package/dist/runtime/server/api/auth/forgot.js +44 -0
- package/dist/runtime/server/api/auth/login.d.ts +11 -0
- package/dist/runtime/server/api/auth/login.js +69 -0
- package/dist/runtime/server/api/auth/logout.d.ts +5 -0
- package/dist/runtime/server/api/auth/logout.js +23 -0
- package/dist/runtime/server/api/auth/register.d.ts +2 -0
- package/dist/runtime/server/api/auth/register.js +51 -0
- package/dist/runtime/server/api/auth/session.get.d.ts +2 -0
- package/dist/runtime/server/api/auth/session.get.js +46 -0
- package/dist/runtime/server/api/auth/user/reset-password.d.ts +5 -0
- package/dist/runtime/server/api/auth/user/reset-password.js +40 -0
- package/dist/runtime/server/api/auth/user/session.d.ts +2 -0
- package/dist/runtime/server/api/auth/user/session.js +43 -0
- package/dist/runtime/server/api/auth/user/verify-token.d.ts +6 -0
- package/dist/runtime/server/api/auth/user/verify-token.js +50 -0
- package/dist/runtime/server/api/banners.d.ts +3 -0
- package/dist/runtime/server/api/banners.js +41 -0
- package/dist/runtime/server/api/blog/[slug].d.ts +3 -0
- package/dist/runtime/server/api/blog/[slug].js +51 -0
- package/dist/runtime/server/api/blog/blog.d.ts +3 -0
- package/dist/runtime/server/api/blog/blog.js +17 -0
- package/dist/runtime/server/api/brand/[slug].d.ts +3 -0
- package/dist/runtime/server/api/brand/[slug].js +58 -0
- package/dist/runtime/server/api/cart/[slug]/add.d.ts +2 -0
- package/dist/runtime/server/api/cart/[slug]/add.js +21 -0
- package/dist/runtime/server/api/cart/[slug]/update.d.ts +2 -0
- package/dist/runtime/server/api/cart/[slug]/update.js +21 -0
- package/dist/runtime/server/api/cart/remove.d.ts +2 -0
- package/dist/runtime/server/api/cart/remove.js +21 -0
- package/dist/runtime/server/api/cart/service/[slug]/add.d.ts +2 -0
- package/dist/runtime/server/api/cart/service/[slug]/add.js +16 -0
- package/dist/runtime/server/api/catalog/categories.d.ts +3 -0
- package/dist/runtime/server/api/catalog/categories.js +43 -0
- package/dist/runtime/server/api/catalog/featured.d.ts +3 -0
- package/dist/runtime/server/api/catalog/featured.js +41 -0
- package/dist/runtime/server/api/catalog/samples.d.ts +3 -0
- package/dist/runtime/server/api/catalog/samples.js +44 -0
- package/dist/runtime/server/api/catalog/search.d.ts +3 -0
- package/dist/runtime/server/api/catalog/search.js +44 -0
- package/dist/runtime/server/api/category/[...slug].d.ts +3 -0
- package/dist/runtime/server/api/category/[...slug].js +51 -0
- package/dist/runtime/server/api/checkout/applyCoupon.d.ts +2 -0
- package/dist/runtime/server/api/checkout/applyCoupon.js +20 -0
- package/dist/runtime/server/api/checkout/configs.d.ts +2 -0
- package/dist/runtime/server/api/checkout/configs.js +20 -0
- package/dist/runtime/server/api/checkout/countries.d.ts +2 -0
- package/dist/runtime/server/api/checkout/countries.js +17 -0
- package/dist/runtime/server/api/checkout/paymentmethod.d.ts +2 -0
- package/dist/runtime/server/api/checkout/paymentmethod.js +20 -0
- package/dist/runtime/server/api/company/profile.d.ts +2 -0
- package/dist/runtime/server/api/company/profile.js +18 -0
- package/dist/runtime/server/api/contact-center/webforms/[id]/details.d.ts +3 -0
- package/dist/runtime/server/api/contact-center/webforms/[id]/details.js +19 -0
- package/dist/runtime/server/api/contact-center/webforms/create.d.ts +2 -0
- package/dist/runtime/server/api/contact-center/webforms/create.js +16 -0
- package/dist/runtime/server/api/customer/address/add.d.ts +14 -0
- package/dist/runtime/server/api/customer/address/add.js +33 -0
- package/dist/runtime/server/api/customer/address/delete.d.ts +20 -0
- package/dist/runtime/server/api/customer/address/delete.js +37 -0
- package/dist/runtime/server/api/customer/address/setshipping.d.ts +20 -0
- package/dist/runtime/server/api/customer/address/setshipping.js +41 -0
- package/dist/runtime/server/api/customer/address/update.d.ts +20 -0
- package/dist/runtime/server/api/customer/address/update.js +42 -0
- package/dist/runtime/server/api/customer/cards/delete.d.ts +2 -0
- package/dist/runtime/server/api/customer/cards/delete.js +23 -0
- package/dist/runtime/server/api/customer/cards/get.d.ts +2 -0
- package/dist/runtime/server/api/customer/cards/get.js +17 -0
- package/dist/runtime/server/api/customer/change-password.d.ts +14 -0
- package/dist/runtime/server/api/customer/change-password.js +34 -0
- package/dist/runtime/server/api/customer/checkout.d.ts +2 -0
- package/dist/runtime/server/api/customer/checkout.js +20 -0
- package/dist/runtime/server/api/customer/orders.d.ts +2 -0
- package/dist/runtime/server/api/customer/orders.js +17 -0
- package/dist/runtime/server/api/customer/profile/update.d.ts +14 -0
- package/dist/runtime/server/api/customer/profile/update.js +34 -0
- package/dist/runtime/server/api/customer/quotations.d.ts +2 -0
- package/dist/runtime/server/api/customer/quotations.js +17 -0
- package/dist/runtime/server/api/customer/search.d.ts +2 -0
- package/dist/runtime/server/api/customer/search.js +15 -0
- package/dist/runtime/server/api/customer/tax-invoice.d.ts +8 -0
- package/dist/runtime/server/api/customer/tax-invoice.js +36 -0
- package/dist/runtime/server/api/customer/wishlist/add.d.ts +2 -0
- package/dist/runtime/server/api/customer/wishlist/add.js +30 -0
- package/dist/runtime/server/api/customer/wishlist/createWishList.d.ts +2 -0
- package/dist/runtime/server/api/customer/wishlist/createWishList.js +29 -0
- package/dist/runtime/server/api/customer/wishlist/deleteFromWishList.d.ts +2 -0
- package/dist/runtime/server/api/customer/wishlist/deleteFromWishList.js +46 -0
- package/dist/runtime/server/api/customer/wishlist/deleteWishList.d.ts +2 -0
- package/dist/runtime/server/api/customer/wishlist/deleteWishList.js +30 -0
- package/dist/runtime/server/api/customer/wishlist/get.d.ts +2 -0
- package/dist/runtime/server/api/customer/wishlist/get.js +17 -0
- package/dist/runtime/server/api/customer/wishlist/getWishListItems.d.ts +2 -0
- package/dist/runtime/server/api/customer/wishlist/getWishListItems.js +21 -0
- package/dist/runtime/server/api/customer/wishlist/updateWishList.d.ts +2 -0
- package/dist/runtime/server/api/customer/wishlist/updateWishList.js +30 -0
- package/dist/runtime/server/api/location.d.ts +2 -0
- package/dist/runtime/server/api/location.js +13 -0
- package/dist/runtime/server/api/nav/[id]/links.d.ts +2 -0
- package/dist/runtime/server/api/nav/[id]/links.js +19 -0
- package/dist/runtime/server/api/page/[slug].d.ts +3 -0
- package/dist/runtime/server/api/page/[slug].js +51 -0
- package/dist/runtime/server/api/product/[...slug].d.ts +3 -0
- package/dist/runtime/server/api/product/[...slug].js +44 -0
- package/dist/runtime/server/api/service/[slug].d.ts +3 -0
- package/dist/runtime/server/api/service/[slug].js +51 -0
- package/dist/runtime/server/api/service/availability.d.ts +2 -0
- package/dist/runtime/server/api/service/availability.js +27 -0
- package/dist/runtime/server/api/subscribe.d.ts +2 -0
- package/dist/runtime/server/api/subscribe.js +16 -0
- package/dist/runtime/server/api/v2/[...slug].d.ts +3 -0
- package/dist/runtime/server/api/v2/[...slug].js +9 -0
- package/dist/runtime/server/tsconfig.json +3 -0
- package/dist/runtime/stores/Booking.d.ts +99 -0
- package/dist/runtime/stores/Booking.js +96 -0
- package/dist/runtime/stores/Cart.d.ts +67 -0
- package/dist/runtime/stores/Cart.js +272 -0
- package/dist/runtime/stores/Categories.d.ts +13 -0
- package/dist/runtime/stores/Categories.js +90 -0
- package/dist/runtime/stores/Checkout.d.ts +85 -0
- package/dist/runtime/stores/Checkout.js +213 -0
- package/dist/runtime/stores/IpLocation.d.ts +18 -0
- package/dist/runtime/stores/IpLocation.js +29 -0
- package/dist/runtime/stores/NavMenu.d.ts +15 -0
- package/dist/runtime/stores/NavMenu.js +26 -0
- package/dist/runtime/stores/Search.d.ts +0 -0
- package/dist/runtime/stores/Search.js +33 -0
- package/dist/runtime/stores/Services.d.ts +7 -0
- package/dist/runtime/stores/Services.js +49 -0
- package/dist/runtime/stores/Utilities.d.ts +5 -0
- package/dist/runtime/stores/Utilities.js +11 -0
- package/dist/runtime/stores/addresses.d.ts +15 -0
- package/dist/runtime/stores/addresses.js +31 -0
- package/dist/runtime/stores/auth.d.ts +62 -0
- package/dist/runtime/stores/auth.js +59 -0
- package/dist/runtime/stores/cards.d.ts +15 -0
- package/dist/runtime/stores/cards.js +22 -0
- package/dist/runtime/stores/compareStore.d.ts +7 -0
- package/dist/runtime/stores/compareStore.js +45 -0
- package/dist/runtime/stores/countries.d.ts +10 -0
- package/dist/runtime/stores/countries.js +19 -0
- package/dist/runtime/stores/index.d.ts +26 -0
- package/dist/runtime/stores/index.js +24 -0
- package/dist/runtime/stores/locations.d.ts +11 -0
- package/dist/runtime/stores/locations.js +19 -0
- package/dist/runtime/stores/orders.d.ts +16 -0
- package/dist/runtime/stores/orders.js +19 -0
- package/dist/runtime/stores/product/README.md +141 -0
- package/dist/runtime/stores/product/slug.d.ts +181 -0
- package/dist/runtime/stores/product/slug.js +91 -0
- package/dist/runtime/stores/product.d.ts +5 -0
- package/dist/runtime/stores/product.js +38 -0
- package/dist/runtime/stores/quotations.d.ts +12 -0
- package/dist/runtime/stores/quotations.js +19 -0
- package/dist/runtime/stores/subscriptions.d.ts +11 -0
- package/dist/runtime/stores/subscriptions.js +19 -0
- package/dist/runtime/stores/useCompanyProfile.d.ts +7 -0
- package/dist/runtime/stores/useCompanyProfile.js +22 -0
- package/dist/runtime/stores/useNavMenuStore.d.ts +5 -0
- package/dist/runtime/stores/useNavMenuStore.js +23 -0
- package/dist/runtime/stores/webforms.d.ts +18 -0
- package/dist/runtime/stores/webforms.js +23 -0
- package/dist/runtime/stores/wishlists.d.ts +28 -0
- package/dist/runtime/stores/wishlists.js +49 -0
- package/dist/runtime/utils/api.d.ts +13 -0
- package/dist/runtime/utils/api.js +102 -0
- package/dist/runtime/utils/companyProfile.d.ts +22 -0
- package/dist/runtime/utils/companyProfile.js +21 -0
- package/dist/types.d.mts +3 -0
- package/package.json +56 -0
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import { defineStore } from "pinia";
|
|
2
|
+
import { flowrixApi } from "../middleware/flowrix.js";
|
|
3
|
+
import { useCheckoutStore } from "./Checkout.js";
|
|
4
|
+
import { useApi } from "../utils/api.js";
|
|
5
|
+
export const useCartStore = defineStore("cart", {
|
|
6
|
+
state: () => ({
|
|
7
|
+
cart: {},
|
|
8
|
+
lastitem: {},
|
|
9
|
+
activeService: [],
|
|
10
|
+
coupon: [],
|
|
11
|
+
data: [],
|
|
12
|
+
responseData: [],
|
|
13
|
+
errorResponseData: {},
|
|
14
|
+
addedResponse: ""
|
|
15
|
+
}),
|
|
16
|
+
actions: {
|
|
17
|
+
transformData(data) {
|
|
18
|
+
const attribute_id = {};
|
|
19
|
+
const fraction = {};
|
|
20
|
+
for (const [key, value] of Object.entries(data)) {
|
|
21
|
+
const match = key.match(/(attribute_id|fraction)\[(\d+)\]/);
|
|
22
|
+
if (match) {
|
|
23
|
+
const [, type, id] = match;
|
|
24
|
+
if (type === "attribute_id") {
|
|
25
|
+
attribute_id[id] = value;
|
|
26
|
+
} else if (type === "fraction") {
|
|
27
|
+
fraction[id] = value;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return { attribute_id, fraction };
|
|
32
|
+
},
|
|
33
|
+
async addToCart(product, qty, data, productId = "", service = []) {
|
|
34
|
+
const { post } = useApi();
|
|
35
|
+
const checkoutSession = useCheckoutStore().checkoutSession;
|
|
36
|
+
let formData = {
|
|
37
|
+
cart: void 0,
|
|
38
|
+
qty: qty ?? 1,
|
|
39
|
+
rowId: productId,
|
|
40
|
+
deliverymethod: checkoutSession?.fields?.deliverymethod,
|
|
41
|
+
shippingmethod: checkoutSession?.fields?.shippingmethod
|
|
42
|
+
};
|
|
43
|
+
if (this.coupon?.length > 0) {
|
|
44
|
+
formData.vouchercodes = this.coupon;
|
|
45
|
+
}
|
|
46
|
+
if (this.cart.items != void 0) {
|
|
47
|
+
formData.cart = this.cart.items;
|
|
48
|
+
formData.abndToken = this.cart.abndToken;
|
|
49
|
+
}
|
|
50
|
+
if (data) {
|
|
51
|
+
formData = { ...formData, ...this.transformData(data) };
|
|
52
|
+
}
|
|
53
|
+
let apiUrl = "";
|
|
54
|
+
if (productId) {
|
|
55
|
+
if (this.cart.items != void 0) {
|
|
56
|
+
formData.qty = this.cart.items[productId]?.qty ?? 1;
|
|
57
|
+
}
|
|
58
|
+
apiUrl = `cart/${product.slug}/update`;
|
|
59
|
+
formData.rowId = productId;
|
|
60
|
+
} else {
|
|
61
|
+
apiUrl = `cart/${product.slug}/add`;
|
|
62
|
+
}
|
|
63
|
+
if (service?.length !== 0) {
|
|
64
|
+
formData.deliverymethod = service.fulfilment_id;
|
|
65
|
+
apiUrl = `cart/service/${service.slug}/add`;
|
|
66
|
+
}
|
|
67
|
+
try {
|
|
68
|
+
const response = await flowrixApi.post(apiUrl, {
|
|
69
|
+
body: formData
|
|
70
|
+
});
|
|
71
|
+
if (response?.status == "Success") {
|
|
72
|
+
this.addedResponse = "success";
|
|
73
|
+
this.cart = {
|
|
74
|
+
["items"]: response?.data.cart,
|
|
75
|
+
["totals"]: response?.data.calculations,
|
|
76
|
+
["abndToken"]: response?.data.abndToken
|
|
77
|
+
};
|
|
78
|
+
this.lastitem = response?.data.lastItem;
|
|
79
|
+
useCheckoutStore().saveToCheckoutSession({
|
|
80
|
+
cart: response?.data,
|
|
81
|
+
calculations: response?.data.calculations,
|
|
82
|
+
abndToken: response?.data.abndToken,
|
|
83
|
+
fields: checkoutSession?.fields
|
|
84
|
+
});
|
|
85
|
+
} else {
|
|
86
|
+
this.addedResponse = "no";
|
|
87
|
+
}
|
|
88
|
+
} catch (error) {
|
|
89
|
+
console.error("Error adding to cart:", error);
|
|
90
|
+
this.addedResponse = "";
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
async removeFromCart(id, product) {
|
|
94
|
+
try {
|
|
95
|
+
const { post } = useApi();
|
|
96
|
+
const checkoutSession = useCheckoutStore().checkoutSession;
|
|
97
|
+
const apiUrl = `cart/remove`;
|
|
98
|
+
const request = {
|
|
99
|
+
cart: this.cart.items,
|
|
100
|
+
rowId: id,
|
|
101
|
+
abndToken: this.cart.abndToken,
|
|
102
|
+
deliverymethod: checkoutSession?.fields?.deliverymethod,
|
|
103
|
+
shippingmethod: checkoutSession?.fields?.shippingmethod
|
|
104
|
+
};
|
|
105
|
+
if (product.type === "service" || product.fulfilment_id !== void 0) {
|
|
106
|
+
request.deliverymethod = 1;
|
|
107
|
+
}
|
|
108
|
+
if (this.coupon?.length > 0) {
|
|
109
|
+
request.vouchercodes = this.coupon;
|
|
110
|
+
}
|
|
111
|
+
const response = await post(apiUrl, request);
|
|
112
|
+
if (response?.status == "Success") {
|
|
113
|
+
this.cart = {
|
|
114
|
+
["items"]: response?.data.cart,
|
|
115
|
+
["totals"]: response?.data.calculations,
|
|
116
|
+
["abndToken"]: response?.data.abndToken
|
|
117
|
+
};
|
|
118
|
+
this.lastitem = response?.data.lastItem;
|
|
119
|
+
useCheckoutStore().saveToCheckoutSession({
|
|
120
|
+
cart: response.cart.items,
|
|
121
|
+
calculations: response.cart.calculations,
|
|
122
|
+
abndToken: response.cart.abndToken,
|
|
123
|
+
fields: checkoutSession?.fields
|
|
124
|
+
});
|
|
125
|
+
} else {
|
|
126
|
+
this.cart = {};
|
|
127
|
+
}
|
|
128
|
+
} catch (error) {
|
|
129
|
+
console.error("Error removing from cart:", error);
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
async updateQuantity(product, qty) {
|
|
133
|
+
try {
|
|
134
|
+
const checkoutSession = useCheckoutStore().checkoutSession;
|
|
135
|
+
const { post } = useApi();
|
|
136
|
+
const apiUrl = `cart/${product.slug}/update`;
|
|
137
|
+
const request = {
|
|
138
|
+
cart: this.cart.items,
|
|
139
|
+
rowId: product.rowId,
|
|
140
|
+
qty,
|
|
141
|
+
deliverymethod: checkoutSession?.fields?.deliverymethod,
|
|
142
|
+
// shipping_state: checkoutSession?.fields?.shipping_state,
|
|
143
|
+
// shipping_postcode: checkoutSession?.fields?.shipping_postcode,
|
|
144
|
+
// shipping_country: checkoutSession?.fields?.shipping_country,
|
|
145
|
+
shippingmethod: checkoutSession?.fields?.shippingmethod,
|
|
146
|
+
abndToken: this.cart.abndToken
|
|
147
|
+
};
|
|
148
|
+
if (this.coupon?.length > 0) {
|
|
149
|
+
request.vouchercodes = this.coupon;
|
|
150
|
+
}
|
|
151
|
+
const response = await post(apiUrl, request);
|
|
152
|
+
if (response?.status == "Success") {
|
|
153
|
+
this.cart = {
|
|
154
|
+
["items"]: response?.data.cart,
|
|
155
|
+
["totals"]: response?.data.calculations,
|
|
156
|
+
["abndToken"]: response?.data.abndToken
|
|
157
|
+
};
|
|
158
|
+
this.lastitem = response?.data.lastItem;
|
|
159
|
+
if (qty < product.qty) {
|
|
160
|
+
GTM_remove_from_cart(this.lastitem);
|
|
161
|
+
META_remove_from_cart(this.lastitem);
|
|
162
|
+
} else {
|
|
163
|
+
GTM_add_to_cart(this.lastitem);
|
|
164
|
+
META_add_to_cart(this.lastitem);
|
|
165
|
+
}
|
|
166
|
+
useCheckoutStore().saveToCheckoutSession({
|
|
167
|
+
cart: response.data.cart,
|
|
168
|
+
calculations: response.data.calculations,
|
|
169
|
+
abndToken: response.data.abndToken,
|
|
170
|
+
fields: checkoutSession?.fields
|
|
171
|
+
});
|
|
172
|
+
} else {
|
|
173
|
+
this.cart = {};
|
|
174
|
+
}
|
|
175
|
+
} catch (error) {
|
|
176
|
+
console.error("Error updating quantity:", error);
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
async ApplyCoupon(coupon) {
|
|
180
|
+
try {
|
|
181
|
+
let couponsCodes = this.coupon || [];
|
|
182
|
+
const checkoutSession = useCheckoutStore().checkoutSession;
|
|
183
|
+
const { post } = useApi();
|
|
184
|
+
let apiUrl = "/checkout/applyCoupon";
|
|
185
|
+
const removeValue = coupon.remove ?? void 0;
|
|
186
|
+
if (removeValue !== void 0) {
|
|
187
|
+
couponsCodes.splice(removeValue, 1);
|
|
188
|
+
apiUrl = "/checkout/remove-coupon";
|
|
189
|
+
}
|
|
190
|
+
const couponData = {
|
|
191
|
+
cart: this.cart.items,
|
|
192
|
+
vouchercodes: Array.from(new Set(couponsCodes)),
|
|
193
|
+
fields: checkoutSession?.fields,
|
|
194
|
+
code: removeValue === void 0 ? coupon.code : "",
|
|
195
|
+
abndToken: this.cart.abndToken
|
|
196
|
+
};
|
|
197
|
+
const response = await post(apiUrl, couponData);
|
|
198
|
+
if (response?.status === "Success" && response?.data?.calculations) {
|
|
199
|
+
this.cart.totals = response.data.calculations;
|
|
200
|
+
if (removeValue === void 0) {
|
|
201
|
+
couponsCodes.push(coupon.code);
|
|
202
|
+
}
|
|
203
|
+
this.coupon = Array.from(new Set(couponsCodes));
|
|
204
|
+
useCheckoutStore().saveToCheckoutSession(response.data);
|
|
205
|
+
this.errorResponseData = {};
|
|
206
|
+
return response;
|
|
207
|
+
} else {
|
|
208
|
+
const errorMessage = response?.message || "Failed to apply coupon";
|
|
209
|
+
this.errorResponseData = { message: errorMessage };
|
|
210
|
+
throw new Error(errorMessage);
|
|
211
|
+
}
|
|
212
|
+
} catch (error) {
|
|
213
|
+
console.error("Apply coupon error:", error);
|
|
214
|
+
const errorMessage = error.data ? formatErrorMessage(error.data.message) : error.message || "Failed to apply coupon";
|
|
215
|
+
this.errorResponseData = { message: errorMessage };
|
|
216
|
+
throw new Error(errorMessage);
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
async AbandonedCartComplete(token) {
|
|
220
|
+
try {
|
|
221
|
+
const apiUrl = `/api/cart/abandoned/${token}/complete`;
|
|
222
|
+
await $fetch(apiUrl, {
|
|
223
|
+
method: "POST"
|
|
224
|
+
});
|
|
225
|
+
} catch (error) {
|
|
226
|
+
console.error("Error completing abandoned cart:", error);
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
async fetchAbandonedCart(token) {
|
|
230
|
+
try {
|
|
231
|
+
const apiUrl = `/api/cart/abandoned/${token}`;
|
|
232
|
+
const response = await $fetch(apiUrl);
|
|
233
|
+
if (response?.data?.cart) {
|
|
234
|
+
this.cart = {
|
|
235
|
+
items: response.data.cart,
|
|
236
|
+
totals: response.data.calculations,
|
|
237
|
+
abndToken: response.data.abndToken,
|
|
238
|
+
fields: response.data.fields
|
|
239
|
+
};
|
|
240
|
+
useCheckoutStore().saveToCheckoutSession(response.data);
|
|
241
|
+
}
|
|
242
|
+
} catch (error) {
|
|
243
|
+
console.error("Error fetching abandoned cart:", error);
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
clearCoupon() {
|
|
247
|
+
this.coupon = [];
|
|
248
|
+
},
|
|
249
|
+
clearCart() {
|
|
250
|
+
this.cart = {};
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
getters: {
|
|
254
|
+
itemsCount() {
|
|
255
|
+
if (this.cart?.items) {
|
|
256
|
+
return Object.values(this.cart.items).reduce(
|
|
257
|
+
(total, item) => {
|
|
258
|
+
return total + (typeof item.qty === "number" ? item.qty : 10);
|
|
259
|
+
},
|
|
260
|
+
0
|
|
261
|
+
);
|
|
262
|
+
}
|
|
263
|
+
return 0;
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
persist: {
|
|
267
|
+
enabled: true,
|
|
268
|
+
// simple shape that works with most versions:
|
|
269
|
+
key: "cart",
|
|
270
|
+
storage: typeof window !== "undefined" ? localStorage : void 0
|
|
271
|
+
}
|
|
272
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface CategoryState {
|
|
2
|
+
data: Record<string, any>;
|
|
3
|
+
category: Record<string, any>;
|
|
4
|
+
currentPage: number;
|
|
5
|
+
slug: string | null;
|
|
6
|
+
error: string | null;
|
|
7
|
+
}
|
|
8
|
+
export declare const useCategories: import("pinia").StoreDefinition<"Categories", CategoryState, {}, {
|
|
9
|
+
getCategories(slug: string, query?: {}): Promise<void>;
|
|
10
|
+
getChildCategories(slug: string, query?: {}): Promise<void>;
|
|
11
|
+
getAllCategories(query: any): Promise<void>;
|
|
12
|
+
}>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { defineStore } from "pinia";
|
|
2
|
+
export const useCategories = defineStore("Categories", {
|
|
3
|
+
state: () => ({
|
|
4
|
+
data: {},
|
|
5
|
+
category: {},
|
|
6
|
+
allCategories: {},
|
|
7
|
+
currentPage: 1,
|
|
8
|
+
slug: null,
|
|
9
|
+
error: null
|
|
10
|
+
}),
|
|
11
|
+
actions: {
|
|
12
|
+
async getCategories(slug, query = {}) {
|
|
13
|
+
try {
|
|
14
|
+
this.slug = slug;
|
|
15
|
+
let tags = "";
|
|
16
|
+
if (slug == "blinds-spare-parts") {
|
|
17
|
+
tags = "spare-part";
|
|
18
|
+
}
|
|
19
|
+
if (tags != "") {
|
|
20
|
+
query.tags = tags;
|
|
21
|
+
}
|
|
22
|
+
const apiUrl = `categories/${slug}`;
|
|
23
|
+
const response = await $fetch(apiUrl, { params: query });
|
|
24
|
+
if (response.status === 200) {
|
|
25
|
+
this.data = response.data;
|
|
26
|
+
this.category = response.data.category;
|
|
27
|
+
this.error = null;
|
|
28
|
+
} else {
|
|
29
|
+
this.data = {};
|
|
30
|
+
this.error = "No data found";
|
|
31
|
+
}
|
|
32
|
+
} catch (error) {
|
|
33
|
+
if (error.response) {
|
|
34
|
+
this.error = error.response.data.message || "An error occurred";
|
|
35
|
+
console.error(error.response);
|
|
36
|
+
} else {
|
|
37
|
+
this.error = "An error occurred";
|
|
38
|
+
console.error(error);
|
|
39
|
+
}
|
|
40
|
+
this.data = {};
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
async getChildCategories(slug, query = {}) {
|
|
44
|
+
try {
|
|
45
|
+
this.slug = slug;
|
|
46
|
+
const apiUrl = `categories/childern/${slug}`;
|
|
47
|
+
const response = await $fetch(apiUrl, { params: query });
|
|
48
|
+
if (response.status === 200) {
|
|
49
|
+
this.data = response.data.data;
|
|
50
|
+
this.category = response.data.data.category;
|
|
51
|
+
this.error = null;
|
|
52
|
+
} else {
|
|
53
|
+
this.data = {};
|
|
54
|
+
this.error = "No data found";
|
|
55
|
+
}
|
|
56
|
+
} catch (error) {
|
|
57
|
+
if (error.response) {
|
|
58
|
+
this.error = error.response.data.message || "An error occurred";
|
|
59
|
+
console.error(error.response);
|
|
60
|
+
} else {
|
|
61
|
+
this.error = "An error occurred";
|
|
62
|
+
console.error(error);
|
|
63
|
+
}
|
|
64
|
+
this.data = {};
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
async getAllCategories(query) {
|
|
68
|
+
try {
|
|
69
|
+
const apiUrl = `categories`;
|
|
70
|
+
const response = await $fetch(apiUrl, { params: query });
|
|
71
|
+
if (response.status === 200) {
|
|
72
|
+
this.allCategories = response.data;
|
|
73
|
+
this.error = null;
|
|
74
|
+
} else {
|
|
75
|
+
this.allCategories = {};
|
|
76
|
+
this.error = "No data found";
|
|
77
|
+
}
|
|
78
|
+
} catch (error) {
|
|
79
|
+
if (error.response) {
|
|
80
|
+
this.error = error.response.data.message || "An error occurred";
|
|
81
|
+
console.error(error.response);
|
|
82
|
+
} else {
|
|
83
|
+
this.error = "An error occurred";
|
|
84
|
+
console.error(error);
|
|
85
|
+
}
|
|
86
|
+
this.allCategories = {};
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
});
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
interface PreferenceData {
|
|
2
|
+
fields?: Record<string, any>;
|
|
3
|
+
deliverytype?: string;
|
|
4
|
+
order_no?: string;
|
|
5
|
+
publishableKey?: any;
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
}
|
|
8
|
+
interface CartItem {
|
|
9
|
+
fields?: Record<string, any>;
|
|
10
|
+
deliverytype?: string;
|
|
11
|
+
order_no?: string;
|
|
12
|
+
publishableKey?: any;
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
}
|
|
15
|
+
interface ConfigData {
|
|
16
|
+
preferences?: Record<string, any>[];
|
|
17
|
+
outlets?: Record<string, any>[];
|
|
18
|
+
deliverytype?: string;
|
|
19
|
+
order_no?: string;
|
|
20
|
+
publishableKey?: any;
|
|
21
|
+
calculations?: any;
|
|
22
|
+
shippingmethods?: any;
|
|
23
|
+
cart?: Record<string, CartItem>;
|
|
24
|
+
totals?: Record<string, any>;
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
}
|
|
27
|
+
interface FieldData {
|
|
28
|
+
billing_state?: number | string;
|
|
29
|
+
billing_firstname?: string | number;
|
|
30
|
+
firstname?: string | number;
|
|
31
|
+
billing_lastname?: string | number;
|
|
32
|
+
lastname?: string | number;
|
|
33
|
+
email?: string | number;
|
|
34
|
+
billing_mobile?: string | number;
|
|
35
|
+
billing_address?: string | number;
|
|
36
|
+
billing_suburb?: string | undefined;
|
|
37
|
+
billing_postcode?: number | undefined;
|
|
38
|
+
shipping_postcode?: number | undefined;
|
|
39
|
+
deliverymethod?: number | string;
|
|
40
|
+
shippingmethod?: number | string;
|
|
41
|
+
authoritytoleave?: number | undefined;
|
|
42
|
+
customernotes?: string;
|
|
43
|
+
shippingasbilling?: boolean;
|
|
44
|
+
shipping_address?: string;
|
|
45
|
+
shipping_country?: number | string;
|
|
46
|
+
shipping_state?: number | string;
|
|
47
|
+
shipping_suburb?: string;
|
|
48
|
+
shipping_firstname?: string;
|
|
49
|
+
shipping_fullname?: string;
|
|
50
|
+
shipping_lastname?: string;
|
|
51
|
+
shipping_middlename?: string;
|
|
52
|
+
shipping_mobile?: string;
|
|
53
|
+
billing_fullname?: string;
|
|
54
|
+
billing_middlename?: string;
|
|
55
|
+
mobile?: string | number;
|
|
56
|
+
fullname?: string;
|
|
57
|
+
invoice?: string;
|
|
58
|
+
quotation_no?: string;
|
|
59
|
+
[key: string]: any;
|
|
60
|
+
}
|
|
61
|
+
interface CheckoutState {
|
|
62
|
+
publishableKey: Record<string, any>;
|
|
63
|
+
responseData: any[];
|
|
64
|
+
config: ConfigData;
|
|
65
|
+
checkoutSession: PreferenceData & {
|
|
66
|
+
fields?: FieldData;
|
|
67
|
+
calculations?: any;
|
|
68
|
+
};
|
|
69
|
+
errorResponseData: Record<string, any>;
|
|
70
|
+
checkCustomer: any;
|
|
71
|
+
stripeElemets: any;
|
|
72
|
+
orderData: any;
|
|
73
|
+
PaymentErrors: any;
|
|
74
|
+
loading: boolean;
|
|
75
|
+
}
|
|
76
|
+
export declare const useCheckoutStore: import("pinia").StoreDefinition<"checkout", CheckoutState, {}, {
|
|
77
|
+
resetState(): void;
|
|
78
|
+
paymentMethods(formData: any): Promise<any>;
|
|
79
|
+
getConfig(): Promise<void>;
|
|
80
|
+
submitCheckout(): Promise<any>;
|
|
81
|
+
confirmPayment(checkoutId: string): Promise<void>;
|
|
82
|
+
CheckUserAccount(email: string): Promise<any>;
|
|
83
|
+
saveToCheckoutSession(fieldsData: FieldData): Promise<void>;
|
|
84
|
+
}>;
|
|
85
|
+
export {};
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { useCartStore } from "./Cart.js";
|
|
2
|
+
import { defineStore } from "pinia";
|
|
3
|
+
import { useApi } from "../utils/api.js";
|
|
4
|
+
export const useCheckoutStore = defineStore("checkout", {
|
|
5
|
+
state: () => ({
|
|
6
|
+
publishableKey: {},
|
|
7
|
+
responseData: [],
|
|
8
|
+
config: {},
|
|
9
|
+
checkoutSession: {},
|
|
10
|
+
errorResponseData: {},
|
|
11
|
+
checkCustomer: {},
|
|
12
|
+
stripeElemets: {},
|
|
13
|
+
orderData: {},
|
|
14
|
+
PaymentErrors: {},
|
|
15
|
+
loading: false
|
|
16
|
+
}),
|
|
17
|
+
actions: {
|
|
18
|
+
resetState() {
|
|
19
|
+
this.publishableKey = {};
|
|
20
|
+
this.responseData = [];
|
|
21
|
+
this.config = {};
|
|
22
|
+
this.checkoutSession = {};
|
|
23
|
+
this.errorResponseData = {};
|
|
24
|
+
this.checkCustomer = {};
|
|
25
|
+
this.stripeElemets = {};
|
|
26
|
+
this.orderData = {};
|
|
27
|
+
this.PaymentErrors = {};
|
|
28
|
+
this.loading = false;
|
|
29
|
+
},
|
|
30
|
+
async paymentMethods(formData) {
|
|
31
|
+
try {
|
|
32
|
+
const sessionData = JSON.parse(localStorage.getItem("Checkout")) || {};
|
|
33
|
+
const apiUrl = `/api/checkout/paymentmethod`;
|
|
34
|
+
const response = await $fetch(apiUrl, {
|
|
35
|
+
method: "POST",
|
|
36
|
+
body: formData
|
|
37
|
+
});
|
|
38
|
+
if (response?.data) {
|
|
39
|
+
this.publishableKey = response.data;
|
|
40
|
+
const cart = {
|
|
41
|
+
items: useCartStore().cart.items,
|
|
42
|
+
totals: useCartStore().cart.totals
|
|
43
|
+
};
|
|
44
|
+
const paymentMethod = formData.paymentmethod;
|
|
45
|
+
if (paymentMethod === "web-eway") {
|
|
46
|
+
} else if (paymentMethod === "web-flowrix-pay") {
|
|
47
|
+
} else if (paymentMethod === "web-stripe") {
|
|
48
|
+
} else if (paymentMethod === "web-paypal") {
|
|
49
|
+
} else if (paymentMethod === "web-direct-deposit") {
|
|
50
|
+
} else if (paymentMethod === "web-zippay") {
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
this.checkoutSession.fields = {
|
|
54
|
+
...this.checkoutSession.fields,
|
|
55
|
+
paymentmethod: formData.paymentmethod
|
|
56
|
+
};
|
|
57
|
+
return response;
|
|
58
|
+
} catch (error) {
|
|
59
|
+
this.errorResponseData = error?.data || {};
|
|
60
|
+
return error;
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
async getConfig() {
|
|
64
|
+
try {
|
|
65
|
+
const { post } = useApi();
|
|
66
|
+
const formData = this.checkoutSession.fields || this.checkoutSession;
|
|
67
|
+
if (formData.cart && Object.keys(formData.cart).length > 0) {
|
|
68
|
+
const samples = Object.keys(formData.cart).filter(
|
|
69
|
+
(key) => formData.cart[key].product_type === "sample"
|
|
70
|
+
);
|
|
71
|
+
if (samples.length > 0) {
|
|
72
|
+
samples.forEach(
|
|
73
|
+
(key) => formData.cart[key].id = formData.cart[key].pid
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
formData.vouchercodes = [];
|
|
78
|
+
if (useCartStore().coupon?.length > 0) {
|
|
79
|
+
formData.vouchercodes = useCartStore().coupon;
|
|
80
|
+
}
|
|
81
|
+
formData.cart = useCartStore().cart.items;
|
|
82
|
+
formData.abndToken = useCartStore().cart.abndToken;
|
|
83
|
+
const apiUrl = `checkout/configs`;
|
|
84
|
+
const response = await post(apiUrl, formData);
|
|
85
|
+
if (response?.data) {
|
|
86
|
+
this.config = response.data;
|
|
87
|
+
const shippingMethods = response.data.shippingmethods;
|
|
88
|
+
const shippingMethod = shippingMethods?.find(
|
|
89
|
+
(method) => method.selected === true
|
|
90
|
+
);
|
|
91
|
+
const deliveryMethods = response.data.preferences;
|
|
92
|
+
const deliveryMethod = deliveryMethods?.find(
|
|
93
|
+
(method) => method.selected === true
|
|
94
|
+
);
|
|
95
|
+
if (shippingMethod) {
|
|
96
|
+
this.checkoutSession.fields = {
|
|
97
|
+
...this.checkoutSession.fields,
|
|
98
|
+
shippingmethod: shippingMethod.id
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
if (deliveryMethod) {
|
|
102
|
+
this.checkoutSession.fields = {
|
|
103
|
+
...this.checkoutSession.fields,
|
|
104
|
+
deliverymethod: deliveryMethod.id
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
const cart = {
|
|
108
|
+
items: response.data.cart,
|
|
109
|
+
totals: response.data.calculations
|
|
110
|
+
};
|
|
111
|
+
useCartStore().cart.items = cart.items;
|
|
112
|
+
useCartStore().cart.totals = cart.totals;
|
|
113
|
+
this.config.totals = response.data.calculations;
|
|
114
|
+
this.checkoutSession.calculations = response.data.calculations;
|
|
115
|
+
}
|
|
116
|
+
} catch (error) {
|
|
117
|
+
this.errorResponseData = error?.data || {};
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
async submitCheckout() {
|
|
121
|
+
try {
|
|
122
|
+
this.loading = true;
|
|
123
|
+
const { post } = useApi();
|
|
124
|
+
const formData = this.checkoutSession.fields || {};
|
|
125
|
+
const apiUrl = `customer/checkout`;
|
|
126
|
+
formData.billing_address2 = formData.billing_address;
|
|
127
|
+
const response = await post(apiUrl, formData);
|
|
128
|
+
if (response?.data?.order || response?.data?.order_no) {
|
|
129
|
+
const orderData = response.data.order || response.data;
|
|
130
|
+
const invoiceId = orderData.order_no;
|
|
131
|
+
this.responseData = response.data;
|
|
132
|
+
this.checkoutSession.fields = {
|
|
133
|
+
...this.checkoutSession.fields,
|
|
134
|
+
invoice: invoiceId
|
|
135
|
+
};
|
|
136
|
+
this.orderData = orderData;
|
|
137
|
+
const cart = {
|
|
138
|
+
items: useCartStore().cart.items,
|
|
139
|
+
totals: useCartStore().cart.totals
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
this.loading = false;
|
|
143
|
+
return response;
|
|
144
|
+
} catch (error) {
|
|
145
|
+
this.errorResponseData = error?.data || {};
|
|
146
|
+
this.checkoutSession.fields = {
|
|
147
|
+
...this.checkoutSession.fields,
|
|
148
|
+
invoice: error?.data?.data?.order_no
|
|
149
|
+
};
|
|
150
|
+
this.loading = false;
|
|
151
|
+
return error;
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
async confirmPayment(checkoutId) {
|
|
155
|
+
try {
|
|
156
|
+
const apiUrl = `/api/checkout/success`;
|
|
157
|
+
await $fetch(apiUrl, {
|
|
158
|
+
method: "POST",
|
|
159
|
+
body: { token: checkoutId }
|
|
160
|
+
});
|
|
161
|
+
} catch (error) {
|
|
162
|
+
console.error("Error confirming payment:", error);
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
async CheckUserAccount(email) {
|
|
166
|
+
try {
|
|
167
|
+
this.loading = true;
|
|
168
|
+
const apiUrl = `/api/customer/search`;
|
|
169
|
+
const response = await $fetch(apiUrl, {
|
|
170
|
+
method: "POST",
|
|
171
|
+
body: { email }
|
|
172
|
+
});
|
|
173
|
+
this.checkCustomer = response;
|
|
174
|
+
this.loading = false;
|
|
175
|
+
return response;
|
|
176
|
+
} catch (error) {
|
|
177
|
+
this.checkCustomer = error?.data;
|
|
178
|
+
this.loading = false;
|
|
179
|
+
return error?.data;
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
async saveToCheckoutSession(fieldsData) {
|
|
183
|
+
this.loading = true;
|
|
184
|
+
fieldsData.firstname = fieldsData.billing_firstname ?? void 0;
|
|
185
|
+
fieldsData.lastname = fieldsData.billing_lastname ?? void 0;
|
|
186
|
+
fieldsData.mobile = fieldsData.billing_mobile ?? void 0;
|
|
187
|
+
fieldsData.fullname = `${fieldsData.billing_firstname} ${fieldsData.billing_lastname}`;
|
|
188
|
+
fieldsData.billing_fullname = `${fieldsData.billing_firstname} ${fieldsData.billing_lastname}`;
|
|
189
|
+
fieldsData.shipping_fullname = `${fieldsData.billing_firstname} ${fieldsData.billing_lastname}`;
|
|
190
|
+
if (fieldsData.shippingasbilling === true) {
|
|
191
|
+
fieldsData.billing_address = fieldsData.shipping_address ?? void 0;
|
|
192
|
+
fieldsData.billing_country = fieldsData.shipping_country ?? null;
|
|
193
|
+
fieldsData.billing_state = fieldsData.shipping_state ?? void 0;
|
|
194
|
+
fieldsData.billing_suburb = fieldsData.shipping_suburb ?? void 0;
|
|
195
|
+
fieldsData.billing_firstname = fieldsData.shipping_firstname ?? void 0;
|
|
196
|
+
fieldsData.billing_fullname = fieldsData.shipping_fullname ?? null;
|
|
197
|
+
fieldsData.billing_lastname = fieldsData.shipping_lastname ?? void 0;
|
|
198
|
+
fieldsData.billing_middlename = fieldsData.shipping_middlename ?? void 0;
|
|
199
|
+
fieldsData.billing_mobile = fieldsData.shipping_mobile ?? void 0;
|
|
200
|
+
fieldsData.billing_postcode = fieldsData.shipping_postcode ?? void 0;
|
|
201
|
+
}
|
|
202
|
+
this.checkoutSession.fields = {
|
|
203
|
+
...this.checkoutSession.fields,
|
|
204
|
+
...fieldsData
|
|
205
|
+
};
|
|
206
|
+
this.errorResponseData = {};
|
|
207
|
+
if (!fieldsData.quotation_no) {
|
|
208
|
+
await this.getConfig();
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
persist: true
|
|
213
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface LocationData {
|
|
2
|
+
city?: string;
|
|
3
|
+
country_name?: string;
|
|
4
|
+
country_code?: string;
|
|
5
|
+
country_id?: number;
|
|
6
|
+
ip?: string;
|
|
7
|
+
proxy?: boolean;
|
|
8
|
+
region?: string;
|
|
9
|
+
region_short?: string;
|
|
10
|
+
region_id?: number;
|
|
11
|
+
zip_code?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const useIpLocation: import("pinia").StoreDefinition<"IpLocation", {
|
|
14
|
+
location: LocationData | null;
|
|
15
|
+
}, {}, {
|
|
16
|
+
getLocation(): Promise<void>;
|
|
17
|
+
}>;
|
|
18
|
+
export {};
|