flowrix 1.0.1-beta.36 → 1.0.1-beta.38
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/runtime/middleware/flowrix.js +27 -13
- package/dist/runtime/server/api/albums.js +1 -1
- package/dist/runtime/server/api/auth/forgot.js +1 -1
- package/dist/runtime/server/api/auth/login.js +1 -1
- package/dist/runtime/server/api/auth/logout.js +1 -1
- package/dist/runtime/server/api/auth/register.js +1 -1
- package/dist/runtime/server/api/auth/session.get.js +1 -1
- package/dist/runtime/server/api/auth/user/reset-password.js +1 -1
- package/dist/runtime/server/api/auth/user/session.js +1 -1
- package/dist/runtime/server/api/auth/user/verify-token.js +1 -1
- package/dist/runtime/server/api/banners.js +1 -1
- package/dist/runtime/server/api/blog/[slug].js +1 -1
- package/dist/runtime/server/api/blog/blog.js +1 -1
- package/dist/runtime/server/api/brand/[slug].js +1 -1
- package/dist/runtime/server/api/cart/[slug]/add.js +1 -1
- package/dist/runtime/server/api/cart/[slug]/update.js +1 -1
- package/dist/runtime/server/api/cart/remove.js +1 -1
- package/dist/runtime/server/api/cart/service/[slug]/add.js +1 -1
- package/dist/runtime/server/api/catalog/categories.js +1 -1
- package/dist/runtime/server/api/catalog/featured.js +1 -1
- package/dist/runtime/server/api/catalog/samples.js +1 -1
- package/dist/runtime/server/api/catalog/search.js +1 -1
- package/dist/runtime/server/api/category/[...slug].js +1 -1
- package/dist/runtime/server/api/checkout/applyCoupon.js +1 -1
- package/dist/runtime/server/api/checkout/configs.d.ts +1 -1
- package/dist/runtime/server/api/checkout/configs.js +10 -11
- package/dist/runtime/server/api/checkout/countries.js +1 -1
- package/dist/runtime/server/api/checkout/paymentmethod.js +1 -1
- package/dist/runtime/server/api/company/profile.js +1 -1
- package/dist/runtime/server/api/contact-center/webforms/[id]/details.js +1 -1
- package/dist/runtime/server/api/contact-center/webforms/create.js +1 -1
- package/dist/runtime/server/api/customer/address/add.js +1 -1
- package/dist/runtime/server/api/customer/address/delete.js +1 -1
- package/dist/runtime/server/api/customer/address/setshipping.js +1 -1
- package/dist/runtime/server/api/customer/address/update.js +1 -1
- package/dist/runtime/server/api/customer/cards/delete.js +1 -1
- package/dist/runtime/server/api/customer/cards/get.js +1 -1
- package/dist/runtime/server/api/customer/change-password.js +1 -1
- package/dist/runtime/server/api/customer/checkout.js +1 -1
- package/dist/runtime/server/api/customer/orders.js +1 -1
- package/dist/runtime/server/api/customer/profile/update.js +1 -1
- package/dist/runtime/server/api/customer/quotations.js +1 -1
- package/dist/runtime/server/api/customer/search.js +1 -1
- package/dist/runtime/server/api/customer/tax-invoice.js +1 -1
- package/dist/runtime/server/api/customer/wishlist/add.js +1 -1
- package/dist/runtime/server/api/customer/wishlist/createWishList.js +1 -1
- package/dist/runtime/server/api/customer/wishlist/deleteFromWishList.js +1 -1
- package/dist/runtime/server/api/customer/wishlist/deleteWishList.js +1 -1
- package/dist/runtime/server/api/customer/wishlist/get.js +1 -1
- package/dist/runtime/server/api/customer/wishlist/getWishListItems.js +1 -1
- package/dist/runtime/server/api/customer/wishlist/updateWishList.js +1 -1
- package/dist/runtime/server/api/location.js +1 -1
- package/dist/runtime/server/api/nav/[id]/links.js +1 -1
- package/dist/runtime/server/api/page/[slug].js +1 -1
- package/dist/runtime/server/api/product/[...slug].js +3 -2
- package/dist/runtime/server/api/service/[slug].js +1 -1
- package/dist/runtime/server/api/service/availability.js +1 -1
- package/dist/runtime/server/api/subscribe.js +1 -1
- package/dist/runtime/server/api/v2/[...slug].js +1 -1
- package/dist/runtime/stores/Cart.js +8 -2
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
const isServer = typeof process !== "undefined" && process.server;
|
|
2
|
-
function
|
|
3
|
-
if (
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
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;
|
|
7
10
|
}
|
|
8
|
-
return process.env[key];
|
|
9
11
|
}
|
|
10
12
|
async function request(method, config = {}, endpoint, options = {}) {
|
|
11
|
-
const FLOWRIX_API_KEY =
|
|
12
|
-
const FLOWRIX_API_SECRET =
|
|
13
|
-
const FLOWRIX_API_ORIGIN =
|
|
14
|
-
let FLOWRIX_API_BASE =
|
|
13
|
+
const FLOWRIX_API_KEY = config.public?.FLOWRIX_API_KEY || "";
|
|
14
|
+
const FLOWRIX_API_SECRET = config.public?.FLOWRIX_API_SECRET || "";
|
|
15
|
+
const FLOWRIX_API_ORIGIN = config.public?.FLOWRIX_API_ORIGIN || "";
|
|
16
|
+
let FLOWRIX_API_BASE = config.public?.FLOWRIX_API_BASE_V2 || "";
|
|
17
|
+
console.log("endpoint", `${FLOWRIX_API_BASE}${endpoint}`);
|
|
15
18
|
const headers = {
|
|
16
|
-
"x-
|
|
17
|
-
"x-
|
|
19
|
+
"x-public-key": FLOWRIX_API_KEY,
|
|
20
|
+
"x-session-token": getCookie("x-session-token"),
|
|
21
|
+
"Access-Control-Expose-Headers": "x-session-token",
|
|
18
22
|
"Origin": FLOWRIX_API_ORIGIN,
|
|
19
23
|
...options.headers
|
|
20
24
|
};
|
|
@@ -22,7 +26,17 @@ async function request(method, config = {}, endpoint, options = {}) {
|
|
|
22
26
|
const response = await $fetch(`${FLOWRIX_API_BASE}${endpoint}`, {
|
|
23
27
|
method,
|
|
24
28
|
...options,
|
|
25
|
-
headers
|
|
29
|
+
headers,
|
|
30
|
+
onResponse({ response: response2 }) {
|
|
31
|
+
console.log(response2.headers.get("x-session-token"));
|
|
32
|
+
const token = response2.headers.get("x-session-token");
|
|
33
|
+
console.log(response2.headers);
|
|
34
|
+
if (token) {
|
|
35
|
+
if (process.client) {
|
|
36
|
+
document.cookie = `x-session-token=${token}; path=/; max-age=3600; secure; SameSite=Lax`;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
26
40
|
});
|
|
27
41
|
return response;
|
|
28
42
|
} catch (error) {
|
|
@@ -5,7 +5,7 @@ export default defineEventHandler(async (event) => {
|
|
|
5
5
|
const albums = await $fetch(`${process.env.FLOWRIX_API_BASE}albums`, {
|
|
6
6
|
method: "GET",
|
|
7
7
|
headers: {
|
|
8
|
-
"x-
|
|
8
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
9
9
|
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
10
10
|
"Origin": process.env.FLOWRIX_API_ORIGIN
|
|
11
11
|
}
|
|
@@ -6,7 +6,7 @@ export default defineEventHandler(async (event) => {
|
|
|
6
6
|
const response = await fetch(`${process.env.FLOWRIX_API_BASE}verify-email/`, {
|
|
7
7
|
method: "POST",
|
|
8
8
|
headers: {
|
|
9
|
-
"x-
|
|
9
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
10
10
|
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
11
11
|
"Origin": process.env.FLOWRIX_API_ORIGIN,
|
|
12
12
|
"Content-Type": "application/json"
|
|
@@ -17,7 +17,7 @@ export default defineEventHandler(async (event) => {
|
|
|
17
17
|
const response = await fetch(`${process.env.FLOWRIX_API_BASE}login/`, {
|
|
18
18
|
method: "POST",
|
|
19
19
|
headers: {
|
|
20
|
-
"x-
|
|
20
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
21
21
|
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
22
22
|
"Origin": process.env.FLOWRIX_API_ORIGIN,
|
|
23
23
|
"Content-Type": "application/json"
|
|
@@ -5,7 +5,7 @@ export default defineEventHandler(async (event) => {
|
|
|
5
5
|
await $fetch(`${process.env.FLOWRIX_API_BASE}customer/logout`, {
|
|
6
6
|
method: "POST",
|
|
7
7
|
headers: {
|
|
8
|
-
"x-
|
|
8
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
9
9
|
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
10
10
|
"Origin": process.env.FLOWRIX_API_ORIGIN,
|
|
11
11
|
"Authorization": `Bearer ${accessTok || ""}`
|
|
@@ -6,7 +6,7 @@ export default defineEventHandler(async (event) => {
|
|
|
6
6
|
const response = await fetch(`${process.env.FLOWRIX_API_BASE}customer/create`, {
|
|
7
7
|
method: "POST",
|
|
8
8
|
headers: {
|
|
9
|
-
"x-
|
|
9
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
10
10
|
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
11
11
|
"Origin": process.env.FLOWRIX_API_ORIGIN,
|
|
12
12
|
"Content-Type": "application/json"
|
|
@@ -17,7 +17,7 @@ export default defineEventHandler(async (event) => {
|
|
|
17
17
|
const response = await fetch(`${apiBase}user/session`, {
|
|
18
18
|
method: "GET",
|
|
19
19
|
headers: {
|
|
20
|
-
"x-
|
|
20
|
+
"x-public-key": apiKey,
|
|
21
21
|
"x-api-secret": apiSecret,
|
|
22
22
|
"Origin": apiOrigin || "",
|
|
23
23
|
"Authorization": `Bearer ${token}`,
|
|
@@ -7,7 +7,7 @@ export default defineEventHandler(async (event) => {
|
|
|
7
7
|
const response = await fetch(`${process.env.FLOWRIX_API_BASE}reset-password/`, {
|
|
8
8
|
method: "POST",
|
|
9
9
|
headers: {
|
|
10
|
-
"x-
|
|
10
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
11
11
|
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
12
12
|
"Origin": process.env.FLOWRIX_API_ORIGIN,
|
|
13
13
|
"Content-Type": "application/json",
|
|
@@ -5,7 +5,7 @@ export default defineEventHandler(async (event) => {
|
|
|
5
5
|
const response = await fetch(`${process.env.FLOWRIX_API_BASE}customer/profile`, {
|
|
6
6
|
method: "GET",
|
|
7
7
|
headers: {
|
|
8
|
-
"x-
|
|
8
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
9
9
|
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
10
10
|
"Origin": process.env.FLOWRIX_API_ORIGIN,
|
|
11
11
|
Authorization: authHeader
|
|
@@ -6,7 +6,7 @@ export default defineEventHandler(async (event) => {
|
|
|
6
6
|
const response = await fetch(`${process.env.FLOWRIX_API_BASE}verify-token/`, {
|
|
7
7
|
method: "POST",
|
|
8
8
|
headers: {
|
|
9
|
-
"x-
|
|
9
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
10
10
|
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
11
11
|
"Origin": process.env.FLOWRIX_API_ORIGIN,
|
|
12
12
|
"Content-Type": "application/json"
|
|
@@ -23,7 +23,7 @@ export default defineEventHandler(async (event) => {
|
|
|
23
23
|
try {
|
|
24
24
|
const banners = await $fetch(`${process.env.FLOWRIX_API_BASE}banners`, {
|
|
25
25
|
headers: {
|
|
26
|
-
"x-
|
|
26
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
27
27
|
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
28
28
|
"Origin": process.env.FLOWRIX_API_ORIGIN
|
|
29
29
|
}
|
|
@@ -33,7 +33,7 @@ export default defineEventHandler(async (event) => {
|
|
|
33
33
|
try {
|
|
34
34
|
const blog = await $fetch(`${process.env.FLOWRIX_API_BASE}posts/${slug}`, {
|
|
35
35
|
headers: {
|
|
36
|
-
"x-
|
|
36
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
37
37
|
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
38
38
|
"Origin": process.env.FLOWRIX_API_ORIGIN
|
|
39
39
|
}
|
|
@@ -7,7 +7,7 @@ export default defineEventHandler(async (event) => {
|
|
|
7
7
|
const page = await $fetch(`${process.env.FLOWRIX_API_BASE}posts`, {
|
|
8
8
|
method: "POST",
|
|
9
9
|
headers: {
|
|
10
|
-
"x-
|
|
10
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
11
11
|
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
12
12
|
"Origin": process.env.FLOWRIX_API_ORIGIN
|
|
13
13
|
},
|
|
@@ -39,7 +39,7 @@ export default defineEventHandler(async (event) => {
|
|
|
39
39
|
query,
|
|
40
40
|
method: "get",
|
|
41
41
|
headers: {
|
|
42
|
-
"x-
|
|
42
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
43
43
|
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
44
44
|
"Origin": process.env.FLOWRIX_API_ORIGIN
|
|
45
45
|
},
|
|
@@ -7,7 +7,7 @@ export default defineEventHandler(async (event) => {
|
|
|
7
7
|
const productResponse = await $fetch(`${process.env.FLOWRIX_API_BASE}cart/${slug}/add`, {
|
|
8
8
|
method: "POST",
|
|
9
9
|
headers: {
|
|
10
|
-
"x-
|
|
10
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
11
11
|
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
12
12
|
"Origin": process.env.FLOWRIX_API_ORIGIN
|
|
13
13
|
},
|
|
@@ -7,7 +7,7 @@ export default defineEventHandler(async (event) => {
|
|
|
7
7
|
const productResponse = await $fetch(`${process.env.FLOWRIX_API_BASE}cart/${slug}/update`, {
|
|
8
8
|
method: "POST",
|
|
9
9
|
headers: {
|
|
10
|
-
"x-
|
|
10
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
11
11
|
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
12
12
|
"Origin": process.env.FLOWRIX_API_ORIGIN
|
|
13
13
|
},
|
|
@@ -7,7 +7,7 @@ export default defineEventHandler(async (event) => {
|
|
|
7
7
|
const productResponse = await $fetch(`${process.env.FLOWRIX_API_BASE}cart/remove`, {
|
|
8
8
|
method: "POST",
|
|
9
9
|
headers: {
|
|
10
|
-
"x-
|
|
10
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
11
11
|
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
12
12
|
"Origin": process.env.FLOWRIX_API_ORIGIN
|
|
13
13
|
},
|
|
@@ -6,7 +6,7 @@ export default defineEventHandler(async (event) => {
|
|
|
6
6
|
const services = await $fetch(`${process.env.FLOWRIX_API_BASE}cart/service/${slug}/add`, {
|
|
7
7
|
method: "POST",
|
|
8
8
|
headers: {
|
|
9
|
-
"x-
|
|
9
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
10
10
|
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
11
11
|
"Origin": process.env.FLOWRIX_API_ORIGIN
|
|
12
12
|
},
|
|
@@ -25,7 +25,7 @@ export default defineEventHandler(async (event) => {
|
|
|
25
25
|
const categories = await $fetch(`${process.env.FLOWRIX_API_BASE}categories`, {
|
|
26
26
|
query,
|
|
27
27
|
headers: {
|
|
28
|
-
"x-
|
|
28
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
29
29
|
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
30
30
|
"Origin": process.env.FLOWRIX_API_ORIGIN
|
|
31
31
|
}
|
|
@@ -23,7 +23,7 @@ export default defineEventHandler(async (event) => {
|
|
|
23
23
|
try {
|
|
24
24
|
const featured = await $fetch(`${process.env.FLOWRIX_API_BASE}products/featured`, {
|
|
25
25
|
headers: {
|
|
26
|
-
"x-
|
|
26
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
27
27
|
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
28
28
|
"Origin": process.env.FLOWRIX_API_ORIGIN
|
|
29
29
|
}
|
|
@@ -26,7 +26,7 @@ export default defineEventHandler(async (event) => {
|
|
|
26
26
|
const samples = await $fetch(`${process.env.FLOWRIX_API_BASE}samples`, {
|
|
27
27
|
query,
|
|
28
28
|
headers: {
|
|
29
|
-
"x-
|
|
29
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
30
30
|
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
31
31
|
"Origin": process.env.FLOWRIX_API_ORIGIN
|
|
32
32
|
}
|
|
@@ -26,7 +26,7 @@ export default defineEventHandler(async (event) => {
|
|
|
26
26
|
const search = await $fetch(`${process.env.FLOWRIX_API_BASE}search`, {
|
|
27
27
|
query,
|
|
28
28
|
headers: {
|
|
29
|
-
"x-
|
|
29
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
30
30
|
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
31
31
|
"Origin": process.env.FLOWRIX_API_ORIGIN
|
|
32
32
|
}
|
|
@@ -33,7 +33,7 @@ export default defineEventHandler(async (event) => {
|
|
|
33
33
|
query,
|
|
34
34
|
method: "get",
|
|
35
35
|
headers: {
|
|
36
|
-
"x-
|
|
36
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
37
37
|
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
38
38
|
"Origin": process.env.FLOWRIX_API_ORIGIN
|
|
39
39
|
}
|
|
@@ -6,7 +6,7 @@ export default defineEventHandler(async (event) => {
|
|
|
6
6
|
const productResponse = await $fetch(`${process.env.FLOWRIX_API_BASE}checkout/applyCoupon`, {
|
|
7
7
|
method: "POST",
|
|
8
8
|
headers: {
|
|
9
|
-
"x-
|
|
9
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
10
10
|
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
11
11
|
"Origin": process.env.FLOWRIX_API_ORIGIN
|
|
12
12
|
},
|
|
@@ -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,18 +1,17 @@
|
|
|
1
1
|
import { defineEventHandler, setResponseStatus, readBody } from "h3";
|
|
2
|
-
import {
|
|
2
|
+
import { flowrixApi } from "../../../middleware/flowrix.js";
|
|
3
3
|
export default defineEventHandler(async (event) => {
|
|
4
4
|
const body = await readBody(event);
|
|
5
5
|
try {
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return productResponse;
|
|
6
|
+
const config = useRuntimeConfig();
|
|
7
|
+
const response = await flowrixApi.post(
|
|
8
|
+
"checkout/configs",
|
|
9
|
+
config,
|
|
10
|
+
{
|
|
11
|
+
body
|
|
12
|
+
}
|
|
13
|
+
);
|
|
14
|
+
return response;
|
|
16
15
|
} catch (error) {
|
|
17
16
|
setResponseStatus(event, 500);
|
|
18
17
|
return { success: false, error: error.message };
|
|
@@ -4,7 +4,7 @@ export default defineEventHandler(async (event) => {
|
|
|
4
4
|
try {
|
|
5
5
|
const countriesResponse = await $fetch(`${process.env.FLOWRIX_API_BASE}countries`, {
|
|
6
6
|
headers: {
|
|
7
|
-
"x-
|
|
7
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
8
8
|
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
9
9
|
"Origin": process.env.FLOWRIX_API_ORIGIN
|
|
10
10
|
}
|
|
@@ -6,7 +6,7 @@ export default defineEventHandler(async (event) => {
|
|
|
6
6
|
const productResponse = await $fetch(`${process.env.FLOWRIX_API_BASE}checkout/paymentmethod`, {
|
|
7
7
|
method: "POST",
|
|
8
8
|
headers: {
|
|
9
|
-
"x-
|
|
9
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
10
10
|
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
11
11
|
"Origin": process.env.FLOWRIX_API_ORIGIN
|
|
12
12
|
},
|
|
@@ -2,7 +2,7 @@ import { defineEventHandler, setResponseStatus } from "h3";
|
|
|
2
2
|
import { $fetch } from "ofetch";
|
|
3
3
|
export default defineEventHandler(async (event) => {
|
|
4
4
|
try {
|
|
5
|
-
const companyProfile = await $fetch(
|
|
5
|
+
const companyProfile = await $fetch(`https://crosbyblinds.dev.flowrix.app/api/v1/company/profile`, {
|
|
6
6
|
method: "GET",
|
|
7
7
|
headers: {
|
|
8
8
|
"x-api-key": process.env.FLOWRIX_API_KEY,
|
|
@@ -8,7 +8,7 @@ export default defineEventHandler(async (event) => {
|
|
|
8
8
|
}
|
|
9
9
|
const webform = await $fetch(`${process.env.FLOWRIX_API_BASE}contact-center/webforms/${id}/details`, {
|
|
10
10
|
headers: {
|
|
11
|
-
"x-
|
|
11
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
12
12
|
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
13
13
|
"Origin": process.env.FLOWRIX_API_ORIGIN,
|
|
14
14
|
"Content-Type": "application/json"
|
|
@@ -5,7 +5,7 @@ export default defineEventHandler(async (event) => {
|
|
|
5
5
|
const webform = await $fetch(`${process.env.FLOWRIX_API_BASE}contact-center/webforms/create`, {
|
|
6
6
|
method: "POST",
|
|
7
7
|
headers: {
|
|
8
|
-
"x-
|
|
8
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
9
9
|
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
10
10
|
"Origin": process.env.FLOWRIX_API_ORIGIN,
|
|
11
11
|
"Content-Type": "application/json"
|
|
@@ -6,7 +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-
|
|
9
|
+
"x-public-key": process.env.FLOWRIX_API_KEY || "",
|
|
10
10
|
"x-api-secret": process.env.FLOWRIX_API_SECRET || "",
|
|
11
11
|
"Origin": process.env.FLOWRIX_API_ORIGIN || "",
|
|
12
12
|
"Authorization": `Bearer ${accessTok || ""}`,
|
|
@@ -13,7 +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-
|
|
16
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
17
17
|
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
18
18
|
"Origin": process.env.FLOWRIX_API_ORIGIN,
|
|
19
19
|
"Authorization": `Bearer ${accessTok || ""}`
|
|
@@ -13,7 +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-
|
|
16
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
17
17
|
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
18
18
|
"Origin": process.env.FLOWRIX_API_ORIGIN,
|
|
19
19
|
"Authorization": `Bearer ${accessTok || ""}`,
|
|
@@ -15,7 +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-
|
|
18
|
+
"x-public-key": process.env.FLOWRIX_API_KEY || "",
|
|
19
19
|
"x-api-secret": process.env.FLOWRIX_API_SECRET || "",
|
|
20
20
|
"Origin": process.env.FLOWRIX_API_ORIGIN || "",
|
|
21
21
|
"Authorization": `Bearer ${accessTok || ""}`,
|
|
@@ -6,7 +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-
|
|
9
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
10
10
|
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
11
11
|
"Origin": process.env.FLOWRIX_API_ORIGIN,
|
|
12
12
|
"Authorization": `Bearer ${accessTok || ""}`
|
|
@@ -4,7 +4,7 @@ export default defineEventHandler(async (event) => {
|
|
|
4
4
|
try {
|
|
5
5
|
const response = await $fetch(`${process.env.FLOWRIX_API_BASE}customer/cards`, {
|
|
6
6
|
headers: {
|
|
7
|
-
"x-
|
|
7
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
8
8
|
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
9
9
|
"Origin": process.env.FLOWRIX_API_ORIGIN,
|
|
10
10
|
"Authorization": `Bearer ${accessTok || ""}`
|
|
@@ -6,7 +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-
|
|
9
|
+
"x-public-key": process.env.FLOWRIX_API_KEY || "",
|
|
10
10
|
"x-api-secret": process.env.FLOWRIX_API_SECRET || "",
|
|
11
11
|
"Origin": process.env.FLOWRIX_API_ORIGIN || "",
|
|
12
12
|
"Authorization": `Bearer ${accessTok || ""}`,
|
|
@@ -6,7 +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-
|
|
9
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
10
10
|
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
11
11
|
"Origin": process.env.FLOWRIX_API_ORIGIN
|
|
12
12
|
},
|
|
@@ -4,7 +4,7 @@ export default defineEventHandler(async (event) => {
|
|
|
4
4
|
try {
|
|
5
5
|
const response = await $fetch(`${process.env.FLOWRIX_API_BASE}customer/orders`, {
|
|
6
6
|
headers: {
|
|
7
|
-
"x-
|
|
7
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
8
8
|
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
9
9
|
"Origin": process.env.FLOWRIX_API_ORIGIN,
|
|
10
10
|
"Authorization": `Bearer ${accessTok || ""}`
|
|
@@ -6,7 +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-
|
|
9
|
+
"x-public-key": process.env.FLOWRIX_API_KEY || "",
|
|
10
10
|
"x-api-secret": process.env.FLOWRIX_API_SECRET || "",
|
|
11
11
|
"Origin": process.env.FLOWRIX_API_ORIGIN || "",
|
|
12
12
|
"Authorization": `Bearer ${accessTok || ""}`,
|
|
@@ -4,7 +4,7 @@ export default defineEventHandler(async (event) => {
|
|
|
4
4
|
try {
|
|
5
5
|
const response = await $fetch(`${process.env.FLOWRIX_API_BASE}customer/quotations`, {
|
|
6
6
|
headers: {
|
|
7
|
-
"x-
|
|
7
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
8
8
|
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
9
9
|
"Origin": process.env.FLOWRIX_API_ORIGIN,
|
|
10
10
|
"Authorization": `Bearer ${accessTok || ""}`
|
|
@@ -5,7 +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-
|
|
8
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
9
9
|
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
10
10
|
"Origin": process.env.FLOWRIX_API_ORIGIN
|
|
11
11
|
},
|
|
@@ -11,7 +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-
|
|
14
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
15
15
|
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
16
16
|
"Origin": process.env.FLOWRIX_API_ORIGIN,
|
|
17
17
|
"Authorization": `Bearer ${accessTok || ""}`
|
|
@@ -7,7 +7,7 @@ export default defineEventHandler(async (event) => {
|
|
|
7
7
|
const response = await fetch(`${process.env.FLOWRIX_API_BASE}customer/wishlist/${listId}/${productSlug}/add`, {
|
|
8
8
|
method: "POST",
|
|
9
9
|
headers: {
|
|
10
|
-
"x-
|
|
10
|
+
"x-public-key": process.env.FLOWRIX_API_KEY || "",
|
|
11
11
|
"x-api-secret": process.env.FLOWRIX_API_SECRET || "",
|
|
12
12
|
"Origin": process.env.FLOWRIX_API_ORIGIN || "",
|
|
13
13
|
"Authorization": `Bearer ${accessTok || ""}`,
|
|
@@ -6,7 +6,7 @@ export default defineEventHandler(async (event) => {
|
|
|
6
6
|
const response = await fetch(`${process.env.FLOWRIX_API_BASE}customer/wishlist/add`, {
|
|
7
7
|
method: "POST",
|
|
8
8
|
headers: {
|
|
9
|
-
"x-
|
|
9
|
+
"x-public-key": process.env.FLOWRIX_API_KEY || "",
|
|
10
10
|
"x-api-secret": process.env.FLOWRIX_API_SECRET || "",
|
|
11
11
|
"Origin": process.env.FLOWRIX_API_ORIGIN || "",
|
|
12
12
|
"Authorization": `Bearer ${accessTok || ""}`,
|
|
@@ -15,7 +15,7 @@ export default defineEventHandler(async (event) => {
|
|
|
15
15
|
const response = await fetch(`${process.env.FLOWRIX_API_BASE}customer/wishlist/${listId}/item/delete`, {
|
|
16
16
|
method: "POST",
|
|
17
17
|
headers: {
|
|
18
|
-
"x-
|
|
18
|
+
"x-public-key": process.env.FLOWRIX_API_KEY || "",
|
|
19
19
|
"x-api-secret": process.env.FLOWRIX_API_SECRET || "",
|
|
20
20
|
"Origin": process.env.FLOWRIX_API_ORIGIN || "",
|
|
21
21
|
"Authorization": `Bearer ${accessTok || ""}`,
|
|
@@ -7,7 +7,7 @@ export default defineEventHandler(async (event) => {
|
|
|
7
7
|
const response = await fetch(`${process.env.FLOWRIX_API_BASE}customer/wishlist/${id}/delete`, {
|
|
8
8
|
method: "POST",
|
|
9
9
|
headers: {
|
|
10
|
-
"x-
|
|
10
|
+
"x-public-key": process.env.FLOWRIX_API_KEY || "",
|
|
11
11
|
"x-api-secret": process.env.FLOWRIX_API_SECRET || "",
|
|
12
12
|
"Origin": process.env.FLOWRIX_API_ORIGIN || "",
|
|
13
13
|
"Authorization": `Bearer ${accessTok || ""}`,
|
|
@@ -4,7 +4,7 @@ export default defineEventHandler(async (event) => {
|
|
|
4
4
|
try {
|
|
5
5
|
const response = await $fetch(`${process.env.FLOWRIX_API_BASE}customer/wishlist`, {
|
|
6
6
|
headers: {
|
|
7
|
-
"x-
|
|
7
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
8
8
|
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
9
9
|
"Origin": process.env.FLOWRIX_API_ORIGIN,
|
|
10
10
|
"Authorization": `Bearer ${accessTok || ""}`
|
|
@@ -6,7 +6,7 @@ export default defineEventHandler(async (event) => {
|
|
|
6
6
|
const response = await fetch(`${process.env.FLOWRIX_API_BASE}customer/wishlist/${listId}/products`, {
|
|
7
7
|
method: "GET",
|
|
8
8
|
headers: {
|
|
9
|
-
"x-
|
|
9
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
10
10
|
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
11
11
|
"Origin": process.env.FLOWRIX_API_ORIGIN,
|
|
12
12
|
"Authorization": `Bearer ${accessTok || ""}`
|
|
@@ -7,7 +7,7 @@ export default defineEventHandler(async (event) => {
|
|
|
7
7
|
const response = await fetch(`${process.env.FLOWRIX_API_BASE}customer/wishlist/${id}/update`, {
|
|
8
8
|
method: "POST",
|
|
9
9
|
headers: {
|
|
10
|
-
"x-
|
|
10
|
+
"x-public-key": process.env.FLOWRIX_API_KEY || "",
|
|
11
11
|
"x-api-secret": process.env.FLOWRIX_API_SECRET || "",
|
|
12
12
|
"Origin": process.env.FLOWRIX_API_ORIGIN || "",
|
|
13
13
|
"Authorization": `Bearer ${accessTok || ""}`,
|
|
@@ -4,7 +4,7 @@ export default defineEventHandler(async () => {
|
|
|
4
4
|
const location = await $fetch(`${process.env.FLOWRIX_API_BASE}ip/location`, {
|
|
5
5
|
method: "POST",
|
|
6
6
|
headers: {
|
|
7
|
-
"x-
|
|
7
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
8
8
|
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
9
9
|
"Origin": process.env.FLOWRIX_API_ORIGIN
|
|
10
10
|
}
|
|
@@ -6,7 +6,7 @@ export default defineEventHandler(async (event) => {
|
|
|
6
6
|
const response = await $fetch(`${process.env.FLOWRIX_API_BASE}nav/${id}/links`, {
|
|
7
7
|
method: "GET",
|
|
8
8
|
headers: {
|
|
9
|
-
"x-
|
|
9
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
10
10
|
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
11
11
|
"Origin": process.env.FLOWRIX_API_ORIGIN
|
|
12
12
|
}
|
|
@@ -33,7 +33,7 @@ export default defineEventHandler(async (event) => {
|
|
|
33
33
|
try {
|
|
34
34
|
const page = await $fetch(`${process.env.FLOWRIX_API_BASE}page/${slug}`, {
|
|
35
35
|
headers: {
|
|
36
|
-
"x-
|
|
36
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
37
37
|
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
38
38
|
"Origin": process.env.FLOWRIX_API_ORIGIN
|
|
39
39
|
}
|
|
@@ -28,9 +28,10 @@ export default defineEventHandler(async (event) => {
|
|
|
28
28
|
} catch (error) {
|
|
29
29
|
}
|
|
30
30
|
try {
|
|
31
|
-
const
|
|
31
|
+
const config = useRuntimeConfig();
|
|
32
|
+
const product = await flowrixApi.post(`product/${slug}`, config, {
|
|
32
33
|
body: JSON.stringify(body)
|
|
33
|
-
}
|
|
34
|
+
});
|
|
34
35
|
await ensureCacheDir();
|
|
35
36
|
await writeFile(filePath, JSON.stringify(product, null, 2), "utf-8");
|
|
36
37
|
return product;
|
|
@@ -33,7 +33,7 @@ export default defineEventHandler(async (event) => {
|
|
|
33
33
|
try {
|
|
34
34
|
const service = await $fetch(`${process.env.FLOWRIX_API_BASE}services/${slug}`, {
|
|
35
35
|
headers: {
|
|
36
|
-
"x-
|
|
36
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
37
37
|
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
38
38
|
"Origin": process.env.FLOWRIX_API_ORIGIN
|
|
39
39
|
}
|
|
@@ -5,7 +5,7 @@ export default defineEventHandler(async (event) => {
|
|
|
5
5
|
const response = await fetch(`${process.env.FLOWRIX_API_BASE}services/availability`, {
|
|
6
6
|
method: "POST",
|
|
7
7
|
headers: {
|
|
8
|
-
"x-
|
|
8
|
+
"x-public-key": process.env.FLOWRIX_API_KEY || "",
|
|
9
9
|
"x-api-secret": process.env.FLOWRIX_API_SECRET || "",
|
|
10
10
|
"Origin": process.env.FLOWRIX_API_ORIGIN || "",
|
|
11
11
|
"Content-Type": "application/json",
|
|
@@ -5,7 +5,7 @@ export default defineEventHandler(async (event) => {
|
|
|
5
5
|
const subscribe = await $fetch(`${process.env.FLOWRIX_API_BASE}subscribe`, {
|
|
6
6
|
method: "POST",
|
|
7
7
|
headers: {
|
|
8
|
-
"x-
|
|
8
|
+
"x-public-key": process.env.FLOWRIX_API_KEY,
|
|
9
9
|
"x-api-secret": process.env.FLOWRIX_API_SECRET,
|
|
10
10
|
"Origin": process.env.FLOWRIX_API_ORIGIN,
|
|
11
11
|
"Content-Type": "application/json"
|
|
@@ -4,7 +4,7 @@ export const Page = /* @__PURE__ */ new Map();
|
|
|
4
4
|
export default defineEventHandler(async (event) => {
|
|
5
5
|
const slug = event.context.params._;
|
|
6
6
|
const config = useRuntimeConfig();
|
|
7
|
-
const page = await flowrixApi.get(`permalink/${slug}`, config
|
|
7
|
+
const page = await flowrixApi.get(`permalink/${slug}`, config);
|
|
8
8
|
Page.set(slug, page);
|
|
9
9
|
return page;
|
|
10
10
|
});
|
|
@@ -2,7 +2,7 @@ import { defineStore } from "pinia";
|
|
|
2
2
|
import { flowrixApi } from "../middleware/flowrix.js";
|
|
3
3
|
import { useCheckoutStore } from "./Checkout.js";
|
|
4
4
|
import { useApi } from "../utils/api.js";
|
|
5
|
-
import { useRuntimeConfig } from "#
|
|
5
|
+
import { useRuntimeConfig } from "#imports";
|
|
6
6
|
export const useCartStore = defineStore("cart", {
|
|
7
7
|
state: () => ({
|
|
8
8
|
cart: {},
|
|
@@ -66,7 +66,13 @@ export const useCartStore = defineStore("cart", {
|
|
|
66
66
|
}
|
|
67
67
|
try {
|
|
68
68
|
const config = useRuntimeConfig();
|
|
69
|
-
const response = await flowrixApi.post(
|
|
69
|
+
const response = await flowrixApi.post(
|
|
70
|
+
apiUrl,
|
|
71
|
+
config,
|
|
72
|
+
{
|
|
73
|
+
body: formData
|
|
74
|
+
}
|
|
75
|
+
);
|
|
70
76
|
if (response?.status == "Success") {
|
|
71
77
|
this.addedResponse = "success";
|
|
72
78
|
this.cart = {
|