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,165 @@
|
|
|
1
|
+
import { useCompanyProfile } from "../stores/useCompanyProfile.js";
|
|
2
|
+
const getTtq = () => {
|
|
3
|
+
if (process.client && typeof window !== "undefined" && window.ttq) {
|
|
4
|
+
return window.ttq;
|
|
5
|
+
}
|
|
6
|
+
return null;
|
|
7
|
+
};
|
|
8
|
+
export function TikTok_page_view(to) {
|
|
9
|
+
const ttq = getTtq();
|
|
10
|
+
if (ttq) {
|
|
11
|
+
ttq.page();
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export function TikTok_view_item(product, price = 0, rp = 0) {
|
|
15
|
+
const ttq = getTtq();
|
|
16
|
+
if (!ttq || !product) return;
|
|
17
|
+
let discount = rp > price ? Number((rp - price).toFixed(2)) : 0;
|
|
18
|
+
ttq.track("ViewContent", {
|
|
19
|
+
type: "product",
|
|
20
|
+
contents: [{
|
|
21
|
+
content_id: "SKU_" + product?.sku,
|
|
22
|
+
content_type: "product",
|
|
23
|
+
quantity: 1,
|
|
24
|
+
description: product?.category,
|
|
25
|
+
content_name: product?.name,
|
|
26
|
+
price: Number(rp) > 0 ? Number(rp) : Number(price),
|
|
27
|
+
currency: useCompanyProfile().profile?.currencyCode,
|
|
28
|
+
value: price
|
|
29
|
+
}]
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
export function TikTok_add_to_cart(lastitem = "") {
|
|
33
|
+
const ttq = getTtq();
|
|
34
|
+
if (!ttq || !lastitem) return;
|
|
35
|
+
let price = lastitem.pricefloat;
|
|
36
|
+
let discount = lastitem.rpfloat > lastitem.pricefloat ? Number((lastitem.rpfloat - lastitem.pricefloat).toFixed(2)) : 0;
|
|
37
|
+
const ecomarceCartItems = [{
|
|
38
|
+
content_id: "SKU_" + lastitem.sku,
|
|
39
|
+
content_type: "product",
|
|
40
|
+
content_name: lastitem.name,
|
|
41
|
+
price,
|
|
42
|
+
quantity: 1,
|
|
43
|
+
discount,
|
|
44
|
+
location_id: "online store"
|
|
45
|
+
}];
|
|
46
|
+
ttq.track("AddToCart", {
|
|
47
|
+
contents: ecomarceCartItems,
|
|
48
|
+
value: price,
|
|
49
|
+
currency: useCompanyProfile().profile?.currencyCode
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
export function TikTok_view_cart(cart = "") {
|
|
53
|
+
const ttq = getTtq();
|
|
54
|
+
if (!ttq || !cart?.items) return;
|
|
55
|
+
const ecomarceCartItems = Object.values(cart.items).map((item) => {
|
|
56
|
+
let price = item.pricefloat;
|
|
57
|
+
let discount = item.rpfloat > item.pricefloat ? Number((item.rpfloat - item.pricefloat).toFixed(2)) : 0;
|
|
58
|
+
return {
|
|
59
|
+
content_id: "SKU_" + item.sku,
|
|
60
|
+
content_name: item.name,
|
|
61
|
+
content_type: "product",
|
|
62
|
+
quantity: item.qty,
|
|
63
|
+
price,
|
|
64
|
+
discount,
|
|
65
|
+
item_category: item.category
|
|
66
|
+
};
|
|
67
|
+
});
|
|
68
|
+
ttq.track("ViewCart", {
|
|
69
|
+
contents: ecomarceCartItems,
|
|
70
|
+
value: cart.totals.total,
|
|
71
|
+
currency: useCompanyProfile().profile?.currencyCode
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
export function TikTok_remove_from_cart(lastitem = "") {
|
|
75
|
+
const ttq = getTtq();
|
|
76
|
+
if (!ttq || !lastitem) return;
|
|
77
|
+
let price = lastitem.pricefloat;
|
|
78
|
+
let discount = lastitem.rpfloat > lastitem.pricefloat ? Number((lastitem.rpfloat - lastitem.pricefloat).toFixed(2)) : 0;
|
|
79
|
+
const ecomarceCartItems = [{
|
|
80
|
+
content_id: "SKU_" + lastitem.sku,
|
|
81
|
+
content_type: "product",
|
|
82
|
+
content_name: lastitem.name,
|
|
83
|
+
price,
|
|
84
|
+
quantity: lastitem.qty || 1,
|
|
85
|
+
discount,
|
|
86
|
+
location_id: "online store"
|
|
87
|
+
}];
|
|
88
|
+
ttq.track("RemoveFromCart", {
|
|
89
|
+
contents: ecomarceCartItems,
|
|
90
|
+
value: price,
|
|
91
|
+
currency: useCompanyProfile().profile?.currencyCode
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
export function TikTok_begin_checkout(cart = "") {
|
|
95
|
+
const ttq = getTtq();
|
|
96
|
+
if (!ttq || !cart?.items) return;
|
|
97
|
+
const ecomarceCartItems = Object.values(cart.items).map((item) => {
|
|
98
|
+
let price = item.pricefloat;
|
|
99
|
+
let discount = item.rpfloat > item.pricefloat ? Number((item.rpfloat - item.pricefloat).toFixed(2)) : 0;
|
|
100
|
+
return {
|
|
101
|
+
content_id: "SKU_" + item.sku,
|
|
102
|
+
content_name: item.name,
|
|
103
|
+
content_type: "product",
|
|
104
|
+
quantity: item.qty,
|
|
105
|
+
price,
|
|
106
|
+
discount,
|
|
107
|
+
item_category: item.category
|
|
108
|
+
};
|
|
109
|
+
});
|
|
110
|
+
ttq.track("InitiateCheckout", {
|
|
111
|
+
contents: ecomarceCartItems,
|
|
112
|
+
value: cart.totals.total,
|
|
113
|
+
currency: useCompanyProfile().profile?.currencyCode
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
export function TikTok_add_payment_info(cart = "", payment_type = "") {
|
|
117
|
+
const ttq = getTtq();
|
|
118
|
+
if (!ttq || !cart?.items) return;
|
|
119
|
+
const ecomarceCartItems = Object.values(cart.items).map((item) => {
|
|
120
|
+
let price = item.pricefloat;
|
|
121
|
+
let discount = item.rpfloat > item.pricefloat ? Number((item.rpfloat - item.pricefloat).toFixed(2)) : 0;
|
|
122
|
+
return {
|
|
123
|
+
content_id: "SKU_" + item.sku,
|
|
124
|
+
content_name: item.name,
|
|
125
|
+
content_type: "product",
|
|
126
|
+
quantity: item.qty,
|
|
127
|
+
price,
|
|
128
|
+
discount,
|
|
129
|
+
item_category: item.category
|
|
130
|
+
};
|
|
131
|
+
});
|
|
132
|
+
ttq.track("AddPaymentInfo", {
|
|
133
|
+
contents: ecomarceCartItems,
|
|
134
|
+
payment_type,
|
|
135
|
+
value: cart.totals.total,
|
|
136
|
+
currency: useCompanyProfile().profile?.currencyCode
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
export function TikTok_purchase(orderData = "", cart = "") {
|
|
140
|
+
const ttq = getTtq();
|
|
141
|
+
if (!ttq || !cart?.items || !orderData) return;
|
|
142
|
+
const purchaseitems = Object.values(cart.items).map((item) => {
|
|
143
|
+
let price = item.pricefloat;
|
|
144
|
+
let discount = item.rpfloat > item.pricefloat ? Number((item.rpfloat - item.pricefloat).toFixed(2)) : 0;
|
|
145
|
+
return {
|
|
146
|
+
content_id: "SKU_" + item.sku,
|
|
147
|
+
content_name: item.name,
|
|
148
|
+
content_type: "product",
|
|
149
|
+
quantity: item.qty,
|
|
150
|
+
price,
|
|
151
|
+
discount,
|
|
152
|
+
item_category: item.category
|
|
153
|
+
};
|
|
154
|
+
});
|
|
155
|
+
ttq.track("Purchase", {
|
|
156
|
+
contents: purchaseitems,
|
|
157
|
+
value: orderData.grandtotalFloat,
|
|
158
|
+
currency: useCompanyProfile().profile?.currencyCode,
|
|
159
|
+
transaction_id: orderData.order_no,
|
|
160
|
+
affiliation: "online Store",
|
|
161
|
+
tax: orderData.tax,
|
|
162
|
+
shipping: orderData.shipping,
|
|
163
|
+
coupon: orderData.vouchercode
|
|
164
|
+
});
|
|
165
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type WebForm, type WebFormData } from '../stores/webforms.js';
|
|
2
|
+
export interface ApiResponse<T> {
|
|
3
|
+
status: string;
|
|
4
|
+
message: string | Record<string, string[]> | null;
|
|
5
|
+
data: T | null;
|
|
6
|
+
}
|
|
7
|
+
export declare function useWebforms(): {
|
|
8
|
+
fetchWebform: (id: number) => Promise<ApiResponse<WebForm>>;
|
|
9
|
+
submitInquiry: (formData: WebFormData, recaptchaToken?: string) => Promise<ApiResponse<any>>;
|
|
10
|
+
webform: import("vue").ComputedRef<{
|
|
11
|
+
id: number;
|
|
12
|
+
} | null>;
|
|
13
|
+
webFormReturn: import("vue").ComputedRef<any>;
|
|
14
|
+
loading: import("vue").ComputedRef<boolean>;
|
|
15
|
+
error: import("vue").ComputedRef<string | null>;
|
|
16
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { computed } from "vue";
|
|
2
|
+
import { useWebformsStore } from "../stores/webforms.js";
|
|
3
|
+
import { useApi } from "../utils/api.js";
|
|
4
|
+
function formatErrorMessage(message) {
|
|
5
|
+
if (!message) return "An error occurred";
|
|
6
|
+
if (typeof message === "string") {
|
|
7
|
+
return message;
|
|
8
|
+
}
|
|
9
|
+
const errorMessages = [];
|
|
10
|
+
for (const [field, errors] of Object.entries(message)) {
|
|
11
|
+
if (Array.isArray(errors)) {
|
|
12
|
+
errorMessages.push(...errors);
|
|
13
|
+
} else {
|
|
14
|
+
errorMessages.push(String(errors));
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return errorMessages.join(", ");
|
|
18
|
+
}
|
|
19
|
+
export function useWebforms() {
|
|
20
|
+
const store = useWebformsStore();
|
|
21
|
+
const { get, post } = useApi();
|
|
22
|
+
async function fetchWebform(id) {
|
|
23
|
+
store.setLoading(true);
|
|
24
|
+
store.setError(null);
|
|
25
|
+
try {
|
|
26
|
+
const response = await get(`contact-center/webforms/${id}/details`);
|
|
27
|
+
if (response.status === "Success" && response.data) {
|
|
28
|
+
store.setWebform(response.data);
|
|
29
|
+
return response;
|
|
30
|
+
} else {
|
|
31
|
+
const errorMessage = formatErrorMessage(response.message);
|
|
32
|
+
store.setError(errorMessage);
|
|
33
|
+
throw new Error(errorMessage);
|
|
34
|
+
}
|
|
35
|
+
} catch (error) {
|
|
36
|
+
console.error("Fetch webform error:", error);
|
|
37
|
+
const errorMessage = error.data ? formatErrorMessage(error.data.message) : error.message || "Failed to fetch webform";
|
|
38
|
+
store.setError(errorMessage);
|
|
39
|
+
throw new Error(errorMessage);
|
|
40
|
+
} finally {
|
|
41
|
+
store.setLoading(false);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
async function submitInquiry(formData, recaptchaToken = "") {
|
|
45
|
+
store.setLoading(true);
|
|
46
|
+
store.setError(null);
|
|
47
|
+
try {
|
|
48
|
+
const data = { ...formData, recaptcha: recaptchaToken };
|
|
49
|
+
const response = await post("/contact-center/webforms/create", data);
|
|
50
|
+
if (response.status === "Success") {
|
|
51
|
+
store.setWebFormReturn(response);
|
|
52
|
+
return response;
|
|
53
|
+
} else {
|
|
54
|
+
const errorMessage = formatErrorMessage(response.message);
|
|
55
|
+
store.setError(errorMessage);
|
|
56
|
+
throw new Error(errorMessage);
|
|
57
|
+
}
|
|
58
|
+
} catch (error) {
|
|
59
|
+
console.error("Submit inquiry error:", error);
|
|
60
|
+
const errorMessage = error.data ? formatErrorMessage(error.data.message) : error.message || "Failed to submit inquiry";
|
|
61
|
+
store.setError(errorMessage);
|
|
62
|
+
throw new Error(errorMessage);
|
|
63
|
+
} finally {
|
|
64
|
+
store.setLoading(false);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
fetchWebform,
|
|
69
|
+
submitInquiry,
|
|
70
|
+
webform: computed(() => store.webform),
|
|
71
|
+
webFormReturn: computed(() => store.webFormReturn),
|
|
72
|
+
loading: computed(() => store.loading),
|
|
73
|
+
error: computed(() => store.error)
|
|
74
|
+
};
|
|
75
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type Wishlist, type WishlistProduct } from '../stores/wishlists.js';
|
|
2
|
+
export interface ApiResponse<T> {
|
|
3
|
+
status: string;
|
|
4
|
+
message: string | Record<string, string[]> | null;
|
|
5
|
+
data: T | null;
|
|
6
|
+
}
|
|
7
|
+
export interface CreateWishlistData {
|
|
8
|
+
title: string;
|
|
9
|
+
default: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface UpdateWishlistData {
|
|
12
|
+
title: string;
|
|
13
|
+
default: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface AddToWishlistData {
|
|
16
|
+
}
|
|
17
|
+
export declare function useWishlists(): {
|
|
18
|
+
fetchWishlists: () => Promise<ApiResponse<Wishlist[]>>;
|
|
19
|
+
fetchWishlistProducts: (listId: number) => Promise<ApiResponse<{
|
|
20
|
+
id: number;
|
|
21
|
+
title: string;
|
|
22
|
+
default: boolean;
|
|
23
|
+
created_at: string;
|
|
24
|
+
products: WishlistProduct[];
|
|
25
|
+
}>>;
|
|
26
|
+
createWishlist: (data: CreateWishlistData) => Promise<ApiResponse<Wishlist>>;
|
|
27
|
+
addToWishlist: (listId: number, productSlug: string, data?: AddToWishlistData) => Promise<ApiResponse<WishlistProduct>>;
|
|
28
|
+
removeFromWishlist: (listId: number, productSlug: string) => Promise<ApiResponse<void>>;
|
|
29
|
+
updateWishlist: (id: number, data: UpdateWishlistData) => Promise<ApiResponse<Wishlist>>;
|
|
30
|
+
deleteWishlist: (id: number) => Promise<ApiResponse<void>>;
|
|
31
|
+
wishlists: import("vue").ComputedRef<{
|
|
32
|
+
id: number;
|
|
33
|
+
name?: string | undefined;
|
|
34
|
+
}[]>;
|
|
35
|
+
wishlistProducts: import("vue").ComputedRef<import("../stores/index.js").WishlistProducts>;
|
|
36
|
+
loading: import("vue").ComputedRef<boolean>;
|
|
37
|
+
error: import("vue").ComputedRef<string | null>;
|
|
38
|
+
};
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { computed } from "vue";
|
|
2
|
+
import { useWishlistsStore } from "../stores/wishlists.js";
|
|
3
|
+
import { useApi } from "../utils/api.js";
|
|
4
|
+
function formatErrorMessage(message) {
|
|
5
|
+
if (!message) return "An error occurred";
|
|
6
|
+
if (typeof message === "string") {
|
|
7
|
+
return message;
|
|
8
|
+
}
|
|
9
|
+
const errorMessages = [];
|
|
10
|
+
for (const [field, errors] of Object.entries(message)) {
|
|
11
|
+
if (Array.isArray(errors)) {
|
|
12
|
+
errorMessages.push(...errors);
|
|
13
|
+
} else {
|
|
14
|
+
errorMessages.push(String(errors));
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return errorMessages.join(", ");
|
|
18
|
+
}
|
|
19
|
+
export function useWishlists() {
|
|
20
|
+
const store = useWishlistsStore();
|
|
21
|
+
const { get, post } = useApi();
|
|
22
|
+
async function fetchWishlists() {
|
|
23
|
+
store.setLoading(true);
|
|
24
|
+
store.setError(null);
|
|
25
|
+
try {
|
|
26
|
+
const response = await get("/customer/wishlist");
|
|
27
|
+
if (response.status === "Success" && response.data) {
|
|
28
|
+
store.setWishlists(response.data);
|
|
29
|
+
return response;
|
|
30
|
+
} else {
|
|
31
|
+
const errorMessage = formatErrorMessage(response.message);
|
|
32
|
+
store.setError(errorMessage);
|
|
33
|
+
throw new Error(errorMessage);
|
|
34
|
+
}
|
|
35
|
+
} catch (error) {
|
|
36
|
+
console.error("Fetch wishlists error:", error);
|
|
37
|
+
const errorMessage = error.data ? formatErrorMessage(error.data.message) : error.message || "Failed to fetch wishlists";
|
|
38
|
+
store.setError(errorMessage);
|
|
39
|
+
throw new Error(errorMessage);
|
|
40
|
+
} finally {
|
|
41
|
+
store.setLoading(false);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
async function fetchWishlistProducts(listId) {
|
|
45
|
+
store.setLoading(true);
|
|
46
|
+
store.setError(null);
|
|
47
|
+
try {
|
|
48
|
+
const response = await get(`/customer/wishlist/${listId}/products`);
|
|
49
|
+
if (response.status === "Success" && response.data) {
|
|
50
|
+
const products = response.data.products || [];
|
|
51
|
+
store.setWishlistProducts(listId, products);
|
|
52
|
+
return response;
|
|
53
|
+
} else {
|
|
54
|
+
const errorMessage = formatErrorMessage(response.message);
|
|
55
|
+
store.setError(errorMessage);
|
|
56
|
+
throw new Error(errorMessage);
|
|
57
|
+
}
|
|
58
|
+
} catch (error) {
|
|
59
|
+
console.error("Fetch wishlist products error:", error);
|
|
60
|
+
const errorMessage = error.data ? formatErrorMessage(error.data.message) : error.message || "Failed to fetch wishlist products";
|
|
61
|
+
store.setError(errorMessage);
|
|
62
|
+
throw new Error(errorMessage);
|
|
63
|
+
} finally {
|
|
64
|
+
store.setLoading(false);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
async function createWishlist(data) {
|
|
68
|
+
store.setLoading(true);
|
|
69
|
+
store.setError(null);
|
|
70
|
+
try {
|
|
71
|
+
const response = await post("/customer/wishlist/add", data);
|
|
72
|
+
if (response.status === "Success" && response.data) {
|
|
73
|
+
store.addWishlist(response.data);
|
|
74
|
+
return response;
|
|
75
|
+
} else {
|
|
76
|
+
const errorMessage = formatErrorMessage(response.message);
|
|
77
|
+
store.setError(errorMessage);
|
|
78
|
+
throw new Error(errorMessage);
|
|
79
|
+
}
|
|
80
|
+
} catch (error) {
|
|
81
|
+
console.error("Create wishlist error:", error);
|
|
82
|
+
const errorMessage = error.data ? formatErrorMessage(error.data.message) : error.message || "Failed to create wishlist";
|
|
83
|
+
store.setError(errorMessage);
|
|
84
|
+
throw new Error(errorMessage);
|
|
85
|
+
} finally {
|
|
86
|
+
store.setLoading(false);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
async function addToWishlist(listId, productSlug, data = {}) {
|
|
90
|
+
store.setLoading(true);
|
|
91
|
+
store.setError(null);
|
|
92
|
+
try {
|
|
93
|
+
const response = await post(`/customer/wishlist/${listId}/${productSlug}/add`, data);
|
|
94
|
+
if (response.status === "Success" && response.data) {
|
|
95
|
+
store.addWishlistProduct(listId, response.data);
|
|
96
|
+
return response;
|
|
97
|
+
} else {
|
|
98
|
+
const errorMessage = formatErrorMessage(response.message);
|
|
99
|
+
store.setError(errorMessage);
|
|
100
|
+
throw new Error(errorMessage);
|
|
101
|
+
}
|
|
102
|
+
} catch (error) {
|
|
103
|
+
console.error("Add to wishlist error:", error);
|
|
104
|
+
const errorMessage = error.data ? formatErrorMessage(error.data.message) : error.message || "Failed to add to wishlist";
|
|
105
|
+
store.setError(errorMessage);
|
|
106
|
+
throw new Error(errorMessage);
|
|
107
|
+
} finally {
|
|
108
|
+
store.setLoading(false);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
async function removeFromWishlist(listId, productSlug) {
|
|
112
|
+
store.setLoading(true);
|
|
113
|
+
store.setError(null);
|
|
114
|
+
try {
|
|
115
|
+
const response = await post(`/customer/wishlist/${listId}/item/delete`, { ids: { productSlug } });
|
|
116
|
+
if (response.status === "Success") {
|
|
117
|
+
store.removeWishlistProduct(listId, productSlug);
|
|
118
|
+
return response;
|
|
119
|
+
} else {
|
|
120
|
+
const errorMessage = formatErrorMessage(response.message);
|
|
121
|
+
store.setError(errorMessage);
|
|
122
|
+
throw new Error(errorMessage);
|
|
123
|
+
}
|
|
124
|
+
} catch (error) {
|
|
125
|
+
console.error("Remove from wishlist error:", error);
|
|
126
|
+
const errorMessage = error.data ? formatErrorMessage(error.data.message) : error.message || "Failed to remove from wishlist";
|
|
127
|
+
store.setError(errorMessage);
|
|
128
|
+
throw new Error(errorMessage);
|
|
129
|
+
} finally {
|
|
130
|
+
store.setLoading(false);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
async function updateWishlist(id, data) {
|
|
134
|
+
store.setLoading(true);
|
|
135
|
+
store.setError(null);
|
|
136
|
+
try {
|
|
137
|
+
const response = await post(`/customer/wishlist/${id}/update`, data);
|
|
138
|
+
if (response.status === "Success" && response.data) {
|
|
139
|
+
store.updateWishlist(response.data);
|
|
140
|
+
return response;
|
|
141
|
+
} else {
|
|
142
|
+
const errorMessage = formatErrorMessage(response.message);
|
|
143
|
+
store.setError(errorMessage);
|
|
144
|
+
throw new Error(errorMessage);
|
|
145
|
+
}
|
|
146
|
+
} catch (error) {
|
|
147
|
+
console.error("Update wishlist error:", error);
|
|
148
|
+
const errorMessage = error.data ? formatErrorMessage(error.data.message) : error.message || "Failed to update wishlist";
|
|
149
|
+
store.setError(errorMessage);
|
|
150
|
+
throw new Error(errorMessage);
|
|
151
|
+
} finally {
|
|
152
|
+
store.setLoading(false);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
async function deleteWishlist(id) {
|
|
156
|
+
store.setLoading(true);
|
|
157
|
+
store.setError(null);
|
|
158
|
+
try {
|
|
159
|
+
const response = await post(`/customer/wishlist/${id}/delete`, {});
|
|
160
|
+
if (response.status === "Success") {
|
|
161
|
+
store.removeWishlist(id);
|
|
162
|
+
store.clearWishlistProducts(id);
|
|
163
|
+
return response;
|
|
164
|
+
} else {
|
|
165
|
+
const errorMessage = formatErrorMessage(response.message);
|
|
166
|
+
store.setError(errorMessage);
|
|
167
|
+
throw new Error(errorMessage);
|
|
168
|
+
}
|
|
169
|
+
} catch (error) {
|
|
170
|
+
console.error("Delete wishlist error:", error);
|
|
171
|
+
const errorMessage = error.data ? formatErrorMessage(error.data.message) : error.message || "Failed to delete wishlist";
|
|
172
|
+
store.setError(errorMessage);
|
|
173
|
+
throw new Error(errorMessage);
|
|
174
|
+
} finally {
|
|
175
|
+
store.setLoading(false);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
return {
|
|
179
|
+
fetchWishlists,
|
|
180
|
+
fetchWishlistProducts,
|
|
181
|
+
createWishlist,
|
|
182
|
+
addToWishlist,
|
|
183
|
+
removeFromWishlist,
|
|
184
|
+
updateWishlist,
|
|
185
|
+
deleteWishlist,
|
|
186
|
+
wishlists: computed(() => store.wishlists),
|
|
187
|
+
wishlistProducts: computed(() => store.wishlistProducts),
|
|
188
|
+
loading: computed(() => store.loading),
|
|
189
|
+
error: computed(() => store.error)
|
|
190
|
+
};
|
|
191
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const flowrixApi: {
|
|
2
|
+
get: (endpoint: any, options?: {}, apiversion?: string) => Promise<unknown>;
|
|
3
|
+
post: (endpoint: any, options?: {}, apiversion?: string) => Promise<unknown>;
|
|
4
|
+
put: (endpoint: any, options?: {}, apiversion?: string) => Promise<unknown>;
|
|
5
|
+
delete: (endpoint: any, options?: {}, apiversion?: string) => Promise<unknown>;
|
|
6
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const isServer = typeof process !== "undefined" && process.server;
|
|
2
|
+
function getEnv(key) {
|
|
3
|
+
if (typeof useRuntimeConfig === "function") {
|
|
4
|
+
const config = useRuntimeConfig();
|
|
5
|
+
return config.public?.[key] || config[key];
|
|
6
|
+
}
|
|
7
|
+
return process.env[key];
|
|
8
|
+
}
|
|
9
|
+
async function request(method, endpoint, options = {}, apiversion) {
|
|
10
|
+
const FLOWRIX_API_KEY = getEnv("FLOWRIX_API_KEY");
|
|
11
|
+
const FLOWRIX_API_SECRET = getEnv("FLOWRIX_API_SECRET");
|
|
12
|
+
const FLOWRIX_API_ORIGIN = getEnv("FLOWRIX_API_ORIGIN");
|
|
13
|
+
let FLOWRIX_API_BASE = getEnv("FLOWRIX_API_BASE");
|
|
14
|
+
if (apiversion == "v2") {
|
|
15
|
+
FLOWRIX_API_BASE = getEnv("FLOWRIX_API_BASE_V2");
|
|
16
|
+
}
|
|
17
|
+
const headers = {
|
|
18
|
+
"x-api-key": FLOWRIX_API_KEY,
|
|
19
|
+
"x-api-secret": FLOWRIX_API_SECRET,
|
|
20
|
+
"Origin": FLOWRIX_API_ORIGIN,
|
|
21
|
+
...options.headers
|
|
22
|
+
};
|
|
23
|
+
try {
|
|
24
|
+
const response = await $fetch(`${FLOWRIX_API_BASE}${endpoint}`, {
|
|
25
|
+
method,
|
|
26
|
+
...options,
|
|
27
|
+
headers
|
|
28
|
+
});
|
|
29
|
+
return response;
|
|
30
|
+
} catch (error) {
|
|
31
|
+
console.error(`[FLOWRIX ERROR] ${method.toUpperCase()} ${FLOWRIX_API_BASE}${endpoint}`, error);
|
|
32
|
+
throw error;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export const flowrixApi = {
|
|
36
|
+
get: (endpoint, options = {}, apiversion = "v1") => request("get", endpoint, options, apiversion),
|
|
37
|
+
post: (endpoint, options = {}, apiversion = "v1") => request("post", endpoint, options, apiversion),
|
|
38
|
+
put: (endpoint, options = {}, apiversion = "v1") => request("put", endpoint, options, apiversion),
|
|
39
|
+
delete: (endpoint, options = {}, apiversion = "v1") => request("delete", endpoint, options, apiversion)
|
|
40
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import piniaPluginPersistedstate from "pinia-plugin-persistedstate";
|
|
2
|
+
export default defineNuxtPlugin((nuxtApp) => {
|
|
3
|
+
if (nuxtApp?.$pinia) {
|
|
4
|
+
nuxtApp.$pinia.use(piniaPluginPersistedstate);
|
|
5
|
+
} else {
|
|
6
|
+
const { $pinia } = useNuxtApp();
|
|
7
|
+
if ($pinia) $pinia.use(piniaPluginPersistedstate);
|
|
8
|
+
}
|
|
9
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { defineEventHandler, setResponseStatus } from "h3";
|
|
2
|
+
import { $fetch } from "ofetch";
|
|
3
|
+
export default defineEventHandler(async (event) => {
|
|
4
|
+
try {
|
|
5
|
+
const albums = await $fetch(`${process.env.FLOWRIX_API_BASE}albums`, {
|
|
6
|
+
method: "GET",
|
|
7
|
+
headers: {
|
|
8
|
+
"x-api-key": process.env.FLOWRIX_API_KEY,
|
|
9
|
+
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
10
|
+
"Origin": process.env.FLOWRIX_API_ORIGIN
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
return albums;
|
|
14
|
+
} catch (error) {
|
|
15
|
+
setResponseStatus(event, 500);
|
|
16
|
+
return { success: false, error: error.message };
|
|
17
|
+
}
|
|
18
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { defineEventHandler, readBody, createError } from "h3";
|
|
2
|
+
export default defineEventHandler(async (event) => {
|
|
3
|
+
const body = await readBody(event);
|
|
4
|
+
const { email } = body;
|
|
5
|
+
try {
|
|
6
|
+
const response = await fetch(`${process.env.FLOWRIX_API_BASE}verify-email/`, {
|
|
7
|
+
method: "POST",
|
|
8
|
+
headers: {
|
|
9
|
+
"x-api-key": process.env.FLOWRIX_API_KEY,
|
|
10
|
+
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
11
|
+
"Origin": process.env.FLOWRIX_API_ORIGIN,
|
|
12
|
+
"Content-Type": "application/json"
|
|
13
|
+
},
|
|
14
|
+
body: JSON.stringify({ email })
|
|
15
|
+
});
|
|
16
|
+
if (!response.ok) {
|
|
17
|
+
let errorMessage = ``;
|
|
18
|
+
try {
|
|
19
|
+
const errorData = await response.json();
|
|
20
|
+
console.error("Error response data:", errorData.message);
|
|
21
|
+
if (errorData.message) {
|
|
22
|
+
errorMessage += errorData.message?.email || errorData.message;
|
|
23
|
+
}
|
|
24
|
+
} catch (parseError) {
|
|
25
|
+
errorMessage += "Failed to parse error details.";
|
|
26
|
+
}
|
|
27
|
+
throw createError({
|
|
28
|
+
status: 400,
|
|
29
|
+
statusMessage: "Bad Request",
|
|
30
|
+
message: "Invalid user input",
|
|
31
|
+
data: { field: "email" }
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
const data = await response.json();
|
|
35
|
+
return data;
|
|
36
|
+
} catch (error) {
|
|
37
|
+
throw createError({
|
|
38
|
+
status: 400,
|
|
39
|
+
statusMessage: "Bad Request",
|
|
40
|
+
message: "Invalid user input",
|
|
41
|
+
data: { field: "email" }
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface AuthUser {
|
|
2
|
+
id: string | number;
|
|
3
|
+
email: string;
|
|
4
|
+
firstName?: string;
|
|
5
|
+
lastName?: string;
|
|
6
|
+
}
|
|
7
|
+
declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<{
|
|
8
|
+
user: AuthUser;
|
|
9
|
+
token: string;
|
|
10
|
+
}>>;
|
|
11
|
+
export default _default;
|