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.
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
@@ -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 response = await fetch(`${process.env.FLOWRIX_API_BASE}customer/change-password`, {
6
+ const response = await fetch(`${process.env.BASE}customer/change-password`, {
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"
@@ -3,11 +3,11 @@ import { $fetch } from "ofetch";
3
3
  export default defineEventHandler(async (event) => {
4
4
  const body = await readBody(event);
5
5
  try {
6
- const checkoutResponse = await $fetch(`${process.env.FLOWRIX_API_BASE}customer/checkout`, {
6
+ const checkoutResponse = await $fetch(`${process.env.BASE}customer/checkout`, {
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
  },
12
12
  body
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/orders`, {
5
+ const response = await $fetch(`${process.env.BASE}customer/orders`, {
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
  });
@@ -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 response = await fetch(`${process.env.FLOWRIX_API_BASE}customer/profile/update`, {
6
+ const response = await fetch(`${process.env.BASE}customer/profile/update`, {
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"
@@ -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/quotations`, {
5
+ const response = await $fetch(`${process.env.BASE}customer/quotations`, {
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
  });
@@ -2,11 +2,11 @@ import { defineEventHandler, readBody } from "h3";
2
2
  import { $fetch } from "ofetch";
3
3
  export default defineEventHandler(async (event) => {
4
4
  const body = await readBody(event);
5
- const search = await $fetch(`${process.env.FLOWRIX_API_BASE}customers/search`, {
5
+ const search = await $fetch(`${process.env.BASE}customers/search`, {
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
  },
11
11
  body
12
12
  });
@@ -8,11 +8,11 @@ export default defineEventHandler(async (event) => {
8
8
  }
9
9
  try {
10
10
  const apiRes = await fetch(
11
- `${process.env.FLOWRIX_API_BASE}customer/orders/${orderNo}/tax-invoice`,
11
+ `${process.env.BASE}customer/orders/${orderNo}/tax-invoice`,
12
12
  {
13
13
  headers: {
14
- "x-public-key": process.env.FLOWRIX_API_KEY,
15
- "Origin": process.env.FLOWRIX_API_ORIGIN,
14
+ "x-public-key": process.env.KEY,
15
+ "Origin": process.env.ORIGIN,
16
16
  "Authorization": `Bearer ${accessTok || ""}`
17
17
  }
18
18
  }
@@ -4,11 +4,11 @@ export default defineEventHandler(async (event) => {
4
4
  const body = await readBody(event);
5
5
  const { listId, productSlug } = getQuery(event);
6
6
  try {
7
- const response = await fetch(`${process.env.FLOWRIX_API_BASE}customer/wishlist/${listId}/${productSlug}/add`, {
7
+ const response = await fetch(`${process.env.BASE}customer/wishlist/${listId}/${productSlug}/add`, {
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
  "Authorization": `Bearer ${accessTok || ""}`,
13
13
  "Content-Type": "application/json",
14
14
  "Accept": "application/json"
@@ -3,11 +3,11 @@ export default defineEventHandler(async (event) => {
3
3
  const body = await readBody(event);
4
4
  const accessTok = getCookie(event, "auth.token");
5
5
  try {
6
- const response = await fetch(`${process.env.FLOWRIX_API_BASE}customer/wishlist/add`, {
6
+ const response = await fetch(`${process.env.BASE}customer/wishlist/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"
@@ -12,11 +12,11 @@ export default defineEventHandler(async (event) => {
12
12
  message: "Missing listId in query or productSlug in body"
13
13
  };
14
14
  }
15
- const response = await fetch(`${process.env.FLOWRIX_API_BASE}customer/wishlist/${listId}/item/delete`, {
15
+ const response = await fetch(`${process.env.BASE}customer/wishlist/${listId}/item/delete`, {
16
16
  method: "POST",
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"
@@ -4,11 +4,11 @@ export default defineEventHandler(async (event) => {
4
4
  const accessTok = getCookie(event, "auth.token");
5
5
  try {
6
6
  const { id } = body;
7
- const response = await fetch(`${process.env.FLOWRIX_API_BASE}customer/wishlist/${id}/delete`, {
7
+ const response = await fetch(`${process.env.BASE}customer/wishlist/${id}/delete`, {
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
  "Authorization": `Bearer ${accessTok || ""}`,
13
13
  "Content-Type": "application/json",
14
14
  "Accept": "application/json"
@@ -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/wishlist`, {
5
+ const response = await $fetch(`${process.env.BASE}customer/wishlist`, {
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
  });
@@ -3,11 +3,11 @@ export default defineEventHandler(async (event) => {
3
3
  const { listId } = getQuery(event);
4
4
  const accessTok = getCookie(event, "auth.token");
5
5
  try {
6
- const response = await fetch(`${process.env.FLOWRIX_API_BASE}customer/wishlist/${listId}/products`, {
6
+ const response = await fetch(`${process.env.BASE}customer/wishlist/${listId}/products`, {
7
7
  method: "GET",
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
  });
@@ -4,11 +4,11 @@ export default defineEventHandler(async (event) => {
4
4
  const accessTok = getCookie(event, "auth.token");
5
5
  try {
6
6
  const { id } = body;
7
- const response = await fetch(`${process.env.FLOWRIX_API_BASE}customer/wishlist/${id}/update`, {
7
+ const response = await fetch(`${process.env.BASE}customer/wishlist/${id}/update`, {
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
  "Authorization": `Bearer ${accessTok || ""}`,
13
13
  "Content-Type": "application/json",
14
14
  "Accept": "application/json"
@@ -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
  }
@@ -8,7 +8,7 @@ import { $fetch } from "ofetch";
8
8
  export default defineEventHandler(async (event) => {
9
9
  try {
10
10
  const config = useRuntimeConfig();
11
- const fileUrl = config.FLOWRIX_CDN + "robots.txt";
11
+ const fileUrl = config.CDN + "robots.txt";
12
12
  const fileContent = await $fetch(fileUrl);
13
13
  setHeader(event, "Content-Type", "text/plain; charset=utf-8");
14
14
  return fileContent;
@@ -13,7 +13,7 @@ export default defineEventHandler(async (event) => {
13
13
  }
14
14
  const isGzip = fullPath.endsWith(".gz");
15
15
  const config = useRuntimeConfig();
16
- const cdnUrl = config.FLOWRIX_CDN + "sitemaps/" + fullPath;
16
+ const cdnUrl = config.CDN + "sitemaps/" + fullPath;
17
17
  const buffer = await $fetch(cdnUrl, { responseType: "arrayBuffer" });
18
18
  const data = Buffer.from(buffer);
19
19
  if (isGzip) {
@@ -12,7 +12,7 @@ export default defineEventHandler(async (event) => {
12
12
  };
13
13
  const options = {
14
14
  headers: {
15
- "x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
15
+ "x-api-secret": apiConfig?.SECRET || ""
16
16
  },
17
17
  body: JSON.stringify(body)
18
18
  };
@@ -39,11 +39,11 @@ export default defineEventHandler(async (event) => {
39
39
  };
40
40
  const options = {
41
41
  headers: {
42
- "x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
42
+ "x-api-secret": apiConfig?.SECRET || ""
43
43
  }
44
44
  };
45
45
  const menu = await flowrixApi.get(`nav/${slug}/links`, apiConfig, options);
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(menu, null, 2), "utf-8");
49
49
  }
@@ -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 page = await flowrixApi.get(`page/${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(page, null, 2), "utf-8");
48
48
  }
@@ -41,13 +41,13 @@ export default defineEventHandler(async (event) => {
41
41
  };
42
42
  const options = {
43
43
  headers: {
44
- "x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
44
+ "x-api-secret": apiConfig?.SECRET || ""
45
45
  },
46
46
  query,
47
47
  body: JSON.stringify(body)
48
48
  };
49
49
  const product = await flowrixApi.post(`product/${slug}`, apiConfig, options);
50
- if (config.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
50
+ if (config.CACHE == "true" || config.public.CACHE == "true") {
51
51
  await ensureCacheDir();
52
52
  await writeFile(filePath, JSON.stringify(product, null, 2), "utf-8");
53
53
  }
@@ -12,7 +12,7 @@ export default defineEventHandler(async (event) => {
12
12
  };
13
13
  const options = {
14
14
  headers: {
15
- "x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
15
+ "x-api-secret": apiConfig?.SECRET || ""
16
16
  },
17
17
  body: JSON.stringify(body)
18
18
  };
@@ -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 reviews = await flowrixApi.get(`reviews`, apiConfig, options);
@@ -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
  }
@@ -41,11 +41,11 @@ export default defineEventHandler(async (event) => {
41
41
  };
42
42
  const options = {
43
43
  headers: {
44
- "x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
44
+ "x-api-secret": apiConfig?.SECRET || ""
45
45
  }
46
46
  };
47
47
  const service = await flowrixApi.get(`services/${slug}`, apiConfig, options);
48
- if (config.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
48
+ if (config.CACHE == "true" || config.public.CACHE == "true") {
49
49
  await ensureCacheDir();
50
50
  await writeFile(filePath, JSON.stringify(service, null, 2), "utf-8");
51
51
  }
@@ -12,7 +12,7 @@ export default defineEventHandler(async (event) => {
12
12
  };
13
13
  const options = {
14
14
  headers: {
15
- "x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
15
+ "x-api-secret": apiConfig?.SECRET || ""
16
16
  },
17
17
  body: JSON.stringify(body)
18
18
  };
@@ -41,11 +41,11 @@ export default defineEventHandler(async (event) => {
41
41
  };
42
42
  const options = {
43
43
  headers: {
44
- "x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
44
+ "x-api-secret": apiConfig?.SECRET || ""
45
45
  }
46
46
  };
47
47
  const service = await flowrixApi.get(`services`, apiConfig, options);
48
- if (config.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
48
+ if (config.CACHE == "true" || config.public.CACHE == "true") {
49
49
  await ensureCacheDir();
50
50
  await writeFile(filePath, JSON.stringify(service, null, 2), "utf-8");
51
51
  }
@@ -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
  }
@@ -12,7 +12,7 @@ export default defineEventHandler(async (event) => {
12
12
  };
13
13
  const options = {
14
14
  headers: {
15
- "x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
15
+ "x-api-secret": apiConfig?.SECRET || ""
16
16
  },
17
17
  body: JSON.stringify(body)
18
18
  };
@@ -14,11 +14,11 @@ export default defineEventHandler(async (event) => {
14
14
  };
15
15
  const options = {
16
16
  headers: {
17
- "x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
17
+ "x-api-secret": apiConfig?.SECRET || ""
18
18
  }
19
19
  };
20
20
  const page = await flowrixApi.get(`permalink/${slug}`, apiConfig, options);
21
- if (config.FLOWRIX_CACHE != "true" || config.public?.FLOWRIX_CACHE != "true") {
21
+ if (config.CACHE != "true" || config.public?.CACHE != "true") {
22
22
  const CACHE_DIR = join("/tmp", ".cache");
23
23
  if (existsSync(CACHE_DIR)) {
24
24
  await rm(CACHE_DIR, { recursive: true, force: true });
@@ -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
  }
@@ -37,15 +37,15 @@ function getLocationHeaders() {
37
37
  export function useApi() {
38
38
  const authStore = useAuthStore();
39
39
  const config = useRuntimeConfig();
40
- const FLOWRIX_API_KEY = config.FLOWRIX_API_KEY;
41
- const FLOWRIX_API_ORIGIN = config.FLOWRIX_API_ORIGIN;
42
- const FLOWRIX_API_BASE = config.FLOWRIX_API_BASE;
43
- const baseURL = FLOWRIX_API_BASE || "";
40
+ const KEY = config.KEY;
41
+ const ORIGIN = config.ORIGIN;
42
+ const BASE = config.BASE;
43
+ const baseURL = BASE || "";
44
44
  async function request(method, url, data = null, options = {}, extraHeaders = {}) {
45
45
  const locationHeaders = getLocationHeaders();
46
46
  const headers = {
47
47
  "Content-Type": "application/json",
48
- "x-public-key": FLOWRIX_API_KEY,
48
+ "x-public-key": KEY,
49
49
  // Add location headers from cookies
50
50
  ...locationHeaders,
51
51
  // Add extra headers
@@ -54,7 +54,7 @@ export default defineEventHandler(async (event) => {
54
54
  if (chunk) chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
55
55
  const html = Buffer.concat(chunks).toString("utf-8");
56
56
  if (event.node.res.statusCode === 200 && html.includes("<!DOCTYPE html>")) {
57
- if (config.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
57
+ if (config.CACHE == "true" || config.public.CACHE == "true") {
58
58
  writeCache(url, html, customerType);
59
59
  }
60
60
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowrix",
3
- "version": "1.0.1-beta.136",
3
+ "version": "1.0.1-beta.139",
4
4
  "description": "Plug-and-play Nuxt eCommerce cart powered by FLOWRiX. Subscription required.",
5
5
  "license": "MIT",
6
6
  "type": "module",