flowrix 1.0.1-beta.136 → 1.0.1-beta.139
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 +11 -12
- package/dist/runtime/middleware/flowrix.js +6 -6
- package/dist/runtime/server/api/albums.js +2 -2
- package/dist/runtime/server/api/auth/forgot.js +3 -3
- package/dist/runtime/server/api/auth/login.js +3 -3
- package/dist/runtime/server/api/auth/logout.js +3 -3
- package/dist/runtime/server/api/auth/register.js +3 -3
- package/dist/runtime/server/api/auth/user/reset-password.js +3 -3
- package/dist/runtime/server/api/auth/user/session.js +3 -3
- package/dist/runtime/server/api/auth/user/verify-token.js +3 -3
- package/dist/runtime/server/api/banners.js +2 -2
- package/dist/runtime/server/api/brand/[...slug].js +2 -2
- package/dist/runtime/server/api/brand/index.js +1 -1
- package/dist/runtime/server/api/catalog/brands.js +2 -2
- package/dist/runtime/server/api/catalog/categories.js +2 -2
- package/dist/runtime/server/api/catalog/categoriesall.js +2 -2
- package/dist/runtime/server/api/catalog/featured.js +2 -2
- package/dist/runtime/server/api/catalog/posts.js +2 -2
- package/dist/runtime/server/api/catalog/samples.js +2 -2
- package/dist/runtime/server/api/catalog/search.js +2 -2
- package/dist/runtime/server/api/category/[...slug].js +2 -2
- package/dist/runtime/server/api/checkout/quotation/[slug].js +3 -3
- package/dist/runtime/server/api/checkout/quotation/guest/[slug].js +6 -6
- package/dist/runtime/server/api/checkout/quotation/guest/customer.js +3 -3
- package/dist/runtime/server/api/checkout/quotation/submit/[slug].js +3 -3
- package/dist/runtime/server/api/cmspost/[...slug].js +2 -2
- package/dist/runtime/server/api/cmspost/all.js +2 -2
- package/dist/runtime/server/api/company/profile.js +1 -1
- package/dist/runtime/server/api/contact-center/webforms/[id]/details.js +2 -2
- package/dist/runtime/server/api/contact-center/webforms/create.js +1 -1
- package/dist/runtime/server/api/countries.js +2 -2
- package/dist/runtime/server/api/customer/address/add.js +3 -3
- package/dist/runtime/server/api/customer/address/delete.js +3 -3
- package/dist/runtime/server/api/customer/address/setshipping.js +3 -3
- package/dist/runtime/server/api/customer/address/update.js +3 -3
- package/dist/runtime/server/api/customer/cards/delete.js +3 -3
- package/dist/runtime/server/api/customer/cards/get.js +3 -3
- package/dist/runtime/server/api/customer/change-password.js +3 -3
- package/dist/runtime/server/api/customer/checkout.js +3 -3
- package/dist/runtime/server/api/customer/orders.js +3 -3
- package/dist/runtime/server/api/customer/profile/update.js +3 -3
- package/dist/runtime/server/api/customer/quotations.js +3 -3
- package/dist/runtime/server/api/customer/search.js +3 -3
- package/dist/runtime/server/api/customer/tax-invoice.js +3 -3
- package/dist/runtime/server/api/customer/wishlist/add.js +3 -3
- package/dist/runtime/server/api/customer/wishlist/createWishList.js +3 -3
- package/dist/runtime/server/api/customer/wishlist/deleteFromWishList.js +3 -3
- package/dist/runtime/server/api/customer/wishlist/deleteWishList.js +3 -3
- package/dist/runtime/server/api/customer/wishlist/get.js +3 -3
- package/dist/runtime/server/api/customer/wishlist/getWishListItems.js +3 -3
- package/dist/runtime/server/api/customer/wishlist/updateWishList.js +3 -3
- package/dist/runtime/server/api/featured.js +2 -2
- package/dist/runtime/server/api/generate/robots.get.js +1 -1
- package/dist/runtime/server/api/generate/sitemap.get.js +1 -1
- package/dist/runtime/server/api/location.js +1 -1
- package/dist/runtime/server/api/nav/[id]/links.js +2 -2
- package/dist/runtime/server/api/page/[...slug].js +2 -2
- package/dist/runtime/server/api/product/[...slug].js +2 -2
- package/dist/runtime/server/api/quickview/[slug].js +1 -1
- package/dist/runtime/server/api/reviews.js +1 -1
- package/dist/runtime/server/api/samples.js +2 -2
- package/dist/runtime/server/api/search.js +2 -2
- package/dist/runtime/server/api/service/[slug].js +2 -2
- package/dist/runtime/server/api/service/availability.js +1 -1
- package/dist/runtime/server/api/service/getall.js +2 -2
- package/dist/runtime/server/api/shop.js +2 -2
- package/dist/runtime/server/api/subscribe.js +1 -1
- package/dist/runtime/server/api/v2/[...slug].get.js +2 -2
- package/dist/runtime/server/api/webform.js +2 -2
- package/dist/runtime/utils/api.js +5 -5
- package/dist/runtime/utils/htmlCache.js +1 -1
- package/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -8,21 +8,20 @@ const module$1 = defineNuxtModule({
|
|
|
8
8
|
defaults: {},
|
|
9
9
|
async setup(_options, nuxt) {
|
|
10
10
|
const env = process.env;
|
|
11
|
-
console.log(env);
|
|
12
11
|
const runtimeConfig = nuxt.options.runtimeConfig;
|
|
13
|
-
runtimeConfig.
|
|
14
|
-
runtimeConfig.
|
|
15
|
-
runtimeConfig.
|
|
16
|
-
runtimeConfig.
|
|
17
|
-
runtimeConfig.
|
|
18
|
-
runtimeConfig.
|
|
12
|
+
runtimeConfig.KEY = env.KEY || "";
|
|
13
|
+
runtimeConfig.SECRET = env.SECRET || "";
|
|
14
|
+
runtimeConfig.ORIGIN = env.ORIGIN || "";
|
|
15
|
+
runtimeConfig.BASE = env.BASE || "";
|
|
16
|
+
runtimeConfig.CACHE = env.CACHE || "false";
|
|
17
|
+
runtimeConfig.CDN = env.CDN || "";
|
|
19
18
|
Object.assign(runtimeConfig.public, {
|
|
20
19
|
...runtimeConfig.public,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
KEY: env.KEY || runtimeConfig.KEY || runtimeConfig.public.KEY || "",
|
|
21
|
+
ORIGIN: env.ORIGIN || runtimeConfig.ORIGIN || runtimeConfig.public.ORIGIN || "",
|
|
22
|
+
BASE: env.BASE || runtimeConfig.BASE || runtimeConfig.public.BASE || "",
|
|
23
|
+
CACHE: env.CACHE || runtimeConfig.CACHE || runtimeConfig.public.CACHE || "false",
|
|
24
|
+
CDN: env.FCDN || runtimeConfig.CDN || runtimeConfig.public.CDN || ""
|
|
26
25
|
});
|
|
27
26
|
const resolver = createResolver(import.meta.url);
|
|
28
27
|
await installModule("@pinia/nuxt");
|
|
@@ -18,21 +18,21 @@ const parseCookies = (cookieString) => {
|
|
|
18
18
|
);
|
|
19
19
|
};
|
|
20
20
|
async function request(method, config = {}, endpoint, options = {}) {
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
let
|
|
21
|
+
const KEY = config?.KEY || config.public?.KEY || "";
|
|
22
|
+
const ORIGIN = config?.ORIGIN || config.public?.ORIGIN || "";
|
|
23
|
+
let BASE = config?.BASE || config.public?.BASE || "";
|
|
24
24
|
const cookiesObj = parseCookies(config.cookies || "");
|
|
25
25
|
const authToken = cookiesObj["authToken"];
|
|
26
26
|
const headers = {
|
|
27
|
-
"x-public-key":
|
|
27
|
+
"x-public-key": KEY,
|
|
28
28
|
"x-session-token": getCookie("x-session-token"),
|
|
29
29
|
"Access-Control-Expose-Headers": "x-session-token",
|
|
30
30
|
"authorization": `Bearer ${authToken}`,
|
|
31
|
-
"Origin":
|
|
31
|
+
"Origin": ORIGIN,
|
|
32
32
|
...options.headers
|
|
33
33
|
};
|
|
34
34
|
try {
|
|
35
|
-
const response = await $fetch(`${
|
|
35
|
+
const response = await $fetch(`${BASE}${endpoint}`, {
|
|
36
36
|
method,
|
|
37
37
|
...options,
|
|
38
38
|
headers,
|
|
@@ -30,11 +30,11 @@ export default defineEventHandler(async (event) => {
|
|
|
30
30
|
};
|
|
31
31
|
const options = {
|
|
32
32
|
headers: {
|
|
33
|
-
"x-api-secret": apiConfig?.
|
|
33
|
+
"x-api-secret": apiConfig?.SECRET || ""
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
const albums = await flowrixApi.get(`albums`, apiConfig, options);
|
|
37
|
-
if (config.
|
|
37
|
+
if (config.CACHE == "true" || config.public.CACHE == "true") {
|
|
38
38
|
await ensureCacheDir();
|
|
39
39
|
await writeFile(filePath, JSON.stringify(albums, null, 2), "utf-8");
|
|
40
40
|
}
|
|
@@ -3,11 +3,11 @@ export default defineEventHandler(async (event) => {
|
|
|
3
3
|
const body = await readBody(event);
|
|
4
4
|
const { email } = body;
|
|
5
5
|
try {
|
|
6
|
-
const response = await fetch(`${process.env.
|
|
6
|
+
const response = await fetch(`${process.env.BASE}verify-email/`, {
|
|
7
7
|
method: "POST",
|
|
8
8
|
headers: {
|
|
9
|
-
"x-public-key": process.env.
|
|
10
|
-
"Origin": process.env.
|
|
9
|
+
"x-public-key": process.env.KEY,
|
|
10
|
+
"Origin": process.env.ORIGIN,
|
|
11
11
|
"Content-Type": "application/json"
|
|
12
12
|
},
|
|
13
13
|
body: JSON.stringify({ email })
|
|
@@ -9,11 +9,11 @@ export default defineEventHandler(async (event) => {
|
|
|
9
9
|
statusMessage: "Email and password are required"
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
|
-
const response = await fetch(`${process.env.
|
|
12
|
+
const response = await fetch(`${process.env.BASE}login/`, {
|
|
13
13
|
method: "POST",
|
|
14
14
|
headers: {
|
|
15
|
-
"x-public-key": process.env.
|
|
16
|
-
"Origin": process.env.
|
|
15
|
+
"x-public-key": process.env.KEY,
|
|
16
|
+
"Origin": process.env.ORIGIN,
|
|
17
17
|
"Content-Type": "application/json"
|
|
18
18
|
},
|
|
19
19
|
body: JSON.stringify({ email, password })
|
|
@@ -2,11 +2,11 @@ import { defineEventHandler, getCookie, deleteCookie } from "h3";
|
|
|
2
2
|
export default defineEventHandler(async (event) => {
|
|
3
3
|
const accessTok = getCookie(event, "auth.token");
|
|
4
4
|
try {
|
|
5
|
-
await $fetch(`${process.env.
|
|
5
|
+
await $fetch(`${process.env.BASE}customer/logout`, {
|
|
6
6
|
method: "POST",
|
|
7
7
|
headers: {
|
|
8
|
-
"x-public-key": process.env.
|
|
9
|
-
"Origin": process.env.
|
|
8
|
+
"x-public-key": process.env.KEY,
|
|
9
|
+
"Origin": process.env.ORIGIN,
|
|
10
10
|
"Authorization": `Bearer ${accessTok || ""}`
|
|
11
11
|
}
|
|
12
12
|
});
|
|
@@ -3,11 +3,11 @@ export default defineEventHandler(async (event) => {
|
|
|
3
3
|
const body = await readBody(event);
|
|
4
4
|
const { firstname, lastname, mobile, email, email_confirmation, password, password_confirmation } = body;
|
|
5
5
|
try {
|
|
6
|
-
const response = await fetch(`${process.env.
|
|
6
|
+
const response = await fetch(`${process.env.BASE}customer/create`, {
|
|
7
7
|
method: "POST",
|
|
8
8
|
headers: {
|
|
9
|
-
"x-public-key": process.env.
|
|
10
|
-
"Origin": process.env.
|
|
9
|
+
"x-public-key": process.env.KEY,
|
|
10
|
+
"Origin": process.env.ORIGIN,
|
|
11
11
|
"Content-Type": "application/json"
|
|
12
12
|
},
|
|
13
13
|
body: JSON.stringify({ firstname, lastname, mobile, email, email_confirmation, password, password_confirmation })
|
|
@@ -4,11 +4,11 @@ export default defineEventHandler(async (event) => {
|
|
|
4
4
|
const { password, password_confirmation, token } = body;
|
|
5
5
|
try {
|
|
6
6
|
const auth_token = getCookie(event, "token");
|
|
7
|
-
const response = await fetch(`${process.env.
|
|
7
|
+
const response = await fetch(`${process.env.BASE}reset-password/`, {
|
|
8
8
|
method: "POST",
|
|
9
9
|
headers: {
|
|
10
|
-
"x-public-key": process.env.
|
|
11
|
-
"Origin": process.env.
|
|
10
|
+
"x-public-key": process.env.KEY,
|
|
11
|
+
"Origin": process.env.ORIGIN,
|
|
12
12
|
"Content-Type": "application/json",
|
|
13
13
|
// <--- CHANGE THIS
|
|
14
14
|
Authorization: `Bearer ${auth_token}`
|
|
@@ -2,11 +2,11 @@ import { defineEventHandler, getHeader, createError } from "h3";
|
|
|
2
2
|
export default defineEventHandler(async (event) => {
|
|
3
3
|
const authHeader = getHeader(event, "authorization");
|
|
4
4
|
try {
|
|
5
|
-
const response = await fetch(`${process.env.
|
|
5
|
+
const response = await fetch(`${process.env.BASE}customer/profile`, {
|
|
6
6
|
method: "GET",
|
|
7
7
|
headers: {
|
|
8
|
-
"x-public-key": process.env.
|
|
9
|
-
"Origin": process.env.
|
|
8
|
+
"x-public-key": process.env.KEY,
|
|
9
|
+
"Origin": process.env.ORIGIN,
|
|
10
10
|
Authorization: authHeader
|
|
11
11
|
// Use the authorization header if available
|
|
12
12
|
}
|
|
@@ -3,11 +3,11 @@ export default defineEventHandler(async (event) => {
|
|
|
3
3
|
const body = await readBody(event);
|
|
4
4
|
const { email, token } = body;
|
|
5
5
|
try {
|
|
6
|
-
const response = await fetch(`${process.env.
|
|
6
|
+
const response = await fetch(`${process.env.BASE}verify-token/`, {
|
|
7
7
|
method: "POST",
|
|
8
8
|
headers: {
|
|
9
|
-
"x-public-key": process.env.
|
|
10
|
-
"Origin": process.env.
|
|
9
|
+
"x-public-key": process.env.KEY,
|
|
10
|
+
"Origin": process.env.ORIGIN,
|
|
11
11
|
"Content-Type": "application/json"
|
|
12
12
|
},
|
|
13
13
|
body: JSON.stringify({ email, token })
|
|
@@ -30,11 +30,11 @@ export default defineEventHandler(async (event) => {
|
|
|
30
30
|
};
|
|
31
31
|
const options = {
|
|
32
32
|
headers: {
|
|
33
|
-
"x-api-secret": apiConfig?.
|
|
33
|
+
"x-api-secret": apiConfig?.SECRET || ""
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
const banners = await flowrixApi.get(`banners`, apiConfig, options);
|
|
37
|
-
if (config.
|
|
37
|
+
if (config.CACHE == "true" || config.public.CACHE == "true") {
|
|
38
38
|
await ensureCacheDir();
|
|
39
39
|
await writeFile(filePath, JSON.stringify(banners, null, 2), "utf-8");
|
|
40
40
|
}
|
|
@@ -40,10 +40,10 @@ export default defineEventHandler(async (event) => {
|
|
|
40
40
|
...query
|
|
41
41
|
};
|
|
42
42
|
const headers = {
|
|
43
|
-
"x-api-secret": apiConfig?.
|
|
43
|
+
"x-api-secret": apiConfig?.SECRET || ""
|
|
44
44
|
};
|
|
45
45
|
const brand = await flowrixApi.get(`brands/${slug}`, apiConfig, { query, headers });
|
|
46
|
-
if (config.
|
|
46
|
+
if (config.CACHE == "true" || config.public.CACHE == "true") {
|
|
47
47
|
await ensureCacheDir();
|
|
48
48
|
await writeFile(filePath, JSON.stringify(brand, null, 2), "utf-8");
|
|
49
49
|
}
|
|
@@ -34,7 +34,7 @@ export default defineEventHandler(async (event) => {
|
|
|
34
34
|
...query
|
|
35
35
|
};
|
|
36
36
|
const brands = await flowrixApi.get(`brands`, apiConfig, { query });
|
|
37
|
-
if (config.
|
|
37
|
+
if (config.CACHE == "true" || config.public.CACHE == "true") {
|
|
38
38
|
await ensureCacheDir();
|
|
39
39
|
await writeFile(filePath, JSON.stringify(brands, null, 2), "utf-8");
|
|
40
40
|
}
|
|
@@ -35,12 +35,12 @@ export default defineEventHandler(async (event) => {
|
|
|
35
35
|
};
|
|
36
36
|
const options = {
|
|
37
37
|
headers: {
|
|
38
|
-
"x-api-secret": apiConfig?.
|
|
38
|
+
"x-api-secret": apiConfig?.SECRET || ""
|
|
39
39
|
},
|
|
40
40
|
query
|
|
41
41
|
};
|
|
42
42
|
const brands = await flowrixApi.get(`brands`, apiConfig, options);
|
|
43
|
-
if (config.
|
|
43
|
+
if (config.CACHE == "true" || config.public.CACHE == "true") {
|
|
44
44
|
await ensureCacheDir();
|
|
45
45
|
await writeFile(filePath, JSON.stringify(brands, null, 2), "utf-8");
|
|
46
46
|
}
|
|
@@ -35,12 +35,12 @@ export default defineEventHandler(async (event) => {
|
|
|
35
35
|
};
|
|
36
36
|
const options = {
|
|
37
37
|
headers: {
|
|
38
|
-
"x-api-secret": apiConfig?.
|
|
38
|
+
"x-api-secret": apiConfig?.SECRET || ""
|
|
39
39
|
},
|
|
40
40
|
query
|
|
41
41
|
};
|
|
42
42
|
const categories = await flowrixApi.get(`categories`, apiConfig, options);
|
|
43
|
-
if (config.
|
|
43
|
+
if (config.CACHE == "true" || config.public.CACHE == "true") {
|
|
44
44
|
await ensureCacheDir();
|
|
45
45
|
await writeFile(filePath, JSON.stringify(categories, null, 2), "utf-8");
|
|
46
46
|
}
|
|
@@ -35,12 +35,12 @@ export default defineEventHandler(async (event) => {
|
|
|
35
35
|
};
|
|
36
36
|
const options = {
|
|
37
37
|
headers: {
|
|
38
|
-
"x-api-secret": apiConfig?.
|
|
38
|
+
"x-api-secret": apiConfig?.SECRET || ""
|
|
39
39
|
},
|
|
40
40
|
query
|
|
41
41
|
};
|
|
42
42
|
const categories = await flowrixApi.get(`categories/all`, apiConfig, options);
|
|
43
|
-
if (config.
|
|
43
|
+
if (config.CACHE == "true" || config.public.CACHE == "true") {
|
|
44
44
|
await ensureCacheDir();
|
|
45
45
|
await writeFile(filePath, JSON.stringify(categories, null, 2), "utf-8");
|
|
46
46
|
}
|
|
@@ -35,12 +35,12 @@ export default defineEventHandler(async (event) => {
|
|
|
35
35
|
};
|
|
36
36
|
const options = {
|
|
37
37
|
headers: {
|
|
38
|
-
"x-api-secret": apiConfig?.
|
|
38
|
+
"x-api-secret": apiConfig?.SECRET || ""
|
|
39
39
|
},
|
|
40
40
|
query
|
|
41
41
|
};
|
|
42
42
|
const featured = await flowrixApi.get(`products/featured`, apiConfig, options);
|
|
43
|
-
if (config.
|
|
43
|
+
if (config.CACHE == "true" || config.public.CACHE == "true") {
|
|
44
44
|
await ensureCacheDir();
|
|
45
45
|
await writeFile(filePath, JSON.stringify(featured, null, 2), "utf-8");
|
|
46
46
|
}
|
|
@@ -35,12 +35,12 @@ export default defineEventHandler(async (event) => {
|
|
|
35
35
|
};
|
|
36
36
|
const options = {
|
|
37
37
|
headers: {
|
|
38
|
-
"x-api-secret": apiConfig?.
|
|
38
|
+
"x-api-secret": apiConfig?.SECRET || ""
|
|
39
39
|
},
|
|
40
40
|
query
|
|
41
41
|
};
|
|
42
42
|
const posts = await flowrixApi.post(`posts`, apiConfig, options);
|
|
43
|
-
if (config.
|
|
43
|
+
if (config.CACHE == "true" || config.public.CACHE == "true") {
|
|
44
44
|
await ensureCacheDir();
|
|
45
45
|
await writeFile(filePath, JSON.stringify(posts, null, 2), "utf-8");
|
|
46
46
|
}
|
|
@@ -36,12 +36,12 @@ export default defineEventHandler(async (event) => {
|
|
|
36
36
|
};
|
|
37
37
|
const options = {
|
|
38
38
|
headers: {
|
|
39
|
-
"x-api-secret": apiConfig?.
|
|
39
|
+
"x-api-secret": apiConfig?.SECRET || ""
|
|
40
40
|
},
|
|
41
41
|
query
|
|
42
42
|
};
|
|
43
43
|
const samples = await flowrixApi.get(`samples`, apiConfig, options);
|
|
44
|
-
if (config.
|
|
44
|
+
if (config.CACHE == "true" || config.public.CACHE == "true") {
|
|
45
45
|
await ensureCacheDir();
|
|
46
46
|
await writeFile(filePath, JSON.stringify(samples, null, 2), "utf-8");
|
|
47
47
|
}
|
|
@@ -36,12 +36,12 @@ export default defineEventHandler(async (event) => {
|
|
|
36
36
|
};
|
|
37
37
|
const options = {
|
|
38
38
|
headers: {
|
|
39
|
-
"x-api-secret": apiConfig?.
|
|
39
|
+
"x-api-secret": apiConfig?.SECRET || ""
|
|
40
40
|
},
|
|
41
41
|
query
|
|
42
42
|
};
|
|
43
43
|
const search = await flowrixApi.get(`search`, apiConfig, options);
|
|
44
|
-
if (config.
|
|
44
|
+
if (config.CACHE == "true" || config.public.CACHE == "true") {
|
|
45
45
|
await ensureCacheDir();
|
|
46
46
|
await writeFile(filePath, JSON.stringify(search, null, 2), "utf-8");
|
|
47
47
|
}
|
|
@@ -44,13 +44,13 @@ export default defineEventHandler(async (event) => {
|
|
|
44
44
|
};
|
|
45
45
|
const options = {
|
|
46
46
|
headers: {
|
|
47
|
-
"x-api-secret": apiConfig?.
|
|
47
|
+
"x-api-secret": apiConfig?.SECRET || ""
|
|
48
48
|
},
|
|
49
49
|
query
|
|
50
50
|
};
|
|
51
51
|
console.log(" category category category category category category", options);
|
|
52
52
|
const category = await flowrixApi.get(`categories/${slug}`, apiConfig, options);
|
|
53
|
-
if (config.
|
|
53
|
+
if (config.CACHE == "true" || config.public.CACHE == "true") {
|
|
54
54
|
await ensureCacheDir();
|
|
55
55
|
await writeFile(filePath, JSON.stringify(category, null, 2), "utf-8");
|
|
56
56
|
}
|
|
@@ -4,11 +4,11 @@ export default defineEventHandler(async (event) => {
|
|
|
4
4
|
const slug = getRouterParam(event, "slug");
|
|
5
5
|
const accessTok = getCookie(event, "authToken");
|
|
6
6
|
try {
|
|
7
|
-
const response = await $fetch(`${process.env.
|
|
7
|
+
const response = await $fetch(`${process.env.BASE}mystore/customer/quotations/${slug}`, {
|
|
8
8
|
method: "GET",
|
|
9
9
|
headers: {
|
|
10
|
-
"x-public-key": process.env.
|
|
11
|
-
"Origin": process.env.
|
|
10
|
+
"x-public-key": process.env.KEY || "",
|
|
11
|
+
"Origin": process.env.ORIGIN || "",
|
|
12
12
|
"Authorization": `Bearer ${accessTok || ""}`
|
|
13
13
|
}
|
|
14
14
|
});
|
|
@@ -6,22 +6,22 @@ export default defineEventHandler(async (event) => {
|
|
|
6
6
|
const query = getQuery(event);
|
|
7
7
|
try {
|
|
8
8
|
if (method === "GET") {
|
|
9
|
-
const response = await $fetch(`${process.env.
|
|
9
|
+
const response = await $fetch(`${process.env.BASE}quotations/${slug}`, {
|
|
10
10
|
method: "GET",
|
|
11
11
|
headers: {
|
|
12
|
-
"x-public-key": process.env.
|
|
13
|
-
"Origin": process.env.
|
|
12
|
+
"x-public-key": process.env.KEY || "",
|
|
13
|
+
"Origin": process.env.ORIGIN || ""
|
|
14
14
|
},
|
|
15
15
|
query
|
|
16
16
|
});
|
|
17
17
|
return response;
|
|
18
18
|
} else if (method === "POST") {
|
|
19
19
|
const body = await readBody(event);
|
|
20
|
-
const response = await $fetch(`${process.env.
|
|
20
|
+
const response = await $fetch(`${process.env.BASE}quotations/${slug}`, {
|
|
21
21
|
method: "POST",
|
|
22
22
|
headers: {
|
|
23
|
-
"x-public-key": process.env.
|
|
24
|
-
"Origin": process.env.
|
|
23
|
+
"x-public-key": process.env.KEY || "",
|
|
24
|
+
"Origin": process.env.ORIGIN || ""
|
|
25
25
|
},
|
|
26
26
|
body,
|
|
27
27
|
query
|
|
@@ -4,11 +4,11 @@ export default defineEventHandler(async (event) => {
|
|
|
4
4
|
const method = getMethod(event);
|
|
5
5
|
const body = method === "POST" ? await readBody(event) : void 0;
|
|
6
6
|
try {
|
|
7
|
-
const response = await $fetch(`${process.env.
|
|
7
|
+
const response = await $fetch(`${process.env.BASE}checkout/quotation/customer`, {
|
|
8
8
|
method,
|
|
9
9
|
headers: {
|
|
10
|
-
"x-public-key": process.env.
|
|
11
|
-
"Origin": process.env.
|
|
10
|
+
"x-public-key": process.env.KEY,
|
|
11
|
+
"Origin": process.env.ORIGIN
|
|
12
12
|
},
|
|
13
13
|
body
|
|
14
14
|
});
|
|
@@ -5,11 +5,11 @@ export default defineEventHandler(async (event) => {
|
|
|
5
5
|
const body = await readBody(event);
|
|
6
6
|
const accessTok = getCookie(event, "authToken");
|
|
7
7
|
try {
|
|
8
|
-
const response = await $fetch(`${process.env.
|
|
8
|
+
const response = await $fetch(`${process.env.BASE}mystore/customer/checkout/quotation/${slug}`, {
|
|
9
9
|
method: "POST",
|
|
10
10
|
headers: {
|
|
11
|
-
"x-public-key": process.env.
|
|
12
|
-
"Origin": process.env.
|
|
11
|
+
"x-public-key": process.env.KEY || "",
|
|
12
|
+
"Origin": process.env.ORIGIN || "",
|
|
13
13
|
"Authorization": `Bearer ${accessTok || ""}`
|
|
14
14
|
},
|
|
15
15
|
body
|
|
@@ -38,11 +38,11 @@ export default defineEventHandler(async (event) => {
|
|
|
38
38
|
};
|
|
39
39
|
const options = {
|
|
40
40
|
headers: {
|
|
41
|
-
"x-api-secret": apiConfig?.
|
|
41
|
+
"x-api-secret": apiConfig?.SECRET || ""
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
44
|
const blog = await flowrixApi.get(`post/${slug}`, apiConfig, options);
|
|
45
|
-
if (config.
|
|
45
|
+
if (config.CACHE == "true" || config.public.CACHE == "true") {
|
|
46
46
|
await ensureCacheDir();
|
|
47
47
|
await writeFile(filePath, JSON.stringify(blog, null, 2), "utf-8");
|
|
48
48
|
}
|
|
@@ -35,12 +35,12 @@ export default defineEventHandler(async (event) => {
|
|
|
35
35
|
};
|
|
36
36
|
const options = {
|
|
37
37
|
headers: {
|
|
38
|
-
"x-api-secret": apiConfig?.
|
|
38
|
+
"x-api-secret": apiConfig?.SECRET || ""
|
|
39
39
|
},
|
|
40
40
|
query
|
|
41
41
|
};
|
|
42
42
|
const posts = await flowrixApi.post(`posts`, apiConfig, options);
|
|
43
|
-
if (config.
|
|
43
|
+
if (config.CACHE == "true" || config.public.CACHE == "true") {
|
|
44
44
|
await ensureCacheDir();
|
|
45
45
|
await writeFile(filePath, JSON.stringify(posts, null, 2), "utf-8");
|
|
46
46
|
}
|
|
@@ -11,7 +11,7 @@ export default defineEventHandler(async (event) => {
|
|
|
11
11
|
};
|
|
12
12
|
const options = {
|
|
13
13
|
headers: {
|
|
14
|
-
"x-api-secret": apiConfig?.
|
|
14
|
+
"x-api-secret": apiConfig?.SECRET || ""
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
17
|
const companyProfile = await flowrixApi.get(`company/profile`, apiConfig, options);
|
|
@@ -38,11 +38,11 @@ export default defineEventHandler(async (event) => {
|
|
|
38
38
|
};
|
|
39
39
|
const options = {
|
|
40
40
|
headers: {
|
|
41
|
-
"x-api-secret": apiConfig?.
|
|
41
|
+
"x-api-secret": apiConfig?.SECRET || ""
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
44
|
const webfrom = await flowrixApi.get(`contact-center/webforms/${slug}/details`, apiConfig, options);
|
|
45
|
-
if (config.
|
|
45
|
+
if (config.CACHE == "true" || config.public.CACHE == "true") {
|
|
46
46
|
await ensureCacheDir();
|
|
47
47
|
await writeFile(filePath, JSON.stringify(webfrom, null, 2), "utf-8");
|
|
48
48
|
}
|
|
@@ -28,11 +28,11 @@ export default defineEventHandler(async (event) => {
|
|
|
28
28
|
};
|
|
29
29
|
const options = {
|
|
30
30
|
headers: {
|
|
31
|
-
"x-api-secret": apiConfig?.
|
|
31
|
+
"x-api-secret": apiConfig?.SECRET || ""
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
34
|
const countries = await flowrixApi.get(`countries`, apiConfig, options);
|
|
35
|
-
if (config.
|
|
35
|
+
if (config.CACHE == "true" || config.public.CACHE == "true") {
|
|
36
36
|
await ensureCacheDir();
|
|
37
37
|
await writeFile(filePath, JSON.stringify(countries, null, 2), "utf-8");
|
|
38
38
|
}
|
|
@@ -3,11 +3,11 @@ export default defineEventHandler(async (event) => {
|
|
|
3
3
|
const accessTok = getCookie(event, "auth.token");
|
|
4
4
|
const body = await readBody(event);
|
|
5
5
|
try {
|
|
6
|
-
const responseData = await $fetch(`${process.env.
|
|
6
|
+
const responseData = await $fetch(`${process.env.BASE}customer/address/add`, {
|
|
7
7
|
method: "POST",
|
|
8
8
|
headers: {
|
|
9
|
-
"x-public-key": process.env.
|
|
10
|
-
"Origin": process.env.
|
|
9
|
+
"x-public-key": process.env.KEY || "",
|
|
10
|
+
"Origin": process.env.ORIGIN || "",
|
|
11
11
|
"Authorization": `Bearer ${accessTok || ""}`,
|
|
12
12
|
"Content-Type": "application/json",
|
|
13
13
|
"Accept": "application/json"
|
|
@@ -10,11 +10,11 @@ export default defineEventHandler(async (event) => {
|
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
12
|
try {
|
|
13
|
-
const response = await $fetch(`${process.env.
|
|
13
|
+
const response = await $fetch(`${process.env.BASE}customer/address/${addressId}/delete`, {
|
|
14
14
|
method: "PATCH",
|
|
15
15
|
headers: {
|
|
16
|
-
"x-public-key": process.env.
|
|
17
|
-
"Origin": process.env.
|
|
16
|
+
"x-public-key": process.env.KEY,
|
|
17
|
+
"Origin": process.env.ORIGIN,
|
|
18
18
|
"Authorization": `Bearer ${accessTok || ""}`
|
|
19
19
|
}
|
|
20
20
|
});
|
|
@@ -10,11 +10,11 @@ export default defineEventHandler(async (event) => {
|
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
12
|
try {
|
|
13
|
-
const response = await $fetch(`${process.env.
|
|
13
|
+
const response = await $fetch(`${process.env.BASE}customer/address/${addressId}/setshipping`, {
|
|
14
14
|
method: "POST",
|
|
15
15
|
headers: {
|
|
16
|
-
"x-public-key": process.env.
|
|
17
|
-
"Origin": process.env.
|
|
16
|
+
"x-public-key": process.env.KEY,
|
|
17
|
+
"Origin": process.env.ORIGIN,
|
|
18
18
|
"Authorization": `Bearer ${accessTok || ""}`,
|
|
19
19
|
"Content-Type": "application/json",
|
|
20
20
|
"Accept": "application/json"
|
|
@@ -12,11 +12,11 @@ export default defineEventHandler(async (event) => {
|
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
14
|
try {
|
|
15
|
-
const response = await $fetch(`${process.env.
|
|
15
|
+
const response = await $fetch(`${process.env.BASE}customer/address/${addressId}/update`, {
|
|
16
16
|
method: "PATCH",
|
|
17
17
|
headers: {
|
|
18
|
-
"x-public-key": process.env.
|
|
19
|
-
"Origin": process.env.
|
|
18
|
+
"x-public-key": process.env.KEY || "",
|
|
19
|
+
"Origin": process.env.ORIGIN || "",
|
|
20
20
|
"Authorization": `Bearer ${accessTok || ""}`,
|
|
21
21
|
"Content-Type": "application/json",
|
|
22
22
|
"Accept": "application/json"
|
|
@@ -3,11 +3,11 @@ export default defineEventHandler(async (event) => {
|
|
|
3
3
|
const accessTok = getCookie(event, "auth.token");
|
|
4
4
|
const { cardId } = getQuery(event);
|
|
5
5
|
try {
|
|
6
|
-
const response = await $fetch(`${process.env.
|
|
6
|
+
const response = await $fetch(`${process.env.BASE}customer/cards/${cardId}`, {
|
|
7
7
|
method: "DELETE",
|
|
8
8
|
headers: {
|
|
9
|
-
"x-public-key": process.env.
|
|
10
|
-
"Origin": process.env.
|
|
9
|
+
"x-public-key": process.env.KEY,
|
|
10
|
+
"Origin": process.env.ORIGIN,
|
|
11
11
|
"Authorization": `Bearer ${accessTok || ""}`
|
|
12
12
|
}
|
|
13
13
|
});
|
|
@@ -2,10 +2,10 @@ import { defineEventHandler, getCookie } from "h3";
|
|
|
2
2
|
export default defineEventHandler(async (event) => {
|
|
3
3
|
const accessTok = getCookie(event, "auth.token");
|
|
4
4
|
try {
|
|
5
|
-
const response = await $fetch(`${process.env.
|
|
5
|
+
const response = await $fetch(`${process.env.BASE}customer/cards`, {
|
|
6
6
|
headers: {
|
|
7
|
-
"x-public-key": process.env.
|
|
8
|
-
"Origin": process.env.
|
|
7
|
+
"x-public-key": process.env.KEY,
|
|
8
|
+
"Origin": process.env.ORIGIN,
|
|
9
9
|
"Authorization": `Bearer ${accessTok || ""}`
|
|
10
10
|
}
|
|
11
11
|
});
|