flowrix 1.0.1-beta.155 → 1.0.1-beta.157
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.json +1 -1
- package/dist/module.mjs +23 -192
- package/dist/runtime/components/Types/page/index.d.vue.ts +5 -4
- package/dist/runtime/components/Types/page/index.vue +7 -11
- package/dist/runtime/components/Types/page/index.vue.d.ts +5 -4
- package/dist/runtime/composables/Blog/useBlogSingle.js +4 -5
- package/dist/runtime/composables/Category/useCategoryIndex.js +5 -5
- package/dist/runtime/composables/Checkout/useCheckout.d.ts +4 -0
- package/dist/runtime/composables/Checkout/useCheckout.js +15 -3
- package/dist/runtime/composables/Customer/useBillingAddress.d.ts +3 -0
- package/dist/runtime/composables/Customer/useBillingAddress.js +2 -0
- package/dist/runtime/composables/Customer/useShippingAddress.d.ts +3 -0
- package/dist/runtime/composables/Customer/useShippingAddress.js +2 -1
- package/dist/runtime/composables/Customer/useWishlists.d.ts +1 -1
- package/dist/runtime/composables/Product/CustomProduct/useCustomeScript.d.ts +4 -0
- package/dist/runtime/composables/Product/CustomProduct/useCustomeScript.js +5 -11
- package/dist/runtime/composables/Product/useProductCard.d.ts +90 -9
- package/dist/runtime/composables/Product/useProductCard.js +257 -55
- package/dist/runtime/composables/Product/useProductComponent.js +3 -10
- package/dist/runtime/composables/Product/useQuickView.d.ts +1 -1
- package/dist/runtime/composables/Product/useService.d.ts +1 -12
- package/dist/runtime/composables/Product/useService.js +2 -2
- package/dist/runtime/composables/index.d.ts +1 -1
- package/dist/runtime/composables/index.js +1 -1
- package/dist/runtime/composables/useAddresses.js +27 -6
- package/dist/runtime/composables/useApp.js +3 -4
- package/dist/runtime/composables/useCards.js +0 -1
- package/dist/runtime/composables/useClientApi.d.ts +8 -8
- package/dist/runtime/composables/useClientApi.js +74 -30
- package/dist/runtime/composables/useLocation.d.ts +3 -15
- package/dist/runtime/composables/useLocation.js +6 -27
- package/dist/runtime/composables/usePriceCalculation.d.ts +33 -0
- package/dist/runtime/composables/usePriceCalculation.js +107 -0
- package/dist/runtime/composables/useQuotationCheckout.d.ts +1 -1
- package/dist/runtime/middleware/flowrix.d.ts +5 -5
- package/dist/runtime/middleware/flowrix.js +2 -2
- package/dist/runtime/middleware/flowrixs3.d.ts +3 -0
- package/dist/runtime/middleware/flowrixs3.js +65 -0
- package/dist/runtime/pages/flowrix-default.vue +62 -15
- package/dist/runtime/plugins/full-reload.client.d.ts +2 -0
- package/dist/runtime/plugins/full-reload.client.js +28 -0
- package/dist/runtime/server/api/albums.d.ts +0 -1
- package/dist/runtime/server/api/albums.js +13 -40
- package/dist/runtime/server/api/auth/login.d.ts +0 -18
- package/dist/runtime/server/api/auth/login.js +0 -57
- package/dist/runtime/server/api/banners.d.ts +0 -1
- package/dist/runtime/server/api/banners.js +13 -40
- package/dist/runtime/server/api/brand/[...slug].d.ts +0 -1
- package/dist/runtime/server/api/brand/[...slug].js +14 -43
- package/dist/runtime/server/api/brand/index.d.ts +0 -1
- package/dist/runtime/server/api/brand/index.js +13 -39
- package/dist/runtime/server/api/cache/[...slug].delete.js +1 -2
- package/dist/runtime/server/api/cache/clean.get.js +1 -2
- package/dist/runtime/server/api/cart/[slug]/add.d.ts +0 -2
- package/dist/runtime/server/api/cart/[slug]/add.js +0 -21
- package/dist/runtime/server/api/cart/[slug]/update.d.ts +0 -2
- package/dist/runtime/server/api/cart/[slug]/update.js +0 -21
- package/dist/runtime/server/api/cart/related.d.ts +0 -2
- package/dist/runtime/server/api/cart/related.js +0 -34
- package/dist/runtime/server/api/cart/remove.d.ts +0 -2
- package/dist/runtime/server/api/cart/remove.js +0 -21
- package/dist/runtime/server/api/catalog/brands.d.ts +0 -1
- package/dist/runtime/server/api/catalog/brands.js +13 -45
- package/dist/runtime/server/api/catalog/categories.d.ts +0 -1
- package/dist/runtime/server/api/catalog/categories.js +13 -45
- package/dist/runtime/server/api/catalog/categoriesall.d.ts +0 -1
- package/dist/runtime/server/api/catalog/categoriesall.js +13 -45
- package/dist/runtime/server/api/catalog/featured.d.ts +0 -1
- package/dist/runtime/server/api/catalog/featured.js +13 -45
- package/dist/runtime/server/api/catalog/posts.d.ts +0 -1
- package/dist/runtime/server/api/catalog/posts.js +13 -45
- package/dist/runtime/server/api/catalog/samples.d.ts +0 -1
- package/dist/runtime/server/api/catalog/samples.js +13 -46
- package/dist/runtime/server/api/catalog/search.d.ts +0 -1
- package/dist/runtime/server/api/catalog/search.js +13 -46
- package/dist/runtime/server/api/category/[...slug].d.ts +1 -2
- package/dist/runtime/server/api/category/[...slug].js +34 -49
- package/dist/runtime/server/api/checkout/applyCoupon.d.ts +0 -2
- package/dist/runtime/server/api/checkout/applyCoupon.js +0 -20
- package/dist/runtime/server/api/checkout/configs.d.ts +0 -2
- package/dist/runtime/server/api/checkout/configs.js +0 -20
- package/dist/runtime/server/api/checkout/countries.d.ts +0 -2
- package/dist/runtime/server/api/checkout/countries.js +0 -13
- package/dist/runtime/server/api/checkout/paymentmethod.d.ts +0 -2
- package/dist/runtime/server/api/checkout/paymentmethod.js +0 -25
- package/dist/runtime/server/api/checkout/quotation/guest/customer.d.ts +0 -2
- package/dist/runtime/server/api/checkout/quotation/guest/customer.js +0 -20
- package/dist/runtime/server/api/checkvariables.js +1 -2
- package/dist/runtime/server/api/cmspost/[...slug].d.ts +0 -1
- package/dist/runtime/server/api/cmspost/[...slug].js +14 -44
- package/dist/runtime/server/api/cmspost/all.js +1 -2
- package/dist/runtime/server/api/company/profile.d.ts +1 -1
- package/dist/runtime/server/api/company/profile.js +13 -17
- package/dist/runtime/server/api/contact-center/webforms/[id]/details.d.ts +0 -3
- package/dist/runtime/server/api/contact-center/webforms/[id]/details.js +0 -54
- package/dist/runtime/server/api/countries.js +13 -38
- package/dist/runtime/server/api/customer/wishlist/deleteFromWishList.d.ts +0 -2
- package/dist/runtime/server/api/customer/wishlist/deleteFromWishList.js +0 -45
- package/dist/runtime/server/api/featured.d.ts +0 -3
- package/dist/runtime/server/api/featured.js +0 -52
- package/dist/runtime/server/api/generate/robots.get.js +0 -2
- package/dist/runtime/server/api/generate/sitemap.get.d.ts +1 -1
- package/dist/runtime/server/api/generate/sitemap.get.js +8 -12
- package/dist/runtime/server/api/global/[...slug].js +20 -0
- package/dist/runtime/server/api/location.d.ts +0 -2
- package/dist/runtime/server/api/location.js +0 -25
- package/dist/runtime/server/api/nav/[id]/links.d.ts +0 -1
- package/dist/runtime/server/api/nav/[id]/links.js +13 -43
- package/dist/runtime/server/api/page/[...slug].d.ts +0 -1
- package/dist/runtime/server/api/page/[...slug].js +14 -44
- package/dist/runtime/server/api/permalink/[...slug].get.js +31 -0
- package/dist/runtime/server/api/product/[...slug].d.ts +0 -1
- package/dist/runtime/server/api/product/[...slug].js +14 -49
- package/dist/runtime/server/api/quickview/[slug].d.ts +1 -1
- package/dist/runtime/server/api/quickview/[slug].js +15 -16
- package/dist/runtime/server/api/reviews.d.ts +1 -1
- package/dist/runtime/server/api/reviews.js +1 -2
- package/dist/runtime/server/api/reviews3.js +19 -0
- package/dist/runtime/server/api/samples.d.ts +0 -1
- package/dist/runtime/server/api/samples.js +13 -46
- package/dist/runtime/server/api/search.d.ts +0 -1
- package/dist/runtime/server/api/search.js +13 -46
- package/dist/runtime/server/api/service/[slug].d.ts +0 -1
- package/dist/runtime/server/api/service/[slug].js +13 -44
- package/dist/runtime/server/api/service/availability.d.ts +1 -1
- package/dist/runtime/server/api/service/getall.d.ts +0 -1
- package/dist/runtime/server/api/service/getall.js +13 -51
- package/dist/runtime/server/api/shop.d.ts +0 -1
- package/dist/runtime/server/api/shop.js +13 -46
- package/dist/runtime/server/api/subscribe.d.ts +0 -2
- package/dist/runtime/server/api/subscribe.js +0 -25
- package/dist/runtime/server/api/webform.d.ts +0 -3
- package/dist/runtime/server/api/webform.js +0 -54
- package/dist/runtime/server/middleware/powertools.d.ts +9 -0
- package/dist/runtime/server/middleware/powertools.js +30 -0
- package/dist/runtime/stores/Booking.js +23 -7
- package/dist/runtime/stores/Cart.js +18 -3
- package/dist/runtime/stores/Checkout.js +14 -3
- package/dist/runtime/stores/NavMenu.js +2 -4
- package/dist/runtime/stores/Search.js +9 -3
- package/dist/runtime/stores/auth.d.ts +28 -1
- package/dist/runtime/stores/auth.js +0 -5
- package/dist/runtime/stores/countries.js +1 -1
- package/dist/runtime/stores/index.d.ts +0 -1
- package/dist/runtime/stores/index.js +0 -1
- package/dist/runtime/stores/locations.d.ts +1 -5
- package/dist/runtime/stores/locations.js +8 -5
- package/dist/runtime/stores/product.js +9 -3
- package/dist/runtime/stores/promotions.d.ts +51 -0
- package/dist/runtime/stores/promotions.js +65 -0
- package/dist/runtime/stores/useCompanyProfile.js +5 -2
- package/dist/runtime/stores/wishlists.d.ts +1 -1
- package/dist/runtime/stores/wishlists.js +1 -1
- package/package.json +11 -3
- package/dist/runtime/composables/useLocations.d.ts +0 -12
- package/dist/runtime/composables/useLocations.js +0 -53
- package/dist/runtime/server/api/auth/forgot.d.ts +0 -5
- package/dist/runtime/server/api/auth/forgot.js +0 -43
- package/dist/runtime/server/api/auth/logout.d.ts +0 -5
- package/dist/runtime/server/api/auth/logout.js +0 -22
- package/dist/runtime/server/api/auth/register.js +0 -50
- package/dist/runtime/server/api/auth/session.get.js +0 -44
- package/dist/runtime/server/api/auth/user/reset-password.d.ts +0 -5
- package/dist/runtime/server/api/auth/user/reset-password.js +0 -39
- package/dist/runtime/server/api/auth/user/session.js +0 -42
- package/dist/runtime/server/api/auth/user/verify-token.d.ts +0 -6
- package/dist/runtime/server/api/auth/user/verify-token.js +0 -49
- package/dist/runtime/server/api/cart/service/[slug]/add.d.ts +0 -2
- package/dist/runtime/server/api/cart/service/[slug]/add.js +0 -16
- package/dist/runtime/server/api/check-404.d.ts +0 -4
- package/dist/runtime/server/api/check-404.js +0 -8
- package/dist/runtime/server/api/checkout/quotation/[slug].d.ts +0 -2
- package/dist/runtime/server/api/checkout/quotation/[slug].js +0 -20
- package/dist/runtime/server/api/checkout/quotation/guest/[slug].d.ts +0 -2
- package/dist/runtime/server/api/checkout/quotation/guest/[slug].js +0 -35
- package/dist/runtime/server/api/checkout/quotation/submit/[slug].d.ts +0 -2
- package/dist/runtime/server/api/checkout/quotation/submit/[slug].js +0 -22
- package/dist/runtime/server/api/contact-center/webforms/create.d.ts +0 -2
- package/dist/runtime/server/api/contact-center/webforms/create.js +0 -20
- package/dist/runtime/server/api/customer/address/add.d.ts +0 -14
- package/dist/runtime/server/api/customer/address/add.js +0 -32
- package/dist/runtime/server/api/customer/address/delete.d.ts +0 -20
- package/dist/runtime/server/api/customer/address/delete.js +0 -36
- package/dist/runtime/server/api/customer/address/setshipping.d.ts +0 -20
- package/dist/runtime/server/api/customer/address/setshipping.js +0 -40
- package/dist/runtime/server/api/customer/address/update.d.ts +0 -20
- package/dist/runtime/server/api/customer/address/update.js +0 -41
- package/dist/runtime/server/api/customer/cards/delete.d.ts +0 -2
- package/dist/runtime/server/api/customer/cards/delete.js +0 -22
- package/dist/runtime/server/api/customer/cards/get.d.ts +0 -2
- package/dist/runtime/server/api/customer/cards/get.js +0 -16
- package/dist/runtime/server/api/customer/change-password.d.ts +0 -14
- package/dist/runtime/server/api/customer/change-password.js +0 -33
- package/dist/runtime/server/api/customer/checkout.d.ts +0 -2
- package/dist/runtime/server/api/customer/checkout.js +0 -19
- package/dist/runtime/server/api/customer/orders.d.ts +0 -2
- package/dist/runtime/server/api/customer/orders.js +0 -16
- package/dist/runtime/server/api/customer/profile/update.d.ts +0 -14
- package/dist/runtime/server/api/customer/profile/update.js +0 -33
- package/dist/runtime/server/api/customer/quotations.d.ts +0 -2
- package/dist/runtime/server/api/customer/quotations.js +0 -16
- package/dist/runtime/server/api/customer/search.d.ts +0 -2
- package/dist/runtime/server/api/customer/search.js +0 -14
- package/dist/runtime/server/api/customer/tax-invoice.d.ts +0 -8
- package/dist/runtime/server/api/customer/tax-invoice.js +0 -35
- package/dist/runtime/server/api/customer/wishlist/add.d.ts +0 -2
- package/dist/runtime/server/api/customer/wishlist/add.js +0 -29
- package/dist/runtime/server/api/customer/wishlist/createWishList.d.ts +0 -2
- package/dist/runtime/server/api/customer/wishlist/createWishList.js +0 -28
- package/dist/runtime/server/api/customer/wishlist/deleteWishList.d.ts +0 -2
- package/dist/runtime/server/api/customer/wishlist/deleteWishList.js +0 -29
- package/dist/runtime/server/api/customer/wishlist/get.d.ts +0 -2
- package/dist/runtime/server/api/customer/wishlist/get.js +0 -16
- package/dist/runtime/server/api/customer/wishlist/getWishListItems.d.ts +0 -2
- package/dist/runtime/server/api/customer/wishlist/getWishListItems.js +0 -20
- package/dist/runtime/server/api/customer/wishlist/updateWishList.d.ts +0 -2
- package/dist/runtime/server/api/customer/wishlist/updateWishList.js +0 -29
- package/dist/runtime/server/api/v2/[...slug].get.d.ts +0 -2
- package/dist/runtime/server/api/v2/[...slug].get.js +0 -34
- package/dist/runtime/stores/IpLocation.d.ts +0 -109
- package/dist/runtime/stores/IpLocation.js +0 -107
- package/dist/runtime/utils/api.d.ts +0 -13
- package/dist/runtime/utils/api.js +0 -96
- /package/dist/runtime/server/api/{auth/register.d.ts → global/[...slug].d.ts} +0 -0
- /package/dist/runtime/server/api/{auth/session.get.d.ts → permalink/[...slug].get.d.ts} +0 -0
- /package/dist/runtime/server/api/{auth/user/session.d.ts → reviews3.d.ts} +0 -0
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { defineEventHandler, getCookie, getQuery } from "h3";
|
|
2
|
-
export default defineEventHandler(async (event) => {
|
|
3
|
-
const accessTok = getCookie(event, "auth.token");
|
|
4
|
-
const { addressId } = getQuery(event);
|
|
5
|
-
if (!addressId) {
|
|
6
|
-
return {
|
|
7
|
-
status: "Error",
|
|
8
|
-
statusCode: 400,
|
|
9
|
-
message: "Address ID is required"
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
try {
|
|
13
|
-
const response = await $fetch(`${process.env.FLOWRIX_API_BASE}customer/address/${addressId}/setshipping`, {
|
|
14
|
-
method: "POST",
|
|
15
|
-
headers: {
|
|
16
|
-
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
17
|
-
"Origin": process.env.FLOWRIX_API_ORIGIN,
|
|
18
|
-
"Authorization": `Bearer ${accessTok || ""}`,
|
|
19
|
-
"Content-Type": "application/json",
|
|
20
|
-
"Accept": "application/json"
|
|
21
|
-
},
|
|
22
|
-
body: JSON.stringify({ shipping: 1 })
|
|
23
|
-
// Explicitly set shipping to 1
|
|
24
|
-
});
|
|
25
|
-
return {
|
|
26
|
-
status: "Success",
|
|
27
|
-
statusCode: 200,
|
|
28
|
-
data: response,
|
|
29
|
-
message: "Shipping address set successfully"
|
|
30
|
-
};
|
|
31
|
-
} catch (error) {
|
|
32
|
-
console.error("Error setting default address:", error);
|
|
33
|
-
return {
|
|
34
|
-
status: "Error",
|
|
35
|
-
statusCode: 500,
|
|
36
|
-
message: "Failed to set shipping address",
|
|
37
|
-
error: error.message
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<{
|
|
2
|
-
status: string;
|
|
3
|
-
statusCode: number;
|
|
4
|
-
message: string;
|
|
5
|
-
data?: undefined;
|
|
6
|
-
error?: undefined;
|
|
7
|
-
} | {
|
|
8
|
-
status: string;
|
|
9
|
-
statusCode: number;
|
|
10
|
-
data: unknown;
|
|
11
|
-
message: string;
|
|
12
|
-
error?: undefined;
|
|
13
|
-
} | {
|
|
14
|
-
status: string;
|
|
15
|
-
statusCode: any;
|
|
16
|
-
message: any;
|
|
17
|
-
error: any;
|
|
18
|
-
data?: undefined;
|
|
19
|
-
}>>;
|
|
20
|
-
export default _default;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { defineEventHandler, readBody, getCookie, getQuery } from "h3";
|
|
2
|
-
export default defineEventHandler(async (event) => {
|
|
3
|
-
const accessTok = getCookie(event, "auth.token");
|
|
4
|
-
const body = await readBody(event);
|
|
5
|
-
const { addressId } = getQuery(event);
|
|
6
|
-
console.log(body, "Received request to update address", accessTok, "addressId:", addressId);
|
|
7
|
-
if (!addressId) {
|
|
8
|
-
return {
|
|
9
|
-
status: "Error",
|
|
10
|
-
statusCode: 400,
|
|
11
|
-
message: "Address ID is required"
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
try {
|
|
15
|
-
const response = await $fetch(`${process.env.FLOWRIX_API_BASE}customer/address/${addressId}/update`, {
|
|
16
|
-
method: "PATCH",
|
|
17
|
-
headers: {
|
|
18
|
-
"x-public-key": process.env.FLOWRIX_API_KEY || "",
|
|
19
|
-
"Origin": process.env.FLOWRIX_API_ORIGIN || "",
|
|
20
|
-
"Authorization": `Bearer ${accessTok || ""}`,
|
|
21
|
-
"Content-Type": "application/json",
|
|
22
|
-
"Accept": "application/json"
|
|
23
|
-
},
|
|
24
|
-
body: JSON.stringify(body)
|
|
25
|
-
});
|
|
26
|
-
return {
|
|
27
|
-
status: "Success",
|
|
28
|
-
statusCode: 200,
|
|
29
|
-
data: response,
|
|
30
|
-
message: "Address updated successfully"
|
|
31
|
-
};
|
|
32
|
-
} catch (error) {
|
|
33
|
-
console.error("Error in address update:", error);
|
|
34
|
-
return {
|
|
35
|
-
status: "Error",
|
|
36
|
-
statusCode: error?.statusCode || 500,
|
|
37
|
-
message: error?.data?.message || "Failed to update address",
|
|
38
|
-
error: error.message
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
});
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { defineEventHandler, getCookie } from "h3";
|
|
2
|
-
export default defineEventHandler(async (event) => {
|
|
3
|
-
const accessTok = getCookie(event, "auth.token");
|
|
4
|
-
const { cardId } = getQuery(event);
|
|
5
|
-
try {
|
|
6
|
-
const response = await $fetch(`${process.env.FLOWRIX_API_BASE}customer/cards/${cardId}`, {
|
|
7
|
-
method: "DELETE",
|
|
8
|
-
headers: {
|
|
9
|
-
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
10
|
-
"Origin": process.env.FLOWRIX_API_ORIGIN,
|
|
11
|
-
"Authorization": `Bearer ${accessTok || ""}`
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
return response;
|
|
15
|
-
} catch (error) {
|
|
16
|
-
console.error("Error deleting card:", error);
|
|
17
|
-
throw createError({
|
|
18
|
-
statusCode: error.statusCode || 500,
|
|
19
|
-
statusMessage: error.statusMessage || "Failed to delete card"
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { defineEventHandler, getCookie } from "h3";
|
|
2
|
-
export default defineEventHandler(async (event) => {
|
|
3
|
-
const accessTok = getCookie(event, "auth.token");
|
|
4
|
-
try {
|
|
5
|
-
const response = await $fetch(`${process.env.FLOWRIX_API_BASE}customer/cards`, {
|
|
6
|
-
headers: {
|
|
7
|
-
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
8
|
-
"Origin": process.env.FLOWRIX_API_ORIGIN,
|
|
9
|
-
"Authorization": `Bearer ${accessTok || ""}`
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
return response;
|
|
13
|
-
} catch (error) {
|
|
14
|
-
console.error("Error fetching customer cards:", error);
|
|
15
|
-
}
|
|
16
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<{
|
|
2
|
-
status: string;
|
|
3
|
-
statusCode: number;
|
|
4
|
-
data: any;
|
|
5
|
-
message: any;
|
|
6
|
-
error?: undefined;
|
|
7
|
-
} | {
|
|
8
|
-
status: string;
|
|
9
|
-
statusCode: number;
|
|
10
|
-
message: string;
|
|
11
|
-
error: any;
|
|
12
|
-
data?: undefined;
|
|
13
|
-
}>>;
|
|
14
|
-
export default _default;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { defineEventHandler, readBody, getCookie } from "h3";
|
|
2
|
-
export default defineEventHandler(async (event) => {
|
|
3
|
-
const accessTok = getCookie(event, "auth.token");
|
|
4
|
-
const body = await readBody(event);
|
|
5
|
-
try {
|
|
6
|
-
const response = await fetch(`${process.env.FLOWRIX_API_BASE}customer/change-password`, {
|
|
7
|
-
method: "POST",
|
|
8
|
-
headers: {
|
|
9
|
-
"x-public-key": process.env.FLOWRIX_API_KEY || "",
|
|
10
|
-
"Origin": process.env.FLOWRIX_API_ORIGIN || "",
|
|
11
|
-
"Authorization": `Bearer ${accessTok || ""}`,
|
|
12
|
-
"Content-Type": "application/json",
|
|
13
|
-
"Accept": "application/json"
|
|
14
|
-
},
|
|
15
|
-
body: JSON.stringify(body)
|
|
16
|
-
});
|
|
17
|
-
const responseData = await response.json();
|
|
18
|
-
return {
|
|
19
|
-
status: response.ok ? "Success" : "Error",
|
|
20
|
-
statusCode: response.status,
|
|
21
|
-
data: responseData,
|
|
22
|
-
message: response.ok ? "Password updated successfully" : responseData.message || "Failed to update password"
|
|
23
|
-
};
|
|
24
|
-
} catch (error) {
|
|
25
|
-
console.error("Error in password update:", error);
|
|
26
|
-
return {
|
|
27
|
-
status: "Error",
|
|
28
|
-
statusCode: 500,
|
|
29
|
-
message: "Internal server error",
|
|
30
|
-
error: error.message
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
});
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { defineEventHandler, setResponseStatus, readBody } from "h3";
|
|
2
|
-
import { $fetch } from "ofetch";
|
|
3
|
-
export default defineEventHandler(async (event) => {
|
|
4
|
-
const body = await readBody(event);
|
|
5
|
-
try {
|
|
6
|
-
const checkoutResponse = await $fetch(`${process.env.FLOWRIX_API_BASE}customer/checkout`, {
|
|
7
|
-
method: "POST",
|
|
8
|
-
headers: {
|
|
9
|
-
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
10
|
-
"Origin": process.env.FLOWRIX_API_ORIGIN
|
|
11
|
-
},
|
|
12
|
-
body
|
|
13
|
-
});
|
|
14
|
-
return checkoutResponse;
|
|
15
|
-
} catch (error) {
|
|
16
|
-
setResponseStatus(event, error.status || 500);
|
|
17
|
-
return { success: false, error: error.message };
|
|
18
|
-
}
|
|
19
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { defineEventHandler, getCookie } from "h3";
|
|
2
|
-
export default defineEventHandler(async (event) => {
|
|
3
|
-
const accessTok = getCookie(event, "auth.token");
|
|
4
|
-
try {
|
|
5
|
-
const response = await $fetch(`${process.env.FLOWRIX_API_BASE}customer/orders`, {
|
|
6
|
-
headers: {
|
|
7
|
-
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
8
|
-
"Origin": process.env.FLOWRIX_API_ORIGIN,
|
|
9
|
-
"Authorization": `Bearer ${accessTok || ""}`
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
return response;
|
|
13
|
-
} catch (error) {
|
|
14
|
-
console.error("Error:", error);
|
|
15
|
-
}
|
|
16
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<{
|
|
2
|
-
status: string;
|
|
3
|
-
statusCode: number;
|
|
4
|
-
data: any;
|
|
5
|
-
message: any;
|
|
6
|
-
error?: undefined;
|
|
7
|
-
} | {
|
|
8
|
-
status: string;
|
|
9
|
-
statusCode: number;
|
|
10
|
-
message: string;
|
|
11
|
-
error: any;
|
|
12
|
-
data?: undefined;
|
|
13
|
-
}>>;
|
|
14
|
-
export default _default;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { defineEventHandler, readBody } from "h3";
|
|
2
|
-
export default defineEventHandler(async (event) => {
|
|
3
|
-
const accessTok = getCookie(event, "auth.token");
|
|
4
|
-
const body = await readBody(event);
|
|
5
|
-
try {
|
|
6
|
-
const response = await fetch(`${process.env.FLOWRIX_API_BASE}customer/profile/update`, {
|
|
7
|
-
method: "POST",
|
|
8
|
-
headers: {
|
|
9
|
-
"x-public-key": process.env.FLOWRIX_API_KEY || "",
|
|
10
|
-
"Origin": process.env.FLOWRIX_API_ORIGIN || "",
|
|
11
|
-
"Authorization": `Bearer ${accessTok || ""}`,
|
|
12
|
-
"Content-Type": "application/json",
|
|
13
|
-
"Accept": "application/json"
|
|
14
|
-
},
|
|
15
|
-
body: JSON.stringify(body)
|
|
16
|
-
});
|
|
17
|
-
const responseData = await response.json();
|
|
18
|
-
return {
|
|
19
|
-
status: response.ok ? "Success" : "Error",
|
|
20
|
-
statusCode: response.status,
|
|
21
|
-
data: responseData,
|
|
22
|
-
message: response.ok ? "Profile updated successfully" : responseData.message || "Failed to update profile"
|
|
23
|
-
};
|
|
24
|
-
} catch (error) {
|
|
25
|
-
console.error("Error in profile update:", error);
|
|
26
|
-
return {
|
|
27
|
-
status: "Error",
|
|
28
|
-
statusCode: 500,
|
|
29
|
-
message: "Internal server error",
|
|
30
|
-
error: error.message
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { defineEventHandler, getCookie } from "h3";
|
|
2
|
-
export default defineEventHandler(async (event) => {
|
|
3
|
-
const accessTok = getCookie(event, "auth.token");
|
|
4
|
-
try {
|
|
5
|
-
const response = await $fetch(`${process.env.FLOWRIX_API_BASE}customer/quotations`, {
|
|
6
|
-
headers: {
|
|
7
|
-
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
8
|
-
"Origin": process.env.FLOWRIX_API_ORIGIN,
|
|
9
|
-
"Authorization": `Bearer ${accessTok || ""}`
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
return response;
|
|
13
|
-
} catch (error) {
|
|
14
|
-
console.error("Error:", error);
|
|
15
|
-
}
|
|
16
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { defineEventHandler, readBody } from "h3";
|
|
2
|
-
import { $fetch } from "ofetch";
|
|
3
|
-
export default defineEventHandler(async (event) => {
|
|
4
|
-
const body = await readBody(event);
|
|
5
|
-
const search = await $fetch(`${process.env.FLOWRIX_API_BASE}customers/search`, {
|
|
6
|
-
method: "POST",
|
|
7
|
-
headers: {
|
|
8
|
-
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
9
|
-
"Origin": process.env.FLOWRIX_API_ORIGIN
|
|
10
|
-
},
|
|
11
|
-
body
|
|
12
|
-
});
|
|
13
|
-
return search;
|
|
14
|
-
});
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { defineEventHandler, getQuery, getCookie } from "h3";
|
|
2
|
-
export default defineEventHandler(async (event) => {
|
|
3
|
-
const accessTok = getCookie(event, "auth.token");
|
|
4
|
-
const { orderNo } = getQuery(event);
|
|
5
|
-
if (!orderNo) {
|
|
6
|
-
event.node.res.statusCode = 400;
|
|
7
|
-
return { error: "Order number is required" };
|
|
8
|
-
}
|
|
9
|
-
try {
|
|
10
|
-
const apiRes = await fetch(
|
|
11
|
-
`${process.env.FLOWRIX_API_BASE}customer/orders/${orderNo}/tax-invoice`,
|
|
12
|
-
{
|
|
13
|
-
headers: {
|
|
14
|
-
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
15
|
-
"Origin": process.env.FLOWRIX_API_ORIGIN,
|
|
16
|
-
"Authorization": `Bearer ${accessTok || ""}`
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
);
|
|
20
|
-
if (!apiRes.ok) {
|
|
21
|
-
throw new Error(`API failed: ${apiRes.statusText}`);
|
|
22
|
-
}
|
|
23
|
-
const buffer = await apiRes.arrayBuffer();
|
|
24
|
-
event.node.res.setHeader("Content-Type", "application/pdf");
|
|
25
|
-
event.node.res.setHeader(
|
|
26
|
-
"Content-Disposition",
|
|
27
|
-
`attachment; filename="tax-invoice-${orderNo}.pdf"`
|
|
28
|
-
);
|
|
29
|
-
return Buffer.from(buffer);
|
|
30
|
-
} catch (error) {
|
|
31
|
-
console.error("Error fetching tax invoice:", error);
|
|
32
|
-
event.node.res.statusCode = 500;
|
|
33
|
-
return { error: "Failed to generate tax invoice", details: error.message };
|
|
34
|
-
}
|
|
35
|
-
});
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { defineEventHandler, readBody } from "h3";
|
|
2
|
-
export default defineEventHandler(async (event) => {
|
|
3
|
-
const accessTok = getCookie(event, "auth.token");
|
|
4
|
-
const body = await readBody(event);
|
|
5
|
-
const { listId, productSlug } = getQuery(event);
|
|
6
|
-
try {
|
|
7
|
-
const response = await fetch(`${process.env.FLOWRIX_API_BASE}customer/wishlist/${listId}/${productSlug}/add`, {
|
|
8
|
-
method: "POST",
|
|
9
|
-
headers: {
|
|
10
|
-
"x-public-key": process.env.FLOWRIX_API_KEY || "",
|
|
11
|
-
"Origin": process.env.FLOWRIX_API_ORIGIN || "",
|
|
12
|
-
"Authorization": `Bearer ${accessTok || ""}`,
|
|
13
|
-
"Content-Type": "application/json",
|
|
14
|
-
"Accept": "application/json"
|
|
15
|
-
},
|
|
16
|
-
body: JSON.stringify(body)
|
|
17
|
-
});
|
|
18
|
-
const responseData = await response.json();
|
|
19
|
-
return responseData;
|
|
20
|
-
} catch (error) {
|
|
21
|
-
console.error("Error in add to wishlist:", error);
|
|
22
|
-
return {
|
|
23
|
-
status: "Error",
|
|
24
|
-
statusCode: 500,
|
|
25
|
-
message: "Internal server error",
|
|
26
|
-
error: error.message || "Unknown error"
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
});
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { defineEventHandler, readBody } from "h3";
|
|
2
|
-
export default defineEventHandler(async (event) => {
|
|
3
|
-
const body = await readBody(event);
|
|
4
|
-
const accessTok = getCookie(event, "auth.token");
|
|
5
|
-
try {
|
|
6
|
-
const response = await fetch(`${process.env.FLOWRIX_API_BASE}customer/wishlist/add`, {
|
|
7
|
-
method: "POST",
|
|
8
|
-
headers: {
|
|
9
|
-
"x-public-key": process.env.FLOWRIX_API_KEY || "",
|
|
10
|
-
"Origin": process.env.FLOWRIX_API_ORIGIN || "",
|
|
11
|
-
"Authorization": `Bearer ${accessTok || ""}`,
|
|
12
|
-
"Content-Type": "application/json",
|
|
13
|
-
"Accept": "application/json"
|
|
14
|
-
},
|
|
15
|
-
body: JSON.stringify(body)
|
|
16
|
-
});
|
|
17
|
-
const responseData = await response.json();
|
|
18
|
-
return responseData;
|
|
19
|
-
} catch (error) {
|
|
20
|
-
console.error("Error in create wishlist:", error);
|
|
21
|
-
return {
|
|
22
|
-
status: "Error",
|
|
23
|
-
statusCode: 500,
|
|
24
|
-
message: "Internal server error",
|
|
25
|
-
error: error.message || "Unknown error"
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
});
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { defineEventHandler, readBody } from "h3";
|
|
2
|
-
export default defineEventHandler(async (event) => {
|
|
3
|
-
const body = await readBody(event);
|
|
4
|
-
const accessTok = getCookie(event, "auth.token");
|
|
5
|
-
try {
|
|
6
|
-
const { id } = body;
|
|
7
|
-
const response = await fetch(`${process.env.FLOWRIX_API_BASE}customer/wishlist/${id}/delete`, {
|
|
8
|
-
method: "POST",
|
|
9
|
-
headers: {
|
|
10
|
-
"x-public-key": process.env.FLOWRIX_API_KEY || "",
|
|
11
|
-
"Origin": process.env.FLOWRIX_API_ORIGIN || "",
|
|
12
|
-
"Authorization": `Bearer ${accessTok || ""}`,
|
|
13
|
-
"Content-Type": "application/json",
|
|
14
|
-
"Accept": "application/json"
|
|
15
|
-
},
|
|
16
|
-
body: JSON.stringify(body)
|
|
17
|
-
});
|
|
18
|
-
const responseData = await response.json();
|
|
19
|
-
return responseData;
|
|
20
|
-
} catch (error) {
|
|
21
|
-
console.error("Error in delete wishlist:", error);
|
|
22
|
-
return {
|
|
23
|
-
status: "Error",
|
|
24
|
-
statusCode: 500,
|
|
25
|
-
message: "Internal server error",
|
|
26
|
-
error: error.message || "Unknown error"
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { defineEventHandler, getCookie } from "h3";
|
|
2
|
-
export default defineEventHandler(async (event) => {
|
|
3
|
-
const accessTok = getCookie(event, "auth.token");
|
|
4
|
-
try {
|
|
5
|
-
const response = await $fetch(`${process.env.FLOWRIX_API_BASE}customer/wishlist`, {
|
|
6
|
-
headers: {
|
|
7
|
-
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
8
|
-
"Origin": process.env.FLOWRIX_API_ORIGIN,
|
|
9
|
-
"Authorization": `Bearer ${accessTok || ""}`
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
return response;
|
|
13
|
-
} catch (error) {
|
|
14
|
-
console.error("Error:", error);
|
|
15
|
-
}
|
|
16
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { defineEventHandler, getQuery, getCookie } from "h3";
|
|
2
|
-
export default defineEventHandler(async (event) => {
|
|
3
|
-
const { listId } = getQuery(event);
|
|
4
|
-
const accessTok = getCookie(event, "auth.token");
|
|
5
|
-
try {
|
|
6
|
-
const response = await fetch(`${process.env.FLOWRIX_API_BASE}customer/wishlist/${listId}/products`, {
|
|
7
|
-
method: "GET",
|
|
8
|
-
headers: {
|
|
9
|
-
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
10
|
-
"Origin": process.env.FLOWRIX_API_ORIGIN,
|
|
11
|
-
"Authorization": `Bearer ${accessTok || ""}`
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
const responseData = await response.json();
|
|
15
|
-
return responseData;
|
|
16
|
-
} catch (error) {
|
|
17
|
-
console.error("Error in get wishlist items:", error);
|
|
18
|
-
return { error: "Failed to fetch wishlist items" };
|
|
19
|
-
}
|
|
20
|
-
});
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { defineEventHandler, readBody, getCookie } from "h3";
|
|
2
|
-
export default defineEventHandler(async (event) => {
|
|
3
|
-
const body = await readBody(event);
|
|
4
|
-
const accessTok = getCookie(event, "auth.token");
|
|
5
|
-
try {
|
|
6
|
-
const { id } = body;
|
|
7
|
-
const response = await fetch(`${process.env.FLOWRIX_API_BASE}customer/wishlist/${id}/update`, {
|
|
8
|
-
method: "POST",
|
|
9
|
-
headers: {
|
|
10
|
-
"x-public-key": process.env.FLOWRIX_API_KEY || "",
|
|
11
|
-
"Origin": process.env.FLOWRIX_API_ORIGIN || "",
|
|
12
|
-
"Authorization": `Bearer ${accessTok || ""}`,
|
|
13
|
-
"Content-Type": "application/json",
|
|
14
|
-
"Accept": "application/json"
|
|
15
|
-
},
|
|
16
|
-
body: JSON.stringify(body)
|
|
17
|
-
});
|
|
18
|
-
const responseData = await response.json();
|
|
19
|
-
return responseData;
|
|
20
|
-
} catch (error) {
|
|
21
|
-
console.error("Error in update wishlist:", error);
|
|
22
|
-
return {
|
|
23
|
-
status: "Error",
|
|
24
|
-
statusCode: 500,
|
|
25
|
-
message: "Internal server error",
|
|
26
|
-
error: error.message || "Unknown error"
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
});
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { defineEventHandler, getQuery } from "h3";
|
|
2
|
-
import { flowrixApi } from "../../../middleware/flowrix.js";
|
|
3
|
-
import { useRuntimeConfig } from "#imports";
|
|
4
|
-
import { existsSync } from "fs";
|
|
5
|
-
import { join } from "path";
|
|
6
|
-
import { rm } from "fs/promises";
|
|
7
|
-
export default defineEventHandler(async (event) => {
|
|
8
|
-
let query = getQuery(event);
|
|
9
|
-
const slug = event.context.params._;
|
|
10
|
-
const config = useRuntimeConfig();
|
|
11
|
-
const rawCookies = event.req.headers.cookie || "";
|
|
12
|
-
const apiConfig = {
|
|
13
|
-
...config,
|
|
14
|
-
cookies: rawCookies
|
|
15
|
-
};
|
|
16
|
-
const options = {
|
|
17
|
-
headers: {
|
|
18
|
-
"x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
|
|
19
|
-
},
|
|
20
|
-
query
|
|
21
|
-
};
|
|
22
|
-
const page = await flowrixApi.get(`permalink/${slug}`, apiConfig, options);
|
|
23
|
-
if (config.FLOWRIX_CACHE != "true" || config.public?.FLOWRIX_CACHE != "true") {
|
|
24
|
-
const CACHE_DIR = join("/tmp", ".cache");
|
|
25
|
-
if (existsSync(CACHE_DIR)) {
|
|
26
|
-
await rm(CACHE_DIR, { recursive: true, force: true });
|
|
27
|
-
} else {
|
|
28
|
-
console.log("\u2139\uFE0F Flowrix: No .cache folder found \u2014 skipping cleanup.");
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
if (page.status === "Success" && page.data.type === "Redirect") {
|
|
32
|
-
}
|
|
33
|
-
return page;
|
|
34
|
-
});
|