flowrix 1.0.1-beta.138 → 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.
Files changed (73) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +11 -12
  3. package/dist/runtime/middleware/flowrix.js +6 -6
  4. package/dist/runtime/server/api/albums.js +2 -2
  5. package/dist/runtime/server/api/auth/forgot.js +3 -3
  6. package/dist/runtime/server/api/auth/login.js +3 -3
  7. package/dist/runtime/server/api/auth/logout.js +3 -3
  8. package/dist/runtime/server/api/auth/register.js +3 -3
  9. package/dist/runtime/server/api/auth/user/reset-password.js +3 -3
  10. package/dist/runtime/server/api/auth/user/session.js +3 -3
  11. package/dist/runtime/server/api/auth/user/verify-token.js +3 -3
  12. package/dist/runtime/server/api/banners.js +2 -2
  13. package/dist/runtime/server/api/brand/[...slug].js +2 -2
  14. package/dist/runtime/server/api/brand/index.js +1 -1
  15. package/dist/runtime/server/api/catalog/brands.js +2 -2
  16. package/dist/runtime/server/api/catalog/categories.js +2 -2
  17. package/dist/runtime/server/api/catalog/categoriesall.js +2 -2
  18. package/dist/runtime/server/api/catalog/featured.js +2 -2
  19. package/dist/runtime/server/api/catalog/posts.js +2 -2
  20. package/dist/runtime/server/api/catalog/samples.js +2 -2
  21. package/dist/runtime/server/api/catalog/search.js +2 -2
  22. package/dist/runtime/server/api/category/[...slug].js +2 -2
  23. package/dist/runtime/server/api/checkout/quotation/[slug].js +3 -3
  24. package/dist/runtime/server/api/checkout/quotation/guest/[slug].js +6 -6
  25. package/dist/runtime/server/api/checkout/quotation/guest/customer.js +3 -3
  26. package/dist/runtime/server/api/checkout/quotation/submit/[slug].js +3 -3
  27. package/dist/runtime/server/api/cmspost/[...slug].js +2 -2
  28. package/dist/runtime/server/api/cmspost/all.js +2 -2
  29. package/dist/runtime/server/api/company/profile.js +1 -1
  30. package/dist/runtime/server/api/contact-center/webforms/[id]/details.js +2 -2
  31. package/dist/runtime/server/api/contact-center/webforms/create.js +1 -1
  32. package/dist/runtime/server/api/countries.js +2 -2
  33. package/dist/runtime/server/api/customer/address/add.js +3 -3
  34. package/dist/runtime/server/api/customer/address/delete.js +3 -3
  35. package/dist/runtime/server/api/customer/address/setshipping.js +3 -3
  36. package/dist/runtime/server/api/customer/address/update.js +3 -3
  37. package/dist/runtime/server/api/customer/cards/delete.js +3 -3
  38. package/dist/runtime/server/api/customer/cards/get.js +3 -3
  39. package/dist/runtime/server/api/customer/change-password.js +3 -3
  40. package/dist/runtime/server/api/customer/checkout.js +3 -3
  41. package/dist/runtime/server/api/customer/orders.js +3 -3
  42. package/dist/runtime/server/api/customer/profile/update.js +3 -3
  43. package/dist/runtime/server/api/customer/quotations.js +3 -3
  44. package/dist/runtime/server/api/customer/search.js +3 -3
  45. package/dist/runtime/server/api/customer/tax-invoice.js +3 -3
  46. package/dist/runtime/server/api/customer/wishlist/add.js +3 -3
  47. package/dist/runtime/server/api/customer/wishlist/createWishList.js +3 -3
  48. package/dist/runtime/server/api/customer/wishlist/deleteFromWishList.js +3 -3
  49. package/dist/runtime/server/api/customer/wishlist/deleteWishList.js +3 -3
  50. package/dist/runtime/server/api/customer/wishlist/get.js +3 -3
  51. package/dist/runtime/server/api/customer/wishlist/getWishListItems.js +3 -3
  52. package/dist/runtime/server/api/customer/wishlist/updateWishList.js +3 -3
  53. package/dist/runtime/server/api/featured.js +2 -2
  54. package/dist/runtime/server/api/generate/robots.get.js +1 -1
  55. package/dist/runtime/server/api/generate/sitemap.get.js +1 -1
  56. package/dist/runtime/server/api/location.js +1 -1
  57. package/dist/runtime/server/api/nav/[id]/links.js +2 -2
  58. package/dist/runtime/server/api/page/[...slug].js +2 -2
  59. package/dist/runtime/server/api/product/[...slug].js +2 -2
  60. package/dist/runtime/server/api/quickview/[slug].js +1 -1
  61. package/dist/runtime/server/api/reviews.js +1 -1
  62. package/dist/runtime/server/api/samples.js +2 -2
  63. package/dist/runtime/server/api/search.js +2 -2
  64. package/dist/runtime/server/api/service/[slug].js +2 -2
  65. package/dist/runtime/server/api/service/availability.js +1 -1
  66. package/dist/runtime/server/api/service/getall.js +2 -2
  67. package/dist/runtime/server/api/shop.js +2 -2
  68. package/dist/runtime/server/api/subscribe.js +1 -1
  69. package/dist/runtime/server/api/v2/[...slug].get.js +2 -2
  70. package/dist/runtime/server/api/webform.js +2 -2
  71. package/dist/runtime/utils/api.js +5 -5
  72. package/dist/runtime/utils/htmlCache.js +1 -1
  73. package/package.json +1 -1
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "flowrix",
3
3
  "configKey": "flowrix",
4
- "version": "1.0.1-beta.138",
4
+ "version": "1.0.1-beta.139",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
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.FLOWRIX_API_KEY = env.KEY || "";
14
- runtimeConfig.FLOWRIX_API_SECRET = env.SECRET || "";
15
- runtimeConfig.FLOWRIX_API_ORIGIN = env.ORIGIN || "";
16
- runtimeConfig.FLOWRIX_API_BASE = env.BASE || "";
17
- runtimeConfig.FLOWRIX_CACHE = env.CACHE || "false";
18
- runtimeConfig.FLOWRIX_CDN = env.CDN || "";
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
- FLOWRIX_API_KEY: env.KEY || "",
22
- FLOWRIX_API_ORIGIN: env.ORIGIN || "",
23
- FLOWRIX_API_BASE: env.BASE || "",
24
- FLOWRIX_CACHE: env.CACHE || "false",
25
- FLOWRIX_CDN: env.CDN || ""
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 FLOWRIX_API_KEY = config?.FLOWRIX_API_KEY || config.public?.FLOWRIX_API_KEY || "";
22
- const FLOWRIX_API_ORIGIN = config?.FLOWRIX_API_ORIGIN || config.public?.FLOWRIX_API_ORIGIN || "";
23
- let FLOWRIX_API_BASE = config?.FLOWRIX_API_BASE || config.public?.FLOWRIX_API_BASE || "";
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": FLOWRIX_API_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": FLOWRIX_API_ORIGIN,
31
+ "Origin": ORIGIN,
32
32
  ...options.headers
33
33
  };
34
34
  try {
35
- const response = await $fetch(`${FLOWRIX_API_BASE}${endpoint}`, {
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?.FLOWRIX_API_SECRET || ""
33
+ "x-api-secret": apiConfig?.SECRET || ""
34
34
  }
35
35
  };
36
36
  const albums = await flowrixApi.get(`albums`, apiConfig, options);
37
- if (config.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
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.FLOWRIX_API_BASE}verify-email/`, {
6
+ const response = await fetch(`${process.env.BASE}verify-email/`, {
7
7
  method: "POST",
8
8
  headers: {
9
- "x-public-key": process.env.FLOWRIX_API_KEY,
10
- "Origin": process.env.FLOWRIX_API_ORIGIN,
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.FLOWRIX_API_BASE}login/`, {
12
+ const response = await fetch(`${process.env.BASE}login/`, {
13
13
  method: "POST",
14
14
  headers: {
15
- "x-public-key": process.env.FLOWRIX_API_KEY,
16
- "Origin": process.env.FLOWRIX_API_ORIGIN,
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.FLOWRIX_API_BASE}customer/logout`, {
5
+ await $fetch(`${process.env.BASE}customer/logout`, {
6
6
  method: "POST",
7
7
  headers: {
8
- "x-public-key": process.env.FLOWRIX_API_KEY,
9
- "Origin": process.env.FLOWRIX_API_ORIGIN,
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.FLOWRIX_API_BASE}customer/create`, {
6
+ const response = await fetch(`${process.env.BASE}customer/create`, {
7
7
  method: "POST",
8
8
  headers: {
9
- "x-public-key": process.env.FLOWRIX_API_KEY,
10
- "Origin": process.env.FLOWRIX_API_ORIGIN,
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.FLOWRIX_API_BASE}reset-password/`, {
7
+ const response = await fetch(`${process.env.BASE}reset-password/`, {
8
8
  method: "POST",
9
9
  headers: {
10
- "x-public-key": process.env.FLOWRIX_API_KEY,
11
- "Origin": process.env.FLOWRIX_API_ORIGIN,
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.FLOWRIX_API_BASE}customer/profile`, {
5
+ const response = await fetch(`${process.env.BASE}customer/profile`, {
6
6
  method: "GET",
7
7
  headers: {
8
- "x-public-key": process.env.FLOWRIX_API_KEY,
9
- "Origin": process.env.FLOWRIX_API_ORIGIN,
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.FLOWRIX_API_BASE}verify-token/`, {
6
+ const response = await fetch(`${process.env.BASE}verify-token/`, {
7
7
  method: "POST",
8
8
  headers: {
9
- "x-public-key": process.env.FLOWRIX_API_KEY,
10
- "Origin": process.env.FLOWRIX_API_ORIGIN,
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?.FLOWRIX_API_SECRET || ""
33
+ "x-api-secret": apiConfig?.SECRET || ""
34
34
  }
35
35
  };
36
36
  const banners = await flowrixApi.get(`banners`, apiConfig, options);
37
- if (config.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
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?.FLOWRIX_API_SECRET || ""
43
+ "x-api-secret": apiConfig?.SECRET || ""
44
44
  };
45
45
  const brand = await flowrixApi.get(`brands/${slug}`, apiConfig, { query, headers });
46
- if (config.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
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.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
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?.FLOWRIX_API_SECRET || ""
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.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
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?.FLOWRIX_API_SECRET || ""
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.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
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?.FLOWRIX_API_SECRET || ""
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.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
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?.FLOWRIX_API_SECRET || ""
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.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
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?.FLOWRIX_API_SECRET || ""
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.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
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?.FLOWRIX_API_SECRET || ""
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.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
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?.FLOWRIX_API_SECRET || ""
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.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
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?.FLOWRIX_API_SECRET || ""
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.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
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.FLOWRIX_API_BASE}mystore/customer/quotations/${slug}`, {
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.FLOWRIX_API_KEY || "",
11
- "Origin": process.env.FLOWRIX_API_ORIGIN || "",
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.FLOWRIX_API_BASE}quotations/${slug}`, {
9
+ const response = await $fetch(`${process.env.BASE}quotations/${slug}`, {
10
10
  method: "GET",
11
11
  headers: {
12
- "x-public-key": process.env.FLOWRIX_API_KEY || "",
13
- "Origin": process.env.FLOWRIX_API_ORIGIN || ""
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.FLOWRIX_API_BASE}quotations/${slug}`, {
20
+ const response = await $fetch(`${process.env.BASE}quotations/${slug}`, {
21
21
  method: "POST",
22
22
  headers: {
23
- "x-public-key": process.env.FLOWRIX_API_KEY || "",
24
- "Origin": process.env.FLOWRIX_API_ORIGIN || ""
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.FLOWRIX_API_BASE}checkout/quotation/customer`, {
7
+ const response = await $fetch(`${process.env.BASE}checkout/quotation/customer`, {
8
8
  method,
9
9
  headers: {
10
- "x-public-key": process.env.FLOWRIX_API_KEY,
11
- "Origin": process.env.FLOWRIX_API_ORIGIN
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.FLOWRIX_API_BASE}mystore/customer/checkout/quotation/${slug}`, {
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.FLOWRIX_API_KEY || "",
12
- "Origin": process.env.FLOWRIX_API_ORIGIN || "",
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?.FLOWRIX_API_SECRET || ""
41
+ "x-api-secret": apiConfig?.SECRET || ""
42
42
  }
43
43
  };
44
44
  const blog = await flowrixApi.get(`post/${slug}`, apiConfig, options);
45
- if (config.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
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?.FLOWRIX_API_SECRET || ""
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.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
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?.FLOWRIX_API_SECRET || ""
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?.FLOWRIX_API_SECRET || ""
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.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
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
  }
@@ -11,7 +11,7 @@ export default defineEventHandler(async (event) => {
11
11
  };
12
12
  const options = {
13
13
  headers: {
14
- "x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
14
+ "x-api-secret": apiConfig?.SECRET || ""
15
15
  },
16
16
  body
17
17
  };
@@ -28,11 +28,11 @@ export default defineEventHandler(async (event) => {
28
28
  };
29
29
  const options = {
30
30
  headers: {
31
- "x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
31
+ "x-api-secret": apiConfig?.SECRET || ""
32
32
  }
33
33
  };
34
34
  const countries = await flowrixApi.get(`countries`, apiConfig, options);
35
- if (config.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
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.FLOWRIX_API_BASE}customer/address/add`, {
6
+ const responseData = await $fetch(`${process.env.BASE}customer/address/add`, {
7
7
  method: "POST",
8
8
  headers: {
9
- "x-public-key": process.env.FLOWRIX_API_KEY || "",
10
- "Origin": process.env.FLOWRIX_API_ORIGIN || "",
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.FLOWRIX_API_BASE}customer/address/${addressId}/delete`, {
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.FLOWRIX_API_KEY,
17
- "Origin": process.env.FLOWRIX_API_ORIGIN,
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.FLOWRIX_API_BASE}customer/address/${addressId}/setshipping`, {
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.FLOWRIX_API_KEY,
17
- "Origin": process.env.FLOWRIX_API_ORIGIN,
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.FLOWRIX_API_BASE}customer/address/${addressId}/update`, {
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.FLOWRIX_API_KEY || "",
19
- "Origin": process.env.FLOWRIX_API_ORIGIN || "",
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.FLOWRIX_API_BASE}customer/cards/${cardId}`, {
6
+ const response = await $fetch(`${process.env.BASE}customer/cards/${cardId}`, {
7
7
  method: "DELETE",
8
8
  headers: {
9
- "x-public-key": process.env.FLOWRIX_API_KEY,
10
- "Origin": process.env.FLOWRIX_API_ORIGIN,
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.FLOWRIX_API_BASE}customer/cards`, {
5
+ const response = await $fetch(`${process.env.BASE}customer/cards`, {
6
6
  headers: {
7
- "x-public-key": process.env.FLOWRIX_API_KEY,
8
- "Origin": process.env.FLOWRIX_API_ORIGIN,
7
+ "x-public-key": process.env.KEY,
8
+ "Origin": process.env.ORIGIN,
9
9
  "Authorization": `Bearer ${accessTok || ""}`
10
10
  }
11
11
  });