flowrix 1.0.1-beta.85 → 1.0.1-beta.86
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/dist/module.d.mts +3 -0
- package/dist/module.json +9 -0
- package/dist/module.mjs +344 -0
- package/dist/runtime/composables/Blog/useBlogIndex.d.ts +108 -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 +47 -0
- package/dist/runtime/composables/Cart/useCart.d.ts +40 -0
- package/dist/runtime/composables/Cart/useCart.js +10 -0
- package/dist/runtime/composables/Cart/useCartDetail.d.ts +59 -0
- package/dist/runtime/composables/Cart/useCartDetail.js +51 -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/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 +52 -0
- package/dist/runtime/composables/Checkout/PaymentMethods/useFlowrixpay.js +155 -0
- package/dist/runtime/composables/Checkout/PaymentMethods/useOpayo.d.ts +48 -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 +135 -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/useCheckout.d.ts +197 -0
- package/dist/runtime/composables/Checkout/useCheckout.js +374 -0
- package/dist/runtime/composables/Checkout/useCheckoutBillingAddress.d.ts +43 -0
- package/dist/runtime/composables/Checkout/useCheckoutBillingAddress.js +84 -0
- package/dist/runtime/composables/Checkout/useCheckoutShippingAddress.d.ts +55 -0
- package/dist/runtime/composables/Checkout/useCheckoutShippingAddress.js +196 -0
- package/dist/runtime/composables/Checkout/useCreateAccount.d.ts +15 -0
- package/dist/runtime/composables/Checkout/useCreateAccount.js +63 -0
- package/dist/runtime/composables/Checkout/useDeliveryMethod.d.ts +4 -0
- package/dist/runtime/composables/Checkout/useDeliveryMethod.js +37 -0
- package/dist/runtime/composables/Customer/useBillingAddress.d.ts +112 -0
- package/dist/runtime/composables/Customer/useBillingAddress.js +93 -0
- package/dist/runtime/composables/Customer/useLogin.d.ts +9 -0
- package/dist/runtime/composables/Customer/useLogin.js +34 -0
- package/dist/runtime/composables/Customer/useOrders.d.ts +29 -0
- package/dist/runtime/composables/Customer/useOrders.js +56 -0
- package/dist/runtime/composables/Customer/usePasswordReset.d.ts +26 -0
- package/dist/runtime/composables/Customer/usePasswordReset.js +258 -0
- package/dist/runtime/composables/Customer/useProfile.d.ts +75 -0
- package/dist/runtime/composables/Customer/useProfile.js +106 -0
- package/dist/runtime/composables/Customer/useQuotations.d.ts +32 -0
- package/dist/runtime/composables/Customer/useQuotations.js +40 -0
- package/dist/runtime/composables/Customer/useRegister.d.ts +127 -0
- package/dist/runtime/composables/Customer/useRegister.js +325 -0
- package/dist/runtime/composables/Customer/useShippingAddress.d.ts +121 -0
- package/dist/runtime/composables/Customer/useShippingAddress.js +145 -0
- package/dist/runtime/composables/Customer/useUpdatePassword.d.ts +21 -0
- package/dist/runtime/composables/Customer/useUpdatePassword.js +94 -0
- package/dist/runtime/composables/Customer/useUserCards.d.ts +22 -0
- package/dist/runtime/composables/Customer/useUserCards.js +65 -0
- package/dist/runtime/composables/Customer/useWishlists.d.ts +25 -0
- package/dist/runtime/composables/Customer/useWishlists.js +183 -0
- package/dist/runtime/composables/Extras/useCountry.d.ts +11 -0
- package/dist/runtime/composables/Extras/useCountry.js +12 -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 +14 -0
- package/dist/runtime/composables/Header/useHeader.js +67 -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 +23 -0
- package/dist/runtime/composables/Product/useProductSlug.d.ts +8 -0
- package/dist/runtime/composables/Product/useProductSlug.js +25 -0
- package/dist/runtime/composables/Product/useQuickView.d.ts +8 -0
- package/dist/runtime/composables/Product/useQuickView.js +27 -0
- package/dist/runtime/composables/Product/useService.d.ts +17 -0
- package/dist/runtime/composables/Product/useService.js +64 -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 +78 -0
- package/dist/runtime/composables/index.js +78 -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 +111 -0
- package/dist/runtime/composables/useAddresses.d.ts +18 -0
- package/dist/runtime/composables/useAddresses.js +126 -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/useDataLayer.d.ts +18 -0
- package/dist/runtime/composables/useDataLayer.js +386 -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 +13 -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/useQuotationCheckout.d.ts +78 -0
- package/dist/runtime/composables/useQuotationCheckout.js +138 -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/middleware/flowrix.d.ts +7 -0
- package/dist/runtime/middleware/flowrix.js +60 -0
- package/dist/runtime/plugin.d.ts +2 -0
- package/dist/runtime/plugin.js +5 -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 +68 -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 +43 -0
- package/dist/runtime/server/api/brand/[...slug].d.ts +3 -0
- package/dist/runtime/server/api/brand/[...slug].js +60 -0
- package/dist/runtime/server/api/brand/index.d.ts +2 -0
- package/dist/runtime/server/api/brand/index.js +23 -0
- package/dist/runtime/server/api/cache/[...slug].delete.d.ts +2 -0
- package/dist/runtime/server/api/cache/[...slug].delete.js +40 -0
- package/dist/runtime/server/api/cache/clean.get.d.ts +5 -0
- package/dist/runtime/server/api/cache/clean.get.js +16 -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/related.d.ts +2 -0
- package/dist/runtime/server/api/cart/related.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 +46 -0
- package/dist/runtime/server/api/catalog/categoriesall.d.ts +3 -0
- package/dist/runtime/server/api/catalog/categoriesall.js +46 -0
- package/dist/runtime/server/api/catalog/featured.d.ts +3 -0
- package/dist/runtime/server/api/catalog/featured.js +44 -0
- package/dist/runtime/server/api/catalog/samples.d.ts +3 -0
- package/dist/runtime/server/api/catalog/samples.js +47 -0
- package/dist/runtime/server/api/catalog/search.d.ts +3 -0
- package/dist/runtime/server/api/catalog/search.js +47 -0
- package/dist/runtime/server/api/category/[...slug].d.ts +3 -0
- package/dist/runtime/server/api/category/[...slug].js +57 -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 +19 -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/checkout/quotation/[slug].d.ts +2 -0
- package/dist/runtime/server/api/checkout/quotation/[slug].js +21 -0
- package/dist/runtime/server/api/checkout/quotation/guest/[slug].d.ts +2 -0
- package/dist/runtime/server/api/checkout/quotation/guest/[slug].js +37 -0
- package/dist/runtime/server/api/checkout/quotation/guest/customer.d.ts +2 -0
- package/dist/runtime/server/api/checkout/quotation/guest/customer.js +21 -0
- package/dist/runtime/server/api/checkout/quotation/submit/[slug].d.ts +2 -0
- package/dist/runtime/server/api/checkout/quotation/submit/[slug].js +23 -0
- package/dist/runtime/server/api/cmspost/[...slug].d.ts +3 -0
- package/dist/runtime/server/api/cmspost/[...slug].js +51 -0
- package/dist/runtime/server/api/cmspost/all.d.ts +3 -0
- package/dist/runtime/server/api/cmspost/all.js +17 -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/countries.d.ts +2 -0
- package/dist/runtime/server/api/countries.js +37 -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/featured.d.ts +2 -0
- package/dist/runtime/server/api/featured.js +16 -0
- package/dist/runtime/server/api/generate/robots.get.d.ts +2 -0
- package/dist/runtime/server/api/generate/robots.get.js +20 -0
- package/dist/runtime/server/api/generate/sitemap.get.d.ts +2 -0
- package/dist/runtime/server/api/generate/sitemap.get.js +32 -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 +49 -0
- package/dist/runtime/server/api/quickview/[slug].d.ts +2 -0
- package/dist/runtime/server/api/quickview/[slug].js +16 -0
- package/dist/runtime/server/api/samples.d.ts +3 -0
- package/dist/runtime/server/api/samples.js +20 -0
- package/dist/runtime/server/api/search.d.ts +3 -0
- package/dist/runtime/server/api/search.js +15 -0
- package/dist/runtime/server/api/service/[slug].d.ts +3 -0
- package/dist/runtime/server/api/service/[slug].js +54 -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/service/getall.d.ts +3 -0
- package/dist/runtime/server/api/service/getall.js +54 -0
- package/dist/runtime/server/api/shop.d.ts +3 -0
- package/dist/runtime/server/api/shop.js +15 -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 +11 -0
- package/dist/runtime/server/api/webform.d.ts +3 -0
- package/dist/runtime/server/api/webform.js +16 -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 +79 -0
- package/dist/runtime/stores/Cart.js +309 -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 +79 -0
- package/dist/runtime/stores/Checkout.js +208 -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 +5 -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 +59 -0
- package/dist/runtime/stores/auth.js +441 -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 +8 -0
- package/dist/runtime/stores/countries.js +15 -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 +165 -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 +136 -0
- package/dist/runtime/stores/wishlists.js +249 -0
- package/dist/runtime/utils/api.d.ts +13 -0
- package/dist/runtime/utils/api.js +98 -0
- package/dist/runtime/utils/companyProfile.d.ts +22 -0
- package/dist/runtime/utils/companyProfile.js +21 -0
- package/dist/runtime/utils/htmlCache.d.ts +5 -0
- package/dist/runtime/utils/htmlCache.js +64 -0
- package/dist/types.d.mts +7 -0
- package/package.json +12 -1
- package/dist/module.d.cts +0 -2
|
@@ -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,7 @@
|
|
|
1
|
+
export declare const flowrixApi: {
|
|
2
|
+
get: (endpoint: any, config?: {}, options?: {}) => Promise<unknown>;
|
|
3
|
+
post: (endpoint: any, config?: {}, options?: {}) => Promise<unknown>;
|
|
4
|
+
put: (endpoint: any, config?: {}, options?: {}) => Promise<unknown>;
|
|
5
|
+
patch: (endpoint: any, config?: {}, options?: {}) => Promise<unknown>;
|
|
6
|
+
delete: (endpoint: any, config?: {}, options?: {}) => Promise<unknown>;
|
|
7
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
const isServer = typeof process !== "undefined" && process.server;
|
|
2
|
+
function getCookie(name) {
|
|
3
|
+
if (process.client) {
|
|
4
|
+
const value = `; ${document.cookie}`;
|
|
5
|
+
const parts = value.split(`; ${name}=`);
|
|
6
|
+
if (parts.length === 2) return parts.pop().split(";").shift();
|
|
7
|
+
return null;
|
|
8
|
+
} else {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
const parseCookies = (cookieString) => {
|
|
13
|
+
return Object.fromEntries(
|
|
14
|
+
cookieString.split(";").map((c) => {
|
|
15
|
+
const [key, ...v] = c.trim().split("=");
|
|
16
|
+
return [key, decodeURIComponent(v.join("="))];
|
|
17
|
+
})
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
async function request(method, config = {}, endpoint, options = {}) {
|
|
21
|
+
const FLOWRIX_API_KEY = config.public?.FLOWRIX_API_KEY || "";
|
|
22
|
+
const FLOWRIX_API_SECRET = config.public?.FLOWRIX_API_SECRET || "";
|
|
23
|
+
const FLOWRIX_API_ORIGIN = config.public?.FLOWRIX_API_ORIGIN || "";
|
|
24
|
+
let FLOWRIX_API_BASE = config.public?.FLOWRIX_API_BASE_V2 || "";
|
|
25
|
+
const cookiesObj = parseCookies(config.cookies || "");
|
|
26
|
+
const authToken = cookiesObj["authToken"];
|
|
27
|
+
const headers = {
|
|
28
|
+
"x-public-key": FLOWRIX_API_KEY,
|
|
29
|
+
"x-session-token": getCookie("x-session-token"),
|
|
30
|
+
"Access-Control-Expose-Headers": "x-session-token",
|
|
31
|
+
"authorization": `Bearer ${authToken}`,
|
|
32
|
+
"Origin": FLOWRIX_API_ORIGIN,
|
|
33
|
+
...options.headers
|
|
34
|
+
};
|
|
35
|
+
try {
|
|
36
|
+
const response = await $fetch(`${FLOWRIX_API_BASE}${endpoint}`, {
|
|
37
|
+
method,
|
|
38
|
+
...options,
|
|
39
|
+
headers,
|
|
40
|
+
onResponse({ response: response2 }) {
|
|
41
|
+
const token = response2.headers.get("x-session-token");
|
|
42
|
+
if (token) {
|
|
43
|
+
if (process.client) {
|
|
44
|
+
document.cookie = `x-session-token=${token}; path=/; max-age=3600; secure; SameSite=Lax`;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
return response;
|
|
50
|
+
} catch (error) {
|
|
51
|
+
throw error;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
export const flowrixApi = {
|
|
55
|
+
get: (endpoint, config = {}, options = {}) => request("get", config, endpoint, options),
|
|
56
|
+
post: (endpoint, config = {}, options = {}) => request("post", config, endpoint, options),
|
|
57
|
+
put: (endpoint, config = {}, options = {}) => request("put", config, endpoint, options),
|
|
58
|
+
patch: (endpoint, config = {}, options = {}) => request("patch", config, endpoint, options),
|
|
59
|
+
delete: (endpoint, config = {}, options = {}) => request("delete", config, endpoint, options)
|
|
60
|
+
};
|
|
@@ -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-public-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-public-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;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { defineEventHandler, readBody, createError } from "h3";
|
|
2
|
+
export default defineEventHandler(async (event) => {
|
|
3
|
+
try {
|
|
4
|
+
const body = await readBody(event);
|
|
5
|
+
const { email, password } = body;
|
|
6
|
+
if (!email || !password) {
|
|
7
|
+
throw createError({
|
|
8
|
+
statusCode: 400,
|
|
9
|
+
statusMessage: "Email and password are required"
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
console.log("Environment check:");
|
|
13
|
+
console.log("API_BASE:", process.env.FLOWRIX_API_KEY);
|
|
14
|
+
console.log("API_KEY present:", process.env.FLOWRIX_API_SECRET);
|
|
15
|
+
console.log("API_SECRET present:", process.env.FLOWRIX_API_ORIGIN);
|
|
16
|
+
const response = await fetch(`${process.env.FLOWRIX_API_BASE}login/`, {
|
|
17
|
+
method: "POST",
|
|
18
|
+
headers: {
|
|
19
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
20
|
+
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
21
|
+
"Origin": process.env.FLOWRIX_API_ORIGIN,
|
|
22
|
+
"Content-Type": "application/json"
|
|
23
|
+
},
|
|
24
|
+
body: JSON.stringify({ email, password })
|
|
25
|
+
});
|
|
26
|
+
if (!response.ok) {
|
|
27
|
+
let errorMessage = "Login failed";
|
|
28
|
+
try {
|
|
29
|
+
const errorData = await response.json();
|
|
30
|
+
console.error("Error response data:", errorData);
|
|
31
|
+
if (errorData.message) {
|
|
32
|
+
if (Array.isArray(errorData.message)) {
|
|
33
|
+
errorMessage = errorData.message.join(", ");
|
|
34
|
+
} else if (typeof errorData.message === "object") {
|
|
35
|
+
errorMessage = errorData.message.email || Object.values(errorData.message)[0] || errorMessage;
|
|
36
|
+
} else {
|
|
37
|
+
errorMessage = errorData.message;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
} catch (parseError) {
|
|
41
|
+
console.error("Failed to parse error response:", parseError);
|
|
42
|
+
errorMessage = `HTTP ${response.status}: ${response.statusText}`;
|
|
43
|
+
}
|
|
44
|
+
throw createError({
|
|
45
|
+
statusCode: response.status,
|
|
46
|
+
statusMessage: errorMessage
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
const data = await response.json();
|
|
50
|
+
let user;
|
|
51
|
+
let token;
|
|
52
|
+
user = data.data.user;
|
|
53
|
+
token = data.data.access_token;
|
|
54
|
+
return {
|
|
55
|
+
user,
|
|
56
|
+
token
|
|
57
|
+
};
|
|
58
|
+
} catch (error) {
|
|
59
|
+
console.error("Login error:", error);
|
|
60
|
+
if (error.statusCode || error.status) {
|
|
61
|
+
throw error;
|
|
62
|
+
}
|
|
63
|
+
throw createError({
|
|
64
|
+
statusCode: 500,
|
|
65
|
+
statusMessage: error.message || "Internal server error"
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { defineEventHandler, getCookie, deleteCookie } from "h3";
|
|
2
|
+
export default defineEventHandler(async (event) => {
|
|
3
|
+
const accessTok = getCookie(event, "auth.token");
|
|
4
|
+
try {
|
|
5
|
+
await $fetch(`${process.env.FLOWRIX_API_BASE}customer/logout`, {
|
|
6
|
+
method: "POST",
|
|
7
|
+
headers: {
|
|
8
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
9
|
+
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
10
|
+
"Origin": process.env.FLOWRIX_API_ORIGIN,
|
|
11
|
+
"Authorization": `Bearer ${accessTok || ""}`
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
deleteCookie(event, "auth.token");
|
|
15
|
+
deleteCookie(event, "auth.refreshToken");
|
|
16
|
+
deleteCookie(event, "auth.user");
|
|
17
|
+
deleteCookie(event, "auth.session");
|
|
18
|
+
return { success: true, message: "Logout successful" };
|
|
19
|
+
} catch (error) {
|
|
20
|
+
console.error("Error customer logout:", error);
|
|
21
|
+
return { success: false, message: "Logout failed" };
|
|
22
|
+
}
|
|
23
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { defineEventHandler, readBody } from "h3";
|
|
2
|
+
export default defineEventHandler(async (event) => {
|
|
3
|
+
const body = await readBody(event);
|
|
4
|
+
const { firstname, lastname, mobile, email, email_confirmation, password, password_confirmation } = body;
|
|
5
|
+
try {
|
|
6
|
+
const response = await fetch(`${process.env.FLOWRIX_API_BASE}customer/create`, {
|
|
7
|
+
method: "POST",
|
|
8
|
+
headers: {
|
|
9
|
+
"x-public-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({ firstname, lastname, mobile, email, email_confirmation, password, password_confirmation })
|
|
15
|
+
});
|
|
16
|
+
if (!response.ok) {
|
|
17
|
+
let errorMessage = {};
|
|
18
|
+
let errorData;
|
|
19
|
+
try {
|
|
20
|
+
errorData = await response.json();
|
|
21
|
+
console.error("Error response data:", errorData);
|
|
22
|
+
if (errorData.message) {
|
|
23
|
+
errorMessage = errorData.message?.email || errorData.message;
|
|
24
|
+
}
|
|
25
|
+
} catch (parseError) {
|
|
26
|
+
errorMessage = "Failed to parse error details.";
|
|
27
|
+
console.error("Error parsing JSON:", parseError);
|
|
28
|
+
errorData = { message: errorMessage };
|
|
29
|
+
}
|
|
30
|
+
throw createError({
|
|
31
|
+
status: response.status,
|
|
32
|
+
message: errorMessage,
|
|
33
|
+
// Use the more specific errorMessage
|
|
34
|
+
data: { message: errorMessage, errorData }
|
|
35
|
+
// Include both messages and the raw error
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
const data = await response.json();
|
|
39
|
+
return data.data;
|
|
40
|
+
} catch (error) {
|
|
41
|
+
const statusCode = error.status || 500;
|
|
42
|
+
const message = error.message || "An unexpected error occurred";
|
|
43
|
+
const errorData = error.data || { message };
|
|
44
|
+
console.error("Final Error:", { statusCode, message, errorData });
|
|
45
|
+
throw createError({
|
|
46
|
+
status: statusCode,
|
|
47
|
+
message,
|
|
48
|
+
data: errorData
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { defineEventHandler, getCookie, createError } from "h3";
|
|
2
|
+
export default defineEventHandler(async (event) => {
|
|
3
|
+
try {
|
|
4
|
+
const authHeader = getHeader(event, "authorization");
|
|
5
|
+
const token = authHeader?.replace("Bearer ", "") || getCookie(event, "nuxt-auth.token");
|
|
6
|
+
if (!token) {
|
|
7
|
+
throw createError({
|
|
8
|
+
statusCode: 401,
|
|
9
|
+
statusMessage: "No token provided"
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
const config = useRuntimeConfig();
|
|
13
|
+
const apiBase = config.apiBase;
|
|
14
|
+
const apiKey = config.apiKey;
|
|
15
|
+
const apiSecret = config.apiSecret;
|
|
16
|
+
const apiOrigin = config.apiOrigin;
|
|
17
|
+
const response = await fetch(`${apiBase}user/session`, {
|
|
18
|
+
method: "GET",
|
|
19
|
+
headers: {
|
|
20
|
+
"x-public-key": apiKey,
|
|
21
|
+
"x-api-secret": apiSecret,
|
|
22
|
+
"Origin": apiOrigin || "",
|
|
23
|
+
"Authorization": `Bearer ${token}`,
|
|
24
|
+
"Content-Type": "application/json",
|
|
25
|
+
"Accept": "application/json"
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
if (!response.ok) {
|
|
29
|
+
throw createError({
|
|
30
|
+
statusCode: response.status,
|
|
31
|
+
statusMessage: "Failed to get session"
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
const data = await response.json();
|
|
35
|
+
return data.data || data.user || data;
|
|
36
|
+
} catch (error) {
|
|
37
|
+
console.error("Session error:", error);
|
|
38
|
+
if (error.statusCode || error.status) {
|
|
39
|
+
throw error;
|
|
40
|
+
}
|
|
41
|
+
throw createError({
|
|
42
|
+
statusCode: 401,
|
|
43
|
+
statusMessage: "Invalid session"
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
});
|