flowrix 1.0.1-beta.14 → 1.0.1-beta.140
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 +1 -6
- package/dist/module.json +1 -1
- package/dist/module.mjs +175 -29
- package/dist/runtime/composables/Blog/useBlogIndex.d.ts +2 -5
- package/dist/runtime/composables/Blog/useBlogSingle.js +2 -4
- package/dist/runtime/composables/Brand/brand.d.ts +1 -1
- package/dist/runtime/composables/Brand/brand.js +30 -2
- package/dist/runtime/composables/Cart/useCart.d.ts +40 -0
- package/dist/runtime/composables/Cart/useCart.js +10 -0
- package/dist/runtime/composables/Cart/useCartComponent.d.ts +1 -0
- package/dist/runtime/composables/Cart/useCartComponent.js +11 -0
- package/dist/runtime/composables/Cart/useCartDetail.d.ts +15 -5
- package/dist/runtime/composables/Cart/useCartDetail.js +3 -0
- package/dist/runtime/composables/Category/useCategoryIndex.d.ts +25 -32
- package/dist/runtime/composables/Category/useCategoryIndex.js +63 -44
- package/dist/runtime/composables/Checkout/PaymentMethods/useDirectDeposit.js +8 -0
- package/dist/runtime/composables/Checkout/PaymentMethods/useEway.js +16 -6
- package/dist/runtime/composables/Checkout/PaymentMethods/useFlowrixpay.d.ts +40 -1
- package/dist/runtime/composables/Checkout/PaymentMethods/useFlowrixpay.js +10 -2
- package/dist/runtime/composables/Checkout/PaymentMethods/useOpayo.d.ts +40 -1
- package/dist/runtime/composables/Checkout/PaymentMethods/useOpayo.js +10 -2
- package/dist/runtime/composables/Checkout/PaymentMethods/usePaymentMethods.js +3 -14
- package/dist/runtime/composables/Checkout/PaymentMethods/usePaypal.js +8 -0
- package/dist/runtime/composables/Checkout/PaymentMethods/useStripe.d.ts +2 -2
- package/dist/runtime/composables/Checkout/PaymentMethods/useStripe.js +8 -0
- package/dist/runtime/composables/Checkout/PaymentMethods/useZippay.js +8 -0
- package/dist/runtime/composables/Checkout/useCheckout.d.ts +85 -73
- package/dist/runtime/composables/Checkout/useCheckout.js +84 -53
- 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 +7 -7
- package/dist/runtime/composables/Checkout/useCreateAccount.js +3 -1
- package/dist/runtime/composables/Checkout/useDeliveryMethod.d.ts +2 -2
- package/dist/runtime/composables/Checkout/useDeliveryMethod.js +18 -11
- 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 +121 -13
- package/dist/runtime/composables/Customer/useRegister.js +310 -35
- 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 +130 -0
- package/dist/runtime/composables/Customer/useUserCards.d.ts +22 -0
- package/dist/runtime/composables/Customer/useUserCards.js +65 -0
- package/dist/runtime/composables/{useWishlists.d.ts → Customer/useWishlists.d.ts} +7 -20
- package/dist/runtime/composables/{useWishlists.js → Customer/useWishlists.js} +21 -30
- package/dist/runtime/composables/Extras/useCountry.d.ts +11 -6
- package/dist/runtime/composables/Extras/useCountry.js +5 -4
- package/dist/runtime/composables/Footer/useFooter.d.ts +4 -4
- package/dist/runtime/composables/Footer/useFooter.js +12 -8
- package/dist/runtime/composables/Header/useHeader.d.ts +6 -20
- package/dist/runtime/composables/Header/useHeader.js +3 -2
- package/dist/runtime/composables/Product/CustomProduct/useCustomeScript.js +4 -5
- package/dist/runtime/composables/Product/CustomProduct/useSteps.d.ts +1 -1
- package/dist/runtime/composables/Product/useProductComponent.js +110 -0
- package/dist/runtime/composables/Product/useProductSlug.d.ts +8 -1
- 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 +42 -15
- package/dist/runtime/composables/Product/useService.js +137 -48
- package/dist/runtime/composables/Samples/useSamples.d.ts +5 -6
- package/dist/runtime/composables/Samples/useSamples.js +19 -15
- package/dist/runtime/composables/SideBar/Filters/useFilters.d.ts +2 -2
- package/dist/runtime/composables/SideBar/Filters/useSorting.d.ts +2 -2
- package/dist/runtime/composables/index.d.ts +18 -12
- package/dist/runtime/composables/index.js +18 -12
- package/dist/runtime/composables/useAddresses.js +6 -6
- package/dist/runtime/composables/useApp.d.ts +1 -0
- package/dist/runtime/composables/useApp.js +88 -0
- package/dist/runtime/composables/useCards.js +2 -2
- package/dist/runtime/composables/useDataLayer.js +1 -1
- package/dist/runtime/composables/useDotDigital.d.ts +3 -0
- package/dist/runtime/composables/useDotDigital.js +122 -0
- package/dist/runtime/composables/useLocation.d.ts +61 -19
- package/dist/runtime/composables/useLocation.js +353 -25
- package/dist/runtime/composables/useMetaLayer.js +11 -11
- package/dist/runtime/composables/useQuotationCheckout.d.ts +78 -0
- package/dist/runtime/composables/useQuotationCheckout.js +137 -0
- package/dist/runtime/composables/useSubscriptions.d.ts +17 -10
- package/dist/runtime/composables/useSubscriptions.js +68 -33
- package/dist/runtime/composables/useTikTokDatalayer.js +7 -7
- package/dist/runtime/composables/useWebforms.d.ts +38 -9
- package/dist/runtime/composables/useWebforms.js +93 -60
- package/dist/runtime/middleware/flowrix.d.ts +5 -4
- package/dist/runtime/middleware/flowrix.js +40 -22
- package/dist/runtime/pages/404.d.vue.ts +3 -0
- package/dist/runtime/pages/404.vue +6 -0
- package/dist/runtime/pages/404.vue.d.ts +3 -0
- package/dist/runtime/pages/flowrix-default.d.vue.ts +3 -0
- package/dist/runtime/pages/flowrix-default.vue +42 -0
- package/dist/runtime/pages/flowrix-default.vue.d.ts +3 -0
- package/dist/runtime/plugin.d.ts +1 -1
- package/dist/runtime/plugin.js +14 -1
- package/dist/runtime/plugins/router.d.ts +2 -0
- package/dist/runtime/plugins/router.js +11 -0
- package/dist/runtime/server/api/albums.d.ts +1 -0
- package/dist/runtime/server/api/albums.js +35 -7
- package/dist/runtime/server/api/auth/forgot.js +1 -2
- package/dist/runtime/server/api/auth/login.d.ts +7 -0
- package/dist/runtime/server/api/auth/login.js +4 -16
- package/dist/runtime/server/api/auth/logout.js +1 -2
- package/dist/runtime/server/api/auth/register.js +1 -2
- package/dist/runtime/server/api/auth/session.get.js +1 -3
- package/dist/runtime/server/api/auth/user/reset-password.js +1 -2
- package/dist/runtime/server/api/auth/user/session.js +1 -2
- package/dist/runtime/server/api/auth/user/verify-token.js +1 -2
- package/dist/runtime/server/api/banners.js +20 -15
- package/dist/runtime/server/api/brand/[...slug].js +55 -0
- package/dist/runtime/server/api/brand/index.d.ts +3 -0
- package/dist/runtime/server/api/brand/index.js +46 -0
- package/dist/runtime/server/api/cache/[...slug].delete.d.ts +4 -1
- package/dist/runtime/server/api/cache/[...slug].delete.js +4 -7
- package/dist/runtime/server/api/cache/clean.get.d.ts +5 -0
- package/dist/runtime/server/api/cache/clean.get.js +4 -7
- package/dist/runtime/server/api/cart/[slug]/add.d.ts +1 -1
- package/dist/runtime/server/api/cart/[slug]/add.js +11 -11
- package/dist/runtime/server/api/cart/[slug]/update.d.ts +1 -1
- package/dist/runtime/server/api/cart/[slug]/update.js +11 -11
- package/dist/runtime/server/api/{v2/[...slug].d.ts → cart/related.d.ts} +0 -1
- package/dist/runtime/server/api/cart/related.js +21 -0
- package/dist/runtime/server/api/cart/remove.d.ts +1 -1
- package/dist/runtime/server/api/cart/remove.js +10 -10
- package/dist/runtime/server/api/cart/service/[slug]/add.d.ts +1 -1
- package/dist/runtime/server/api/cart/service/[slug]/add.js +12 -12
- package/dist/runtime/server/api/catalog/brands.d.ts +3 -0
- package/dist/runtime/server/api/catalog/brands.js +52 -0
- package/dist/runtime/server/api/catalog/categories.js +28 -19
- package/dist/runtime/server/api/catalog/categoriesall.d.ts +3 -0
- package/dist/runtime/server/api/catalog/categoriesall.js +52 -0
- package/dist/runtime/server/api/catalog/featured.js +28 -17
- package/dist/runtime/server/api/catalog/posts.d.ts +3 -0
- package/dist/runtime/server/api/catalog/posts.js +52 -0
- package/dist/runtime/server/api/catalog/samples.js +28 -19
- package/dist/runtime/server/api/catalog/search.js +28 -19
- package/dist/runtime/server/api/category/[...slug].js +31 -20
- package/dist/runtime/server/api/check-404.d.ts +4 -0
- package/dist/runtime/server/api/check-404.js +8 -0
- package/dist/runtime/server/api/checkout/applyCoupon.d.ts +1 -1
- package/dist/runtime/server/api/checkout/applyCoupon.js +13 -13
- package/dist/runtime/server/api/checkout/configs.d.ts +1 -1
- package/dist/runtime/server/api/checkout/configs.js +11 -11
- package/dist/runtime/server/api/checkout/countries.d.ts +1 -1
- package/dist/runtime/server/api/checkout/countries.js +5 -9
- package/dist/runtime/server/api/checkout/paymentmethod.d.ts +1 -1
- package/dist/runtime/server/api/checkout/paymentmethod.js +16 -11
- package/dist/runtime/server/api/{blog/blog.d.ts → checkout/quotation/[slug].d.ts} +0 -1
- package/dist/runtime/server/api/checkout/quotation/[slug].js +20 -0
- package/dist/runtime/server/api/checkout/quotation/guest/[slug].d.ts +2 -0
- package/dist/runtime/server/api/checkout/quotation/guest/[slug].js +35 -0
- package/dist/runtime/server/api/checkout/quotation/guest/customer.d.ts +2 -0
- package/dist/runtime/server/api/checkout/quotation/guest/customer.js +20 -0
- package/dist/runtime/server/api/checkout/quotation/submit/[slug].d.ts +2 -0
- package/dist/runtime/server/api/checkout/quotation/submit/[slug].js +22 -0
- package/dist/runtime/server/api/checkvariables.d.ts +3 -0
- package/dist/runtime/server/api/checkvariables.js +37 -0
- package/dist/runtime/server/api/cmspost/[...slug].js +54 -0
- package/dist/runtime/server/api/cmspost/all.d.ts +3 -0
- package/dist/runtime/server/api/cmspost/all.js +52 -0
- package/dist/runtime/server/api/company/profile.d.ts +1 -1
- package/dist/runtime/server/api/company/profile.js +12 -7
- package/dist/runtime/server/api/contact-center/webforms/[id]/details.d.ts +1 -1
- package/dist/runtime/server/api/contact-center/webforms/[id]/details.js +50 -15
- package/dist/runtime/server/api/contact-center/webforms/create.d.ts +1 -1
- package/dist/runtime/server/api/contact-center/webforms/create.js +13 -9
- package/dist/runtime/server/api/countries.d.ts +2 -0
- package/dist/runtime/server/api/countries.js +44 -0
- package/dist/runtime/server/api/customer/address/add.js +1 -2
- package/dist/runtime/server/api/customer/address/delete.js +2 -3
- package/dist/runtime/server/api/customer/address/setshipping.js +1 -2
- package/dist/runtime/server/api/customer/address/update.js +1 -2
- package/dist/runtime/server/api/customer/cards/delete.js +2 -3
- package/dist/runtime/server/api/customer/cards/get.js +2 -3
- package/dist/runtime/server/api/customer/change-password.js +2 -3
- package/dist/runtime/server/api/customer/checkout.js +1 -2
- package/dist/runtime/server/api/customer/orders.js +2 -3
- package/dist/runtime/server/api/customer/profile/update.js +1 -2
- package/dist/runtime/server/api/customer/quotations.js +2 -3
- package/dist/runtime/server/api/customer/search.js +1 -2
- package/dist/runtime/server/api/customer/tax-invoice.js +1 -2
- package/dist/runtime/server/api/customer/wishlist/add.js +1 -2
- package/dist/runtime/server/api/customer/wishlist/createWishList.js +1 -2
- package/dist/runtime/server/api/customer/wishlist/deleteFromWishList.js +1 -2
- package/dist/runtime/server/api/customer/wishlist/deleteWishList.js +1 -2
- package/dist/runtime/server/api/customer/wishlist/get.js +2 -3
- package/dist/runtime/server/api/customer/wishlist/getWishListItems.js +1 -2
- package/dist/runtime/server/api/customer/wishlist/updateWishList.js +2 -3
- package/dist/runtime/server/api/featured.d.ts +3 -0
- package/dist/runtime/server/api/featured.js +52 -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 +1 -1
- package/dist/runtime/server/api/location.js +24 -12
- package/dist/runtime/server/api/nav/[id]/links.d.ts +1 -0
- package/dist/runtime/server/api/nav/[id]/links.js +46 -10
- package/dist/runtime/server/api/page/[...slug].js +54 -0
- package/dist/runtime/server/api/product/[...slug].js +28 -13
- package/dist/runtime/server/api/quickview/[slug].d.ts +2 -0
- package/dist/runtime/server/api/quickview/[slug].js +21 -0
- package/dist/runtime/server/api/reviews.d.ts +2 -0
- package/dist/runtime/server/api/reviews.js +23 -0
- package/dist/runtime/server/api/samples.d.ts +3 -0
- package/dist/runtime/server/api/samples.js +53 -0
- package/dist/runtime/server/api/search.d.ts +3 -0
- package/dist/runtime/server/api/search.js +53 -0
- package/dist/runtime/server/api/service/[slug].js +22 -16
- package/dist/runtime/server/api/service/availability.d.ts +1 -1
- package/dist/runtime/server/api/service/availability.js +14 -12
- package/dist/runtime/server/api/service/getall.d.ts +3 -0
- package/dist/runtime/server/api/service/getall.js +57 -0
- package/dist/runtime/server/api/shop.d.ts +3 -0
- package/dist/runtime/server/api/shop.js +53 -0
- package/dist/runtime/server/api/subscribe.d.ts +1 -1
- package/dist/runtime/server/api/subscribe.js +23 -14
- package/dist/runtime/server/api/v2/[...slug].get.d.ts +2 -0
- package/dist/runtime/server/api/v2/[...slug].get.js +32 -0
- package/dist/runtime/server/api/webform.d.ts +3 -0
- package/dist/runtime/server/api/webform.js +54 -0
- package/dist/runtime/server/tsconfig.json +3 -3
- package/dist/runtime/stores/Cart.d.ts +12 -0
- package/dist/runtime/stores/Cart.js +62 -17
- package/dist/runtime/stores/Checkout.d.ts +9 -15
- package/dist/runtime/stores/Checkout.js +38 -45
- package/dist/runtime/stores/IpLocation.d.ts +95 -4
- package/dist/runtime/stores/IpLocation.js +93 -15
- package/dist/runtime/stores/Search.d.ts +1 -1
- package/dist/runtime/stores/Services.d.ts +5 -0
- package/dist/runtime/stores/Services.js +59 -8
- package/dist/runtime/stores/auth.d.ts +8 -11
- package/dist/runtime/stores/auth.js +385 -8
- package/dist/runtime/stores/countries.d.ts +1 -3
- package/dist/runtime/stores/countries.js +4 -8
- package/dist/runtime/stores/product/README.md +6 -6
- package/dist/runtime/stores/product/slug.d.ts +1 -17
- package/dist/runtime/stores/webforms.d.ts +24 -9
- package/dist/runtime/stores/webforms.js +105 -5
- package/dist/runtime/stores/wishlists.d.ts +125 -8
- package/dist/runtime/stores/wishlists.js +212 -20
- package/dist/runtime/utils/api.js +7 -13
- package/dist/runtime/utils/htmlCache.d.ts +2 -2
- package/dist/runtime/utils/htmlCache.js +23 -13
- package/dist/types.d.mts +6 -2
- package/package.json +16 -5
- package/dist/runtime/composables/Checkout/useBillingAddress.d.ts +0 -19
- package/dist/runtime/composables/Checkout/useBillingAddress.js +0 -82
- package/dist/runtime/composables/Checkout/useShippingAddress.d.ts +0 -9
- package/dist/runtime/composables/Checkout/useShippingAddress.js +0 -121
- package/dist/runtime/composables/useAuth.d.ts +0 -45
- package/dist/runtime/composables/useAuth.js +0 -180
- package/dist/runtime/composables/useCountries.d.ts +0 -12
- package/dist/runtime/composables/useCountries.js +0 -50
- package/dist/runtime/composables/useOrders.d.ts +0 -21
- package/dist/runtime/composables/useOrders.js +0 -82
- package/dist/runtime/composables/useQuotations.d.ts +0 -14
- package/dist/runtime/composables/useQuotations.js +0 -50
- package/dist/runtime/server/api/blog/[slug].js +0 -51
- package/dist/runtime/server/api/blog/blog.js +0 -17
- package/dist/runtime/server/api/brand/[slug].js +0 -58
- package/dist/runtime/server/api/page/[slug].js +0 -51
- package/dist/runtime/server/api/v2/[...slug].js +0 -9
- /package/dist/runtime/server/api/brand/{[slug].d.ts → [...slug].d.ts} +0 -0
- /package/dist/runtime/server/api/{blog/[slug].d.ts → cmspost/[...slug].d.ts} +0 -0
- /package/dist/runtime/server/api/page/{[slug].d.ts → [...slug].d.ts} +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { defineEventHandler, setResponseStatus, getRouterParam, getCookie } from "h3";
|
|
2
|
+
import { $fetch } from "ofetch";
|
|
3
|
+
export default defineEventHandler(async (event) => {
|
|
4
|
+
const slug = getRouterParam(event, "slug");
|
|
5
|
+
const accessTok = getCookie(event, "authToken");
|
|
6
|
+
try {
|
|
7
|
+
const response = await $fetch(`${process.env.FLOWRIX_API_BASE}mystore/customer/quotations/${slug}`, {
|
|
8
|
+
method: "GET",
|
|
9
|
+
headers: {
|
|
10
|
+
"x-public-key": process.env.FLOWRIX_API_KEY || "",
|
|
11
|
+
"Origin": process.env.FLOWRIX_API_ORIGIN || "",
|
|
12
|
+
"Authorization": `Bearer ${accessTok || ""}`
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
return response;
|
|
16
|
+
} catch (error) {
|
|
17
|
+
setResponseStatus(event, error.statusCode || 500);
|
|
18
|
+
return { success: false, error: error.message, data: error.data };
|
|
19
|
+
}
|
|
20
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { defineEventHandler, setResponseStatus, getRouterParam, readBody, getMethod, getQuery } from "h3";
|
|
2
|
+
import { $fetch } from "ofetch";
|
|
3
|
+
export default defineEventHandler(async (event) => {
|
|
4
|
+
const slug = getRouterParam(event, "slug");
|
|
5
|
+
const method = getMethod(event);
|
|
6
|
+
const query = getQuery(event);
|
|
7
|
+
try {
|
|
8
|
+
if (method === "GET") {
|
|
9
|
+
const response = await $fetch(`${process.env.FLOWRIX_API_BASE}quotations/${slug}`, {
|
|
10
|
+
method: "GET",
|
|
11
|
+
headers: {
|
|
12
|
+
"x-public-key": process.env.FLOWRIX_API_KEY || "",
|
|
13
|
+
"Origin": process.env.FLOWRIX_API_ORIGIN || ""
|
|
14
|
+
},
|
|
15
|
+
query
|
|
16
|
+
});
|
|
17
|
+
return response;
|
|
18
|
+
} else if (method === "POST") {
|
|
19
|
+
const body = await readBody(event);
|
|
20
|
+
const response = await $fetch(`${process.env.FLOWRIX_API_BASE}quotations/${slug}`, {
|
|
21
|
+
method: "POST",
|
|
22
|
+
headers: {
|
|
23
|
+
"x-public-key": process.env.FLOWRIX_API_KEY || "",
|
|
24
|
+
"Origin": process.env.FLOWRIX_API_ORIGIN || ""
|
|
25
|
+
},
|
|
26
|
+
body,
|
|
27
|
+
query
|
|
28
|
+
});
|
|
29
|
+
return response;
|
|
30
|
+
}
|
|
31
|
+
} catch (error) {
|
|
32
|
+
setResponseStatus(event, error.statusCode || 500);
|
|
33
|
+
return { success: false, error: error.message, data: error.data };
|
|
34
|
+
}
|
|
35
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { defineEventHandler, setResponseStatus, readBody, getMethod } from "h3";
|
|
2
|
+
import { $fetch } from "ofetch";
|
|
3
|
+
export default defineEventHandler(async (event) => {
|
|
4
|
+
const method = getMethod(event);
|
|
5
|
+
const body = method === "POST" ? await readBody(event) : void 0;
|
|
6
|
+
try {
|
|
7
|
+
const response = await $fetch(`${process.env.FLOWRIX_API_BASE}checkout/quotation/customer`, {
|
|
8
|
+
method,
|
|
9
|
+
headers: {
|
|
10
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
11
|
+
"Origin": process.env.FLOWRIX_API_ORIGIN
|
|
12
|
+
},
|
|
13
|
+
body
|
|
14
|
+
});
|
|
15
|
+
return response;
|
|
16
|
+
} catch (error) {
|
|
17
|
+
setResponseStatus(event, 500);
|
|
18
|
+
return { success: false, error: error.message };
|
|
19
|
+
}
|
|
20
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { defineEventHandler, setResponseStatus, readBody, getCookie, getRouterParam } from "h3";
|
|
2
|
+
import { $fetch } from "ofetch";
|
|
3
|
+
export default defineEventHandler(async (event) => {
|
|
4
|
+
const slug = getRouterParam(event, "slug");
|
|
5
|
+
const body = await readBody(event);
|
|
6
|
+
const accessTok = getCookie(event, "authToken");
|
|
7
|
+
try {
|
|
8
|
+
const response = await $fetch(`${process.env.FLOWRIX_API_BASE}mystore/customer/checkout/quotation/${slug}`, {
|
|
9
|
+
method: "POST",
|
|
10
|
+
headers: {
|
|
11
|
+
"x-public-key": process.env.FLOWRIX_API_KEY || "",
|
|
12
|
+
"Origin": process.env.FLOWRIX_API_ORIGIN || "",
|
|
13
|
+
"Authorization": `Bearer ${accessTok || ""}`
|
|
14
|
+
},
|
|
15
|
+
body
|
|
16
|
+
});
|
|
17
|
+
return response;
|
|
18
|
+
} catch (error) {
|
|
19
|
+
setResponseStatus(event, error.statusCode || 500);
|
|
20
|
+
return { success: false, error: error.message, data: error.data };
|
|
21
|
+
}
|
|
22
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { defineEventHandler, setResponseStatus } from "h3";
|
|
2
|
+
import { mkdir, readFile } from "fs/promises";
|
|
3
|
+
import { join } from "path";
|
|
4
|
+
import { useRuntimeConfig } from "#imports";
|
|
5
|
+
const CACHE_DIR = join("/tmp", ".cache", "nitro", "extra");
|
|
6
|
+
export const catelogCache = /* @__PURE__ */ new Map();
|
|
7
|
+
async function ensureCacheDir() {
|
|
8
|
+
try {
|
|
9
|
+
await mkdir(CACHE_DIR, { recursive: true });
|
|
10
|
+
} catch (error) {
|
|
11
|
+
console.error("Error creating cache directory:", error);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export default defineEventHandler(async (event) => {
|
|
15
|
+
const fileName = "banners";
|
|
16
|
+
const filePath = join(CACHE_DIR, `${fileName}.json`);
|
|
17
|
+
try {
|
|
18
|
+
const fileContent = await readFile(filePath, "utf-8");
|
|
19
|
+
const catelog = JSON.parse(fileContent);
|
|
20
|
+
return catelog;
|
|
21
|
+
} catch (error) {
|
|
22
|
+
}
|
|
23
|
+
try {
|
|
24
|
+
const config = useRuntimeConfig();
|
|
25
|
+
const envData = process.env;
|
|
26
|
+
const rawCookies = event.req.headers.cookie || "";
|
|
27
|
+
const apiConfig = {
|
|
28
|
+
...config,
|
|
29
|
+
cookies: rawCookies,
|
|
30
|
+
env: envData
|
|
31
|
+
};
|
|
32
|
+
return apiConfig;
|
|
33
|
+
} catch (error) {
|
|
34
|
+
setResponseStatus(event, 500);
|
|
35
|
+
return { success: false, error: error.message };
|
|
36
|
+
}
|
|
37
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { defineEventHandler, getQuery, createError, readBody, getCookie, setResponseStatus } from "h3";
|
|
2
|
+
import { writeFile, mkdir, readFile } from "fs/promises";
|
|
3
|
+
import { join } from "path";
|
|
4
|
+
import { useRuntimeConfig } from "#imports";
|
|
5
|
+
import { flowrixApi } from "../../../middleware/flowrix.js";
|
|
6
|
+
const CACHE_DIR = join("/tmp", ".cache", "nitro", "blogs");
|
|
7
|
+
export const blogCache = /* @__PURE__ */ new Map();
|
|
8
|
+
async function ensureCacheDir() {
|
|
9
|
+
try {
|
|
10
|
+
await mkdir(CACHE_DIR, { recursive: true });
|
|
11
|
+
} catch (error) {
|
|
12
|
+
console.error("Error creating cache directory:", error);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export default defineEventHandler(async (event) => {
|
|
16
|
+
const slug = event.context.params._;
|
|
17
|
+
const customerType = getCookie(event, "customertype") || "";
|
|
18
|
+
let query = getQuery(event);
|
|
19
|
+
const body = await readBody(event);
|
|
20
|
+
if (!slug) {
|
|
21
|
+
throw createError({ statusCode: 400, statusMessage: "Missing slug parameter" });
|
|
22
|
+
}
|
|
23
|
+
const cacheKey = `${slug}-${JSON.stringify(query)}`;
|
|
24
|
+
const fileName = cacheKey.replace(/[^a-zA-Z0-9-_]/g, "_");
|
|
25
|
+
const filePath = join(CACHE_DIR, `${fileName}-${customerType}.json`);
|
|
26
|
+
try {
|
|
27
|
+
const fileContent = await readFile(filePath, "utf-8");
|
|
28
|
+
const blog = JSON.parse(fileContent);
|
|
29
|
+
return blog;
|
|
30
|
+
} catch (error) {
|
|
31
|
+
}
|
|
32
|
+
try {
|
|
33
|
+
const config = useRuntimeConfig();
|
|
34
|
+
const rawCookies = event.req.headers.cookie || "";
|
|
35
|
+
const apiConfig = {
|
|
36
|
+
...config,
|
|
37
|
+
cookies: rawCookies
|
|
38
|
+
};
|
|
39
|
+
const options = {
|
|
40
|
+
headers: {
|
|
41
|
+
"x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const blog = await flowrixApi.get(`post/${slug}`, apiConfig, options);
|
|
45
|
+
if (config.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
|
|
46
|
+
await ensureCacheDir();
|
|
47
|
+
await writeFile(filePath, JSON.stringify(blog, null, 2), "utf-8");
|
|
48
|
+
}
|
|
49
|
+
return blog;
|
|
50
|
+
} catch (error) {
|
|
51
|
+
setResponseStatus(event, 500);
|
|
52
|
+
return { success: false, error: error.message };
|
|
53
|
+
}
|
|
54
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { defineEventHandler, getQuery, getCookie, setResponseStatus } from "h3";
|
|
2
|
+
import { writeFile, mkdir, readFile } from "fs/promises";
|
|
3
|
+
import { join } from "path";
|
|
4
|
+
import { useRuntimeConfig } from "#imports";
|
|
5
|
+
import { flowrixApi } from "../../../middleware/flowrix.js";
|
|
6
|
+
const CACHE_DIR = join("/tmp", ".cache", "nitro", "catalog");
|
|
7
|
+
export const catelogCache = /* @__PURE__ */ new Map();
|
|
8
|
+
async function ensureCacheDir() {
|
|
9
|
+
try {
|
|
10
|
+
await mkdir(CACHE_DIR, { recursive: true });
|
|
11
|
+
} catch (error) {
|
|
12
|
+
console.error("Error creating cache directory:", error);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export default defineEventHandler(async (event) => {
|
|
16
|
+
let query = getQuery(event);
|
|
17
|
+
const customerType = getCookie(event, "customertype") || "";
|
|
18
|
+
const fileName = "posts";
|
|
19
|
+
const filePath = join(CACHE_DIR, `${fileName}-${customerType}.json`);
|
|
20
|
+
try {
|
|
21
|
+
const fileContent = await readFile(filePath, "utf-8");
|
|
22
|
+
const catelog = JSON.parse(fileContent);
|
|
23
|
+
return catelog;
|
|
24
|
+
} catch (error) {
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
const config = useRuntimeConfig();
|
|
28
|
+
const rawCookies = event.req.headers.cookie || "";
|
|
29
|
+
const apiConfig = {
|
|
30
|
+
...config,
|
|
31
|
+
cookies: rawCookies
|
|
32
|
+
};
|
|
33
|
+
query = {
|
|
34
|
+
...query
|
|
35
|
+
};
|
|
36
|
+
const options = {
|
|
37
|
+
headers: {
|
|
38
|
+
"x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
|
|
39
|
+
},
|
|
40
|
+
query
|
|
41
|
+
};
|
|
42
|
+
const posts = await flowrixApi.post(`posts`, apiConfig, options);
|
|
43
|
+
if (config.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
|
|
44
|
+
await ensureCacheDir();
|
|
45
|
+
await writeFile(filePath, JSON.stringify(posts, null, 2), "utf-8");
|
|
46
|
+
}
|
|
47
|
+
return posts;
|
|
48
|
+
} catch (error) {
|
|
49
|
+
setResponseStatus(event, 500);
|
|
50
|
+
return { success: false, error: error.message };
|
|
51
|
+
}
|
|
52
|
+
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<
|
|
1
|
+
declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<unknown>>;
|
|
2
2
|
export default _default;
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import { defineEventHandler, setResponseStatus } from "h3";
|
|
2
|
-
import {
|
|
2
|
+
import { flowrixApi } from "../../../middleware/flowrix.js";
|
|
3
|
+
import { useRuntimeConfig } from "#imports";
|
|
3
4
|
export default defineEventHandler(async (event) => {
|
|
4
5
|
try {
|
|
5
|
-
const
|
|
6
|
-
|
|
6
|
+
const config = useRuntimeConfig();
|
|
7
|
+
const rawCookies = event.req.headers.cookie || "";
|
|
8
|
+
const apiConfig = {
|
|
9
|
+
...config,
|
|
10
|
+
cookies: rawCookies
|
|
11
|
+
};
|
|
12
|
+
const options = {
|
|
7
13
|
headers: {
|
|
8
|
-
"x-api-
|
|
9
|
-
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
10
|
-
"Origin": process.env.FLOWRIX_API_ORIGIN
|
|
14
|
+
"x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
|
|
11
15
|
}
|
|
12
|
-
}
|
|
16
|
+
};
|
|
17
|
+
const companyProfile = await flowrixApi.get(`company/profile`, apiConfig, options);
|
|
13
18
|
return companyProfile;
|
|
14
19
|
} catch (error) {
|
|
15
20
|
setResponseStatus(event, 500);
|
|
@@ -1,19 +1,54 @@
|
|
|
1
|
-
import { defineEventHandler, getRouterParam } from "h3";
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { defineEventHandler, getRouterParam, getQuery, createError, readBody, getCookie, setResponseStatus } from "h3";
|
|
2
|
+
import { writeFile, mkdir, readFile } from "fs/promises";
|
|
3
|
+
import { join } from "path";
|
|
4
|
+
import { useRuntimeConfig } from "#imports";
|
|
5
|
+
import { flowrixApi } from "../../../../../middleware/flowrix.js";
|
|
6
|
+
const CACHE_DIR = join("/tmp", ".cache", "nitro", "webfroms");
|
|
7
|
+
export const webfromCache = /* @__PURE__ */ new Map();
|
|
8
|
+
async function ensureCacheDir() {
|
|
9
|
+
try {
|
|
10
|
+
await mkdir(CACHE_DIR, { recursive: true });
|
|
11
|
+
} catch (error) {
|
|
12
|
+
console.error("Error creating cache directory:", error);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
4
15
|
export default defineEventHandler(async (event) => {
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
16
|
+
const slug = getRouterParam(event, "id");
|
|
17
|
+
const customerType = getCookie(event, "customertype") || "";
|
|
18
|
+
let query = getQuery(event);
|
|
19
|
+
const body = await readBody(event);
|
|
20
|
+
if (!slug) {
|
|
21
|
+
throw createError({ statusCode: 400, statusMessage: "Missing slug parameter" });
|
|
22
|
+
}
|
|
23
|
+
const cacheKey = `${slug}-${JSON.stringify(query)}`;
|
|
24
|
+
const fileName = cacheKey.replace(/[^a-zA-Z0-9-_]/g, "_");
|
|
25
|
+
const filePath = join(CACHE_DIR, `${fileName}-${customerType}.json`);
|
|
26
|
+
try {
|
|
27
|
+
const fileContent = await readFile(filePath, "utf-8");
|
|
28
|
+
const webfrom = JSON.parse(fileContent);
|
|
29
|
+
return webfrom;
|
|
30
|
+
} catch (error) {
|
|
8
31
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
32
|
+
try {
|
|
33
|
+
const config = useRuntimeConfig();
|
|
34
|
+
const rawCookies = event.req.headers.cookie || "";
|
|
35
|
+
const apiConfig = {
|
|
36
|
+
...config,
|
|
37
|
+
cookies: rawCookies
|
|
38
|
+
};
|
|
39
|
+
const options = {
|
|
40
|
+
headers: {
|
|
41
|
+
"x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const webfrom = await flowrixApi.get(`contact-center/webforms/${slug}/details`, apiConfig, options);
|
|
45
|
+
if (config.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
|
|
46
|
+
await ensureCacheDir();
|
|
47
|
+
await writeFile(filePath, JSON.stringify(webfrom, null, 2), "utf-8");
|
|
15
48
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
49
|
+
return webfrom;
|
|
50
|
+
} catch (error) {
|
|
51
|
+
setResponseStatus(event, 500);
|
|
52
|
+
return { success: false, error: error.message };
|
|
53
|
+
}
|
|
19
54
|
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<
|
|
1
|
+
declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<unknown>>;
|
|
2
2
|
export default _default;
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import { defineEventHandler, readBody } from "h3";
|
|
2
|
-
import {
|
|
2
|
+
import { flowrixApi } from "../../../../middleware/flowrix.js";
|
|
3
|
+
import { useRuntimeConfig } from "#imports";
|
|
3
4
|
export default defineEventHandler(async (event) => {
|
|
4
5
|
const body = await readBody(event);
|
|
5
|
-
const
|
|
6
|
-
|
|
6
|
+
const config = useRuntimeConfig();
|
|
7
|
+
const rawCookies = event.req.headers.cookie || "";
|
|
8
|
+
const apiConfig = {
|
|
9
|
+
...config,
|
|
10
|
+
cookies: rawCookies
|
|
11
|
+
};
|
|
12
|
+
const options = {
|
|
7
13
|
headers: {
|
|
8
|
-
"x-api-
|
|
9
|
-
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
10
|
-
"Origin": process.env.FLOWRIX_API_ORIGIN,
|
|
11
|
-
"Content-Type": "application/json"
|
|
14
|
+
"x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
|
|
12
15
|
},
|
|
13
|
-
body
|
|
14
|
-
}
|
|
16
|
+
body
|
|
17
|
+
};
|
|
18
|
+
const webform = await flowrixApi.post(`posts`, apiConfig, options);
|
|
15
19
|
return webform;
|
|
16
20
|
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { defineEventHandler, setResponseStatus } from "h3";
|
|
2
|
+
import { writeFile, mkdir, readFile } from "fs/promises";
|
|
3
|
+
import { join } from "path";
|
|
4
|
+
import { flowrixApi } from "../../middleware/flowrix.js";
|
|
5
|
+
import { useRuntimeConfig } from "#imports";
|
|
6
|
+
const CACHE_DIR = join("/tmp", ".cache", "nitro", "company");
|
|
7
|
+
async function ensureCacheDir() {
|
|
8
|
+
try {
|
|
9
|
+
await mkdir(CACHE_DIR, { recursive: true });
|
|
10
|
+
} catch (error) {
|
|
11
|
+
console.error("Error creating cache directory:", error);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export default defineEventHandler(async (event) => {
|
|
15
|
+
const filePath = join(CACHE_DIR, `countries.json`);
|
|
16
|
+
try {
|
|
17
|
+
const fileContent = await readFile(filePath, "utf-8");
|
|
18
|
+
const countries = JSON.parse(fileContent);
|
|
19
|
+
return countries;
|
|
20
|
+
} catch (error) {
|
|
21
|
+
}
|
|
22
|
+
try {
|
|
23
|
+
const config = useRuntimeConfig();
|
|
24
|
+
const rawCookies = event.req.headers.cookie || "";
|
|
25
|
+
const apiConfig = {
|
|
26
|
+
...config,
|
|
27
|
+
cookies: rawCookies
|
|
28
|
+
};
|
|
29
|
+
const options = {
|
|
30
|
+
headers: {
|
|
31
|
+
"x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const countries = await flowrixApi.get(`countries`, apiConfig, options);
|
|
35
|
+
if (config.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
|
|
36
|
+
await ensureCacheDir();
|
|
37
|
+
await writeFile(filePath, JSON.stringify(countries, null, 2), "utf-8");
|
|
38
|
+
}
|
|
39
|
+
return countries;
|
|
40
|
+
} catch (error) {
|
|
41
|
+
setResponseStatus(event, 500);
|
|
42
|
+
return { success: false, error: error.message };
|
|
43
|
+
}
|
|
44
|
+
});
|
|
@@ -6,8 +6,7 @@ export default defineEventHandler(async (event) => {
|
|
|
6
6
|
const responseData = await $fetch(`${process.env.FLOWRIX_API_BASE}customer/address/add`, {
|
|
7
7
|
method: "POST",
|
|
8
8
|
headers: {
|
|
9
|
-
"x-
|
|
10
|
-
"x-api-secret": process.env.FLOWRIX_API_SECRET || "",
|
|
9
|
+
"x-public-key": process.env.FLOWRIX_API_KEY || "",
|
|
11
10
|
"Origin": process.env.FLOWRIX_API_ORIGIN || "",
|
|
12
11
|
"Authorization": `Bearer ${accessTok || ""}`,
|
|
13
12
|
"Content-Type": "application/json",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineEventHandler, getQuery } from "h3";
|
|
1
|
+
import { defineEventHandler, getQuery, getCookie } from "h3";
|
|
2
2
|
export default defineEventHandler(async (event) => {
|
|
3
3
|
const accessTok = getCookie(event, "auth.token");
|
|
4
4
|
const { addressId } = getQuery(event);
|
|
@@ -13,8 +13,7 @@ export default defineEventHandler(async (event) => {
|
|
|
13
13
|
const response = await $fetch(`${process.env.FLOWRIX_API_BASE}customer/address/${addressId}/delete`, {
|
|
14
14
|
method: "PATCH",
|
|
15
15
|
headers: {
|
|
16
|
-
"x-
|
|
17
|
-
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
16
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
18
17
|
"Origin": process.env.FLOWRIX_API_ORIGIN,
|
|
19
18
|
"Authorization": `Bearer ${accessTok || ""}`
|
|
20
19
|
}
|
|
@@ -13,8 +13,7 @@ export default defineEventHandler(async (event) => {
|
|
|
13
13
|
const response = await $fetch(`${process.env.FLOWRIX_API_BASE}customer/address/${addressId}/setshipping`, {
|
|
14
14
|
method: "POST",
|
|
15
15
|
headers: {
|
|
16
|
-
"x-
|
|
17
|
-
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
16
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
18
17
|
"Origin": process.env.FLOWRIX_API_ORIGIN,
|
|
19
18
|
"Authorization": `Bearer ${accessTok || ""}`,
|
|
20
19
|
"Content-Type": "application/json",
|
|
@@ -15,8 +15,7 @@ export default defineEventHandler(async (event) => {
|
|
|
15
15
|
const response = await $fetch(`${process.env.FLOWRIX_API_BASE}customer/address/${addressId}/update`, {
|
|
16
16
|
method: "PATCH",
|
|
17
17
|
headers: {
|
|
18
|
-
"x-
|
|
19
|
-
"x-api-secret": process.env.FLOWRIX_API_SECRET || "",
|
|
18
|
+
"x-public-key": process.env.FLOWRIX_API_KEY || "",
|
|
20
19
|
"Origin": process.env.FLOWRIX_API_ORIGIN || "",
|
|
21
20
|
"Authorization": `Bearer ${accessTok || ""}`,
|
|
22
21
|
"Content-Type": "application/json",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineEventHandler } from "h3";
|
|
1
|
+
import { defineEventHandler, getCookie } from "h3";
|
|
2
2
|
export default defineEventHandler(async (event) => {
|
|
3
3
|
const accessTok = getCookie(event, "auth.token");
|
|
4
4
|
const { cardId } = getQuery(event);
|
|
@@ -6,8 +6,7 @@ export default defineEventHandler(async (event) => {
|
|
|
6
6
|
const response = await $fetch(`${process.env.FLOWRIX_API_BASE}customer/cards/${cardId}`, {
|
|
7
7
|
method: "DELETE",
|
|
8
8
|
headers: {
|
|
9
|
-
"x-
|
|
10
|
-
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
9
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
11
10
|
"Origin": process.env.FLOWRIX_API_ORIGIN,
|
|
12
11
|
"Authorization": `Bearer ${accessTok || ""}`
|
|
13
12
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { defineEventHandler } from "h3";
|
|
1
|
+
import { defineEventHandler, getCookie } from "h3";
|
|
2
2
|
export default defineEventHandler(async (event) => {
|
|
3
3
|
const accessTok = getCookie(event, "auth.token");
|
|
4
4
|
try {
|
|
5
5
|
const response = await $fetch(`${process.env.FLOWRIX_API_BASE}customer/cards`, {
|
|
6
6
|
headers: {
|
|
7
|
-
"x-
|
|
8
|
-
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
7
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
9
8
|
"Origin": process.env.FLOWRIX_API_ORIGIN,
|
|
10
9
|
"Authorization": `Bearer ${accessTok || ""}`
|
|
11
10
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineEventHandler, readBody } from "h3";
|
|
1
|
+
import { defineEventHandler, readBody, getCookie } from "h3";
|
|
2
2
|
export default defineEventHandler(async (event) => {
|
|
3
3
|
const accessTok = getCookie(event, "auth.token");
|
|
4
4
|
const body = await readBody(event);
|
|
@@ -6,8 +6,7 @@ export default defineEventHandler(async (event) => {
|
|
|
6
6
|
const response = await fetch(`${process.env.FLOWRIX_API_BASE}customer/change-password`, {
|
|
7
7
|
method: "POST",
|
|
8
8
|
headers: {
|
|
9
|
-
"x-
|
|
10
|
-
"x-api-secret": process.env.FLOWRIX_API_SECRET || "",
|
|
9
|
+
"x-public-key": process.env.FLOWRIX_API_KEY || "",
|
|
11
10
|
"Origin": process.env.FLOWRIX_API_ORIGIN || "",
|
|
12
11
|
"Authorization": `Bearer ${accessTok || ""}`,
|
|
13
12
|
"Content-Type": "application/json",
|
|
@@ -6,8 +6,7 @@ export default defineEventHandler(async (event) => {
|
|
|
6
6
|
const checkoutResponse = await $fetch(`${process.env.FLOWRIX_API_BASE}customer/checkout`, {
|
|
7
7
|
method: "POST",
|
|
8
8
|
headers: {
|
|
9
|
-
"x-
|
|
10
|
-
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
9
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
11
10
|
"Origin": process.env.FLOWRIX_API_ORIGIN
|
|
12
11
|
},
|
|
13
12
|
body
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { defineEventHandler } from "h3";
|
|
1
|
+
import { defineEventHandler, getCookie } from "h3";
|
|
2
2
|
export default defineEventHandler(async (event) => {
|
|
3
3
|
const accessTok = getCookie(event, "auth.token");
|
|
4
4
|
try {
|
|
5
5
|
const response = await $fetch(`${process.env.FLOWRIX_API_BASE}customer/orders`, {
|
|
6
6
|
headers: {
|
|
7
|
-
"x-
|
|
8
|
-
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
7
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
9
8
|
"Origin": process.env.FLOWRIX_API_ORIGIN,
|
|
10
9
|
"Authorization": `Bearer ${accessTok || ""}`
|
|
11
10
|
}
|
|
@@ -6,8 +6,7 @@ export default defineEventHandler(async (event) => {
|
|
|
6
6
|
const response = await fetch(`${process.env.FLOWRIX_API_BASE}customer/profile/update`, {
|
|
7
7
|
method: "POST",
|
|
8
8
|
headers: {
|
|
9
|
-
"x-
|
|
10
|
-
"x-api-secret": process.env.FLOWRIX_API_SECRET || "",
|
|
9
|
+
"x-public-key": process.env.FLOWRIX_API_KEY || "",
|
|
11
10
|
"Origin": process.env.FLOWRIX_API_ORIGIN || "",
|
|
12
11
|
"Authorization": `Bearer ${accessTok || ""}`,
|
|
13
12
|
"Content-Type": "application/json",
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { defineEventHandler } from "h3";
|
|
1
|
+
import { defineEventHandler, getCookie } from "h3";
|
|
2
2
|
export default defineEventHandler(async (event) => {
|
|
3
3
|
const accessTok = getCookie(event, "auth.token");
|
|
4
4
|
try {
|
|
5
5
|
const response = await $fetch(`${process.env.FLOWRIX_API_BASE}customer/quotations`, {
|
|
6
6
|
headers: {
|
|
7
|
-
"x-
|
|
8
|
-
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
7
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
9
8
|
"Origin": process.env.FLOWRIX_API_ORIGIN,
|
|
10
9
|
"Authorization": `Bearer ${accessTok || ""}`
|
|
11
10
|
}
|
|
@@ -5,8 +5,7 @@ export default defineEventHandler(async (event) => {
|
|
|
5
5
|
const search = await $fetch(`${process.env.FLOWRIX_API_BASE}customers/search`, {
|
|
6
6
|
method: "POST",
|
|
7
7
|
headers: {
|
|
8
|
-
"x-
|
|
9
|
-
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
8
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
10
9
|
"Origin": process.env.FLOWRIX_API_ORIGIN
|
|
11
10
|
},
|
|
12
11
|
body
|
|
@@ -11,8 +11,7 @@ export default defineEventHandler(async (event) => {
|
|
|
11
11
|
`${process.env.FLOWRIX_API_BASE}customer/orders/${orderNo}/tax-invoice`,
|
|
12
12
|
{
|
|
13
13
|
headers: {
|
|
14
|
-
"x-
|
|
15
|
-
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
14
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
16
15
|
"Origin": process.env.FLOWRIX_API_ORIGIN,
|
|
17
16
|
"Authorization": `Bearer ${accessTok || ""}`
|
|
18
17
|
}
|