flowrix 1.0.1-beta.105 → 1.0.1-beta.107

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 (41) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +2 -1
  3. package/dist/runtime/composables/Product/useProductComponent.js +86 -0
  4. package/dist/runtime/composables/useApp.js +1 -1
  5. package/dist/runtime/composables/useMetaLayer.js +10 -10
  6. package/dist/runtime/composables/useTikTokDatalayer.js +7 -7
  7. package/dist/runtime/server/api/albums.js +6 -1
  8. package/dist/runtime/server/api/banners.js +6 -1
  9. package/dist/runtime/server/api/brand/[...slug].js +4 -1
  10. package/dist/runtime/server/api/catalog/brands.js +7 -1
  11. package/dist/runtime/server/api/catalog/categories.js +7 -1
  12. package/dist/runtime/server/api/catalog/categoriesall.js +7 -1
  13. package/dist/runtime/server/api/catalog/featured.js +7 -1
  14. package/dist/runtime/server/api/catalog/posts.js +7 -1
  15. package/dist/runtime/server/api/catalog/samples.js +7 -1
  16. package/dist/runtime/server/api/catalog/search.js +7 -1
  17. package/dist/runtime/server/api/category/[...slug].js +7 -1
  18. package/dist/runtime/server/api/cmspost/[...slug].js +6 -1
  19. package/dist/runtime/server/api/cmspost/all.js +7 -1
  20. package/dist/runtime/server/api/company/profile.js +6 -1
  21. package/dist/runtime/server/api/contact-center/webforms/[id]/details.js +6 -1
  22. package/dist/runtime/server/api/contact-center/webforms/create.js +6 -2
  23. package/dist/runtime/server/api/countries.js +6 -1
  24. package/dist/runtime/server/api/featured.js +7 -1
  25. package/dist/runtime/server/api/generate/sitemap.get.js +1 -1
  26. package/dist/runtime/server/api/location.js +6 -2
  27. package/dist/runtime/server/api/nav/[id]/links.js +6 -1
  28. package/dist/runtime/server/api/page/[...slug].js +6 -1
  29. package/dist/runtime/server/api/product/[...slug].js +8 -4
  30. package/dist/runtime/server/api/quickview/[slug].js +6 -2
  31. package/dist/runtime/server/api/reviews.js +6 -1
  32. package/dist/runtime/server/api/samples.js +7 -1
  33. package/dist/runtime/server/api/search.js +7 -1
  34. package/dist/runtime/server/api/service/[slug].js +6 -1
  35. package/dist/runtime/server/api/service/availability.js +6 -2
  36. package/dist/runtime/server/api/service/getall.js +6 -1
  37. package/dist/runtime/server/api/shop.js +7 -1
  38. package/dist/runtime/server/api/subscribe.js +6 -2
  39. package/dist/runtime/server/api/v2/[...slug].get.js +6 -1
  40. package/dist/runtime/server/api/webform.js +6 -1
  41. 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.105",
4
+ "version": "1.0.1-beta.107",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -8,15 +8,16 @@ const module$1 = defineNuxtModule({
8
8
  defaults: {},
9
9
  async setup(_options, nuxt) {
10
10
  const env = process.env;
11
+ console.log("envenvenvenvenvenvenv", env);
11
12
  const runtimeConfig = nuxt.options.runtimeConfig;
12
13
  runtimeConfig.FLOWRIX_API_KEY = env.KEY || runtimeConfig.FLOWRIX_API_KEY || "";
14
+ runtimeConfig.FLOWRIX_API_SECRET = env.SECRET || runtimeConfig.FLOWRIX_API_SECRET || "";
13
15
  runtimeConfig.FLOWRIX_API_ORIGIN = env.ORIGIN || runtimeConfig.FLOWRIX_API_ORIGIN || "";
14
16
  runtimeConfig.FLOWRIX_API_BASE = env.BASE || runtimeConfig.FLOWRIX_API_BASE || "";
15
17
  runtimeConfig.FLOWRIX_CACHE = env.CACHE || runtimeConfig.FLOWRIX_CACHE || "false";
16
18
  runtimeConfig.FLOWRIX_CDN = env.CDN || runtimeConfig.FLOWRIX_CDN || "";
17
19
  Object.assign(runtimeConfig.public, {
18
20
  ...runtimeConfig.public,
19
- ...process.env,
20
21
  FLOWRIX_API_KEY: runtimeConfig.public.FLOWRIX_API_KEY || env.KEY || runtimeConfig.FLOWRIX_API_KEY || "",
21
22
  FLOWRIX_API_ORIGIN: runtimeConfig.public.FLOWRIX_API_ORIGIN || env.ORIGIN || runtimeConfig.FLOWRIX_API_ORIGIN || "",
22
23
  FLOWRIX_API_BASE: runtimeConfig.public.FLOWRIX_API_BASE || env.BASE || runtimeConfig.FLOWRIX_API_BASE || "",
@@ -1,9 +1,12 @@
1
1
  import { defineAsyncComponent } from "vue";
2
+ import { useHead } from "#imports";
2
3
  import { GTM_view_item } from "../useDataLayer.js";
3
4
  import { META_view_item } from "../useMetaLayer.js";
4
5
  import { TikTok_view_item } from "../useTikTokDatalayer.js";
6
+ import { useCompanyProfile } from "../../stores/useCompanyProfile.js";
5
7
  export function useProductComponent(product) {
6
8
  const templateName = "Template-" + product.template;
9
+ const companyProfile = useCompanyProfile();
7
10
  const components = import.meta.glob(
8
11
  "~/components/Product/Template*/index.vue"
9
12
  );
@@ -18,6 +21,89 @@ export function useProductComponent(product) {
18
21
  }
19
22
  }
20
23
  });
24
+ const ifPromotioned = () => {
25
+ if (product.rpfloat > product.pricefloat) {
26
+ return [
27
+ {
28
+ "@type": "UnitPriceSpecification",
29
+ "price": product.rpfloat,
30
+ "priceCurrency": companyProfile.profile?.data?.currencyCode || "",
31
+ "priceComponentType": "https://schema.org/ListPrice"
32
+ }
33
+ ];
34
+ }
35
+ return [];
36
+ };
37
+ if (product?.faqs?.length) {
38
+ const faqSchema = {
39
+ "@context": "https://schema.org",
40
+ "@type": "FAQPage",
41
+ "name": `${product.name} - FAQs`,
42
+ "mainEntity": product?.faqs.map((faq) => ({
43
+ "@type": "Question",
44
+ "name": faq.question,
45
+ "acceptedAnswer": {
46
+ "@type": "Answer",
47
+ "text": faq.answer.replace(/<\/?p>/g, "")
48
+ // remove <p> tags
49
+ }
50
+ }))
51
+ };
52
+ useHead({
53
+ script: [
54
+ {
55
+ type: "application/ld+json",
56
+ id: "faq-schema",
57
+ children: JSON.stringify(faqSchema)
58
+ }
59
+ ]
60
+ });
61
+ }
62
+ useHead({
63
+ meta: [
64
+ {
65
+ name: "robots",
66
+ content: product?.robots || ""
67
+ }
68
+ ],
69
+ script: [
70
+ {
71
+ type: "application/ld+json",
72
+ id: "product-schema",
73
+ children: JSON.stringify({
74
+ "@context": "https://schema.org/",
75
+ "@type": "Product",
76
+ "name": product.name || "",
77
+ "image": [
78
+ product.image || ""
79
+ ],
80
+ "description": product.description || "",
81
+ "sku": product.sku || "",
82
+ "brand": {
83
+ "@type": "Brand",
84
+ "name": product.brand || ""
85
+ },
86
+ "offers": {
87
+ "@type": "Offer",
88
+ "url": "https://iseekblinds.com.au/shop",
89
+ "priceCurrency": companyProfile.profile?.data?.currencyCode || "",
90
+ "price": product.pricefloat || "",
91
+ "availability": "https://schema.org/InStock",
92
+ "itemCondition": "https://schema.org/NewCondition",
93
+ "priceSpecification": [
94
+ ...ifPromotioned(),
95
+ {
96
+ "@type": "UnitPriceSpecification",
97
+ "price": product.pricefloat || "",
98
+ "priceCurrency": companyProfile.profile?.data?.currencyCode || "",
99
+ "priceComponentType": "https://schema.org/SalePrice"
100
+ }
101
+ ]
102
+ }
103
+ })
104
+ }
105
+ ]
106
+ });
21
107
  GTM_view_item(product, product.rrpfloat, product.rpfloat);
22
108
  META_view_item(product, product.rrpfloat, product.rpfloat);
23
109
  TikTok_view_item(product, product.rrpfloat, product.rpfloat);
@@ -45,7 +45,7 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
45
45
  children: JSON.stringify({
46
46
  "@context": "https://schema.org",
47
47
  "@type": "WebSite",
48
- "url": "https://www.example.com",
48
+ "url": websiteurl,
49
49
  "name": sitename,
50
50
  "alternateName": meta_title,
51
51
  "description": meta_description,
@@ -11,7 +11,7 @@ export function META_page_view(to) {
11
11
  fbq("trackCustom", "virtualPageView", {
12
12
  content_type: "virtualPageView",
13
13
  content_name: to.meta?.head?.meta_title,
14
- currency: useCompanyProfile().profile?.currencyCode
14
+ currency: useCompanyProfile().profile?.data?.currencyCode
15
15
  });
16
16
  }
17
17
  }
@@ -25,7 +25,7 @@ export function META_view_item(product, price = 0, rp = 0) {
25
25
  content_name: product.name,
26
26
  discount,
27
27
  value: price,
28
- currency: useCompanyProfile().profile?.currencyCode
28
+ currency: useCompanyProfile().profile?.data?.currencyCode
29
29
  });
30
30
  }
31
31
  }
@@ -58,7 +58,7 @@ export function META_view_item_list(listItems = []) {
58
58
  contents: ecomarceItems,
59
59
  content_type: "Items List",
60
60
  value: 0,
61
- currency: useCompanyProfile().profile?.currencyCode || "GBP"
61
+ currency: useCompanyProfile().profile?.data?.currencyCode || "GBP"
62
62
  });
63
63
  }
64
64
  } catch (err) {
@@ -75,7 +75,7 @@ export function META_add_to_cart(lastitem = null) {
75
75
  content_name: lastitem.name,
76
76
  discount,
77
77
  value: lastitem.pricefloat,
78
- currency: useCompanyProfile().profile?.currencyCode
78
+ currency: useCompanyProfile().profile?.data?.currencyCode
79
79
  });
80
80
  }
81
81
  }
@@ -102,7 +102,7 @@ export function META_remove_from_cart(lastitem = null) {
102
102
  contents: ecomarceCartItems,
103
103
  content_type: "Items List",
104
104
  value: lastitem?.pricefloat,
105
- currency: useCompanyProfile().profile?.currencyCode
105
+ currency: useCompanyProfile().profile?.data?.currencyCode
106
106
  });
107
107
  }
108
108
  }
@@ -132,7 +132,7 @@ export function META_view_cart(cart = null) {
132
132
  contents: ecomarceCartItems,
133
133
  content_type: "View Cart",
134
134
  value: cart.totals.total,
135
- currency: useCompanyProfile().profile?.currencyCode
135
+ currency: useCompanyProfile().profile?.data?.currencyCode
136
136
  });
137
137
  }
138
138
  }
@@ -161,7 +161,7 @@ export function META_begin_checkout(cart = null) {
161
161
  contents: ecomarceCartItems,
162
162
  content_type: "Checkout",
163
163
  value: cart.totals.total,
164
- currency: useCompanyProfile().profile?.currencyCode
164
+ currency: useCompanyProfile().profile?.data?.currencyCode
165
165
  });
166
166
  }
167
167
  }
@@ -194,7 +194,7 @@ export function META_add_shipping_info(cart = null, shipping_tier = null) {
194
194
  contents: ecomarceCartItems,
195
195
  content_type: shipping_tier?.title || "Shipping",
196
196
  value: cart.totals.total,
197
- currency: useCompanyProfile().profile?.currencyCode
197
+ currency: useCompanyProfile().profile?.data?.currencyCode
198
198
  });
199
199
  }
200
200
  }
@@ -223,7 +223,7 @@ export function META_add_payment_info(cart = null, payment_type = "") {
223
223
  contents: ecomarceCartItems,
224
224
  content_type: payment_type || "Payment",
225
225
  value: cart.totals.total,
226
- currency: useCompanyProfile().profile?.currencyCode
226
+ currency: useCompanyProfile().profile?.data?.currencyCode
227
227
  });
228
228
  }
229
229
  }
@@ -257,7 +257,7 @@ export function META_purchase(orderData = null, cart = null) {
257
257
  tax: orderData.tax,
258
258
  shipping: orderData.shipping,
259
259
  coupon: orderData.vouchercode,
260
- currency: useCompanyProfile().profile?.currencyCode
260
+ currency: useCompanyProfile().profile?.data?.currencyCode
261
261
  });
262
262
  }
263
263
  }
@@ -24,7 +24,7 @@ export function TikTok_view_item(product, price = 0, rp = 0) {
24
24
  description: product?.category,
25
25
  content_name: product?.name,
26
26
  price: Number(rp) > 0 ? Number(rp) : Number(price),
27
- currency: useCompanyProfile().profile?.currencyCode,
27
+ currency: useCompanyProfile().profile?.data?.currencyCode,
28
28
  value: price
29
29
  }]
30
30
  });
@@ -46,7 +46,7 @@ export function TikTok_add_to_cart(lastitem = "") {
46
46
  ttq.track("AddToCart", {
47
47
  contents: ecomarceCartItems,
48
48
  value: price,
49
- currency: useCompanyProfile().profile?.currencyCode
49
+ currency: useCompanyProfile().profile?.data?.currencyCode
50
50
  });
51
51
  }
52
52
  export function TikTok_view_cart(cart = "") {
@@ -68,7 +68,7 @@ export function TikTok_view_cart(cart = "") {
68
68
  ttq.track("ViewCart", {
69
69
  contents: ecomarceCartItems,
70
70
  value: cart.totals.total,
71
- currency: useCompanyProfile().profile?.currencyCode
71
+ currency: useCompanyProfile().profile?.data?.currencyCode
72
72
  });
73
73
  }
74
74
  export function TikTok_remove_from_cart(lastitem = "") {
@@ -88,7 +88,7 @@ export function TikTok_remove_from_cart(lastitem = "") {
88
88
  ttq.track("RemoveFromCart", {
89
89
  contents: ecomarceCartItems,
90
90
  value: price,
91
- currency: useCompanyProfile().profile?.currencyCode
91
+ currency: useCompanyProfile().profile?.data?.currencyCode
92
92
  });
93
93
  }
94
94
  export function TikTok_begin_checkout(cart = "") {
@@ -110,7 +110,7 @@ export function TikTok_begin_checkout(cart = "") {
110
110
  ttq.track("InitiateCheckout", {
111
111
  contents: ecomarceCartItems,
112
112
  value: cart.totals.total,
113
- currency: useCompanyProfile().profile?.currencyCode
113
+ currency: useCompanyProfile().profile?.data?.currencyCode
114
114
  });
115
115
  }
116
116
  export function TikTok_add_payment_info(cart = "", payment_type = "") {
@@ -133,7 +133,7 @@ export function TikTok_add_payment_info(cart = "", payment_type = "") {
133
133
  contents: ecomarceCartItems,
134
134
  payment_type,
135
135
  value: cart.totals.total,
136
- currency: useCompanyProfile().profile?.currencyCode
136
+ currency: useCompanyProfile().profile?.data?.currencyCode
137
137
  });
138
138
  }
139
139
  export function TikTok_purchase(orderData = "", cart = "") {
@@ -155,7 +155,7 @@ export function TikTok_purchase(orderData = "", cart = "") {
155
155
  ttq.track("Purchase", {
156
156
  contents: purchaseitems,
157
157
  value: orderData.grandtotalFloat,
158
- currency: useCompanyProfile().profile?.currencyCode,
158
+ currency: useCompanyProfile().profile?.data?.currencyCode,
159
159
  transaction_id: orderData.order_no,
160
160
  affiliation: "online Store",
161
161
  tax: orderData.tax,
@@ -28,7 +28,12 @@ export default defineEventHandler(async (event) => {
28
28
  ...config,
29
29
  cookies: rawCookies
30
30
  };
31
- const albums = await flowrixApi.get(`albums`, apiConfig);
31
+ const options = {
32
+ headers: {
33
+ "x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
34
+ }
35
+ };
36
+ const albums = await flowrixApi.get(`albums`, apiConfig, options);
32
37
  if (config.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
33
38
  await ensureCacheDir();
34
39
  await writeFile(filePath, JSON.stringify(albums, null, 2), "utf-8");
@@ -28,7 +28,12 @@ export default defineEventHandler(async (event) => {
28
28
  ...config,
29
29
  cookies: rawCookies
30
30
  };
31
- const banners = await flowrixApi.get(`banners`, apiConfig);
31
+ const options = {
32
+ headers: {
33
+ "x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
34
+ }
35
+ };
36
+ const banners = await flowrixApi.get(`banners`, apiConfig, options);
32
37
  if (config.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
33
38
  await ensureCacheDir();
34
39
  await writeFile(filePath, JSON.stringify(banners, null, 2), "utf-8");
@@ -39,7 +39,10 @@ export default defineEventHandler(async (event) => {
39
39
  query = {
40
40
  ...query
41
41
  };
42
- const brand = await flowrixApi.get(`brands/${slug}`, apiConfig, { query });
42
+ const headers = {
43
+ "x-api-secret": apiConfig?.FLOWRIX_API_KEY || ""
44
+ };
45
+ const brand = await flowrixApi.get(`brands/${slug}`, apiConfig, { query, headers });
43
46
  if (config.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
44
47
  await ensureCacheDir();
45
48
  await writeFile(filePath, JSON.stringify(brand, null, 2), "utf-8");
@@ -33,7 +33,13 @@ export default defineEventHandler(async (event) => {
33
33
  query = {
34
34
  ...query
35
35
  };
36
- const brands = await flowrixApi.get(`brands`, apiConfig, { query });
36
+ const options = {
37
+ headers: {
38
+ "x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
39
+ },
40
+ query
41
+ };
42
+ const brands = await flowrixApi.get(`brands`, apiConfig, options);
37
43
  if (config.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
38
44
  await ensureCacheDir();
39
45
  await writeFile(filePath, JSON.stringify(brands, null, 2), "utf-8");
@@ -33,7 +33,13 @@ export default defineEventHandler(async (event) => {
33
33
  query = {
34
34
  ...query
35
35
  };
36
- const categories = await flowrixApi.get(`categories`, apiConfig, { query });
36
+ const options = {
37
+ headers: {
38
+ "x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
39
+ },
40
+ query
41
+ };
42
+ const categories = await flowrixApi.get(`categories`, apiConfig, options);
37
43
  if (config.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
38
44
  await ensureCacheDir();
39
45
  await writeFile(filePath, JSON.stringify(categories, null, 2), "utf-8");
@@ -33,7 +33,13 @@ export default defineEventHandler(async (event) => {
33
33
  query = {
34
34
  ...query
35
35
  };
36
- const categories = await flowrixApi.get(`categories/all`, apiConfig, { query });
36
+ const options = {
37
+ headers: {
38
+ "x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
39
+ },
40
+ query
41
+ };
42
+ const categories = await flowrixApi.get(`categories/all`, apiConfig, options);
37
43
  if (config.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
38
44
  await ensureCacheDir();
39
45
  await writeFile(filePath, JSON.stringify(categories, null, 2), "utf-8");
@@ -33,7 +33,13 @@ export default defineEventHandler(async (event) => {
33
33
  query = {
34
34
  ...query
35
35
  };
36
- const featured = await flowrixApi.get(`products/featured`, apiConfig, { query });
36
+ const options = {
37
+ headers: {
38
+ "x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
39
+ },
40
+ query
41
+ };
42
+ const featured = await flowrixApi.get(`products/featured`, apiConfig, options);
37
43
  if (config.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
38
44
  await ensureCacheDir();
39
45
  await writeFile(filePath, JSON.stringify(featured, null, 2), "utf-8");
@@ -33,7 +33,13 @@ export default defineEventHandler(async (event) => {
33
33
  query = {
34
34
  ...query
35
35
  };
36
- const posts = await flowrixApi.post(`posts`, apiConfig, { query });
36
+ const options = {
37
+ headers: {
38
+ "x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
39
+ },
40
+ query
41
+ };
42
+ const posts = await flowrixApi.post(`posts`, apiConfig, options);
37
43
  if (config.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
38
44
  await ensureCacheDir();
39
45
  await writeFile(filePath, JSON.stringify(posts, null, 2), "utf-8");
@@ -34,7 +34,13 @@ export default defineEventHandler(async (event) => {
34
34
  query = {
35
35
  ...query
36
36
  };
37
- const samples = await flowrixApi.get(`samples`, apiConfig, { query });
37
+ const options = {
38
+ headers: {
39
+ "x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
40
+ },
41
+ query
42
+ };
43
+ const samples = await flowrixApi.get(`samples`, apiConfig, options);
38
44
  if (config.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
39
45
  await ensureCacheDir();
40
46
  await writeFile(filePath, JSON.stringify(samples, null, 2), "utf-8");
@@ -34,7 +34,13 @@ export default defineEventHandler(async (event) => {
34
34
  query = {
35
35
  ...query
36
36
  };
37
- const search = await flowrixApi.get(`search`, apiConfig, { query });
37
+ const options = {
38
+ headers: {
39
+ "x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
40
+ },
41
+ query
42
+ };
43
+ const search = await flowrixApi.get(`search`, apiConfig, options);
38
44
  if (config.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
39
45
  await ensureCacheDir();
40
46
  await writeFile(filePath, JSON.stringify(search, null, 2), "utf-8");
@@ -41,7 +41,13 @@ export default defineEventHandler(async (event) => {
41
41
  ...query,
42
42
  "scope[withchildren]": "true"
43
43
  };
44
- const category = await flowrixApi.get(`categories/${slug}`, apiConfig, { query });
44
+ const options = {
45
+ headers: {
46
+ "x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
47
+ },
48
+ query
49
+ };
50
+ const category = await flowrixApi.get(`categories/${slug}`, apiConfig, options);
45
51
  if (config.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
46
52
  await ensureCacheDir();
47
53
  await writeFile(filePath, JSON.stringify(category, null, 2), "utf-8");
@@ -36,7 +36,12 @@ export default defineEventHandler(async (event) => {
36
36
  ...config,
37
37
  cookies: rawCookies
38
38
  };
39
- const blog = await flowrixApi.get(`post/${slug}`, apiConfig, {});
39
+ const options = {
40
+ headers: {
41
+ "x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
42
+ }
43
+ };
44
+ const blog = await flowrixApi.get(`post/${slug}`, apiConfig, options);
40
45
  if (config.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
41
46
  await ensureCacheDir();
42
47
  await writeFile(filePath, JSON.stringify(blog, null, 2), "utf-8");
@@ -33,7 +33,13 @@ export default defineEventHandler(async (event) => {
33
33
  query = {
34
34
  ...query
35
35
  };
36
- const posts = await flowrixApi.post(`posts`, apiConfig, { query });
36
+ const options = {
37
+ headers: {
38
+ "x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
39
+ },
40
+ query
41
+ };
42
+ const posts = await flowrixApi.post(`posts`, apiConfig, options);
37
43
  if (config.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
38
44
  await ensureCacheDir();
39
45
  await writeFile(filePath, JSON.stringify(posts, null, 2), "utf-8");
@@ -9,7 +9,12 @@ export default defineEventHandler(async (event) => {
9
9
  ...config,
10
10
  cookies: rawCookies
11
11
  };
12
- const companyProfile = await flowrixApi.get(`company/profile`, apiConfig);
12
+ const options = {
13
+ headers: {
14
+ "x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
15
+ }
16
+ };
17
+ const companyProfile = await flowrixApi.get(`company/profile`, apiConfig, options);
13
18
  return companyProfile;
14
19
  } catch (error) {
15
20
  setResponseStatus(event, 500);
@@ -36,7 +36,12 @@ export default defineEventHandler(async (event) => {
36
36
  ...config,
37
37
  cookies: rawCookies
38
38
  };
39
- const webfrom = await flowrixApi.get(`contact-center/webforms/${slug}/details`, apiConfig, {});
39
+ const options = {
40
+ headers: {
41
+ "x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
42
+ }
43
+ };
44
+ const webfrom = await flowrixApi.get(`contact-center/webforms/${slug}/details`, apiConfig, options);
40
45
  if (config.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
41
46
  await ensureCacheDir();
42
47
  await writeFile(filePath, JSON.stringify(webfrom, null, 2), "utf-8");
@@ -9,8 +9,12 @@ export default defineEventHandler(async (event) => {
9
9
  ...config,
10
10
  cookies: rawCookies
11
11
  };
12
- const webform = await flowrixApi.post(`posts`, apiConfig, {
12
+ const options = {
13
+ headers: {
14
+ "x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
15
+ },
13
16
  body
14
- });
17
+ };
18
+ const webform = await flowrixApi.post(`posts`, apiConfig, options);
15
19
  return webform;
16
20
  });
@@ -26,7 +26,12 @@ export default defineEventHandler(async (event) => {
26
26
  ...config,
27
27
  cookies: rawCookies
28
28
  };
29
- const countries = await flowrixApi.get(`countries`, apiConfig);
29
+ const options = {
30
+ headers: {
31
+ "x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
32
+ }
33
+ };
34
+ const countries = await flowrixApi.get(`countries`, apiConfig, options);
30
35
  if (config.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
31
36
  await ensureCacheDir();
32
37
  await writeFile(filePath, JSON.stringify(countries, null, 2), "utf-8");
@@ -33,7 +33,13 @@ export default defineEventHandler(async (event) => {
33
33
  query = {
34
34
  ...query
35
35
  };
36
- const featured = await flowrixApi.get(`products/featured`, apiConfig, { query });
36
+ const options = {
37
+ headers: {
38
+ "x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
39
+ },
40
+ query
41
+ };
42
+ const featured = await flowrixApi.get(`products/featured`, apiConfig, options);
37
43
  if (config.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
38
44
  await ensureCacheDir();
39
45
  await writeFile(filePath, JSON.stringify(featured, null, 2), "utf-8");
@@ -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 + "sitemap/" + fullPath;
16
+ const cdnUrl = config.FLOWRIX_CDN + "sitemaps/" + fullPath;
17
17
  const buffer = await $fetch(cdnUrl, { responseType: "arrayBuffer" });
18
18
  const data = Buffer.from(buffer);
19
19
  if (isGzip) {
@@ -10,9 +10,13 @@ export default defineEventHandler(async (event) => {
10
10
  ...config,
11
11
  cookies: rawCookies
12
12
  };
13
- const location = await flowrixApi.post(`ip/location`, apiConfig, {
13
+ const options = {
14
+ headers: {
15
+ "x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
16
+ },
14
17
  body: JSON.stringify(body)
15
- });
18
+ };
19
+ const location = await flowrixApi.post(`ip/location`, apiConfig, options);
16
20
  return location;
17
21
  } catch (error) {
18
22
  setResponseStatus(event, 500);
@@ -37,7 +37,12 @@ export default defineEventHandler(async (event) => {
37
37
  ...config,
38
38
  cookies: rawCookies
39
39
  };
40
- const menu = await flowrixApi.get(`nav/${slug}/links`, apiConfig, {});
40
+ const options = {
41
+ headers: {
42
+ "x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
43
+ }
44
+ };
45
+ const menu = await flowrixApi.get(`nav/${slug}/links`, apiConfig, options);
41
46
  if (config.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
42
47
  await ensureCacheDir();
43
48
  await writeFile(filePath, JSON.stringify(menu, null, 2), "utf-8");
@@ -36,7 +36,12 @@ export default defineEventHandler(async (event) => {
36
36
  ...config,
37
37
  cookies: rawCookies
38
38
  };
39
- const page = await flowrixApi.get(`page/${slug}`, apiConfig, {});
39
+ const options = {
40
+ headers: {
41
+ "x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
42
+ }
43
+ };
44
+ const page = await flowrixApi.get(`page/${slug}`, apiConfig, options);
40
45
  if (config.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
41
46
  await ensureCacheDir();
42
47
  await writeFile(filePath, JSON.stringify(page, null, 2), "utf-8");
@@ -39,10 +39,14 @@ export default defineEventHandler(async (event) => {
39
39
  query = {
40
40
  ...query
41
41
  };
42
- const product = await flowrixApi.post(`product/${slug}`, apiConfig, {
43
- body: JSON.stringify(body),
44
- query
45
- });
42
+ const options = {
43
+ headers: {
44
+ "x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
45
+ },
46
+ query,
47
+ body: JSON.stringify(body)
48
+ };
49
+ const product = await flowrixApi.post(`product/${slug}`, apiConfig, options);
46
50
  if (config.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
47
51
  await ensureCacheDir();
48
52
  await writeFile(filePath, JSON.stringify(product, null, 2), "utf-8");
@@ -10,8 +10,12 @@ export default defineEventHandler(async (event) => {
10
10
  ...config,
11
11
  cookies: rawCookies
12
12
  };
13
- const quickview = await flowrixApi.post(`quickview/${slug}`, apiConfig, {
13
+ const options = {
14
+ headers: {
15
+ "x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
16
+ },
14
17
  body: JSON.stringify(body)
15
- });
18
+ };
19
+ const quickview = await flowrixApi.post(`quickview/${slug}`, apiConfig, options);
16
20
  return quickview;
17
21
  });
@@ -9,7 +9,12 @@ export default defineEventHandler(async (event) => {
9
9
  ...config,
10
10
  cookies: rawCookies
11
11
  };
12
- const reviews = await flowrixApi.get(`reviews`, apiConfig, {});
12
+ const options = {
13
+ headers: {
14
+ "x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
15
+ }
16
+ };
17
+ const reviews = await flowrixApi.get(`reviews`, apiConfig, options);
13
18
  return reviews;
14
19
  } catch (error) {
15
20
  setResponseStatus(event, 500);
@@ -34,7 +34,13 @@ export default defineEventHandler(async (event) => {
34
34
  query = {
35
35
  ...query
36
36
  };
37
- const samples = await flowrixApi.get(`samples`, apiConfig, { query });
37
+ const options = {
38
+ headers: {
39
+ "x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
40
+ },
41
+ query
42
+ };
43
+ const samples = await flowrixApi.get(`samples`, apiConfig, options);
38
44
  if (config.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
39
45
  await ensureCacheDir();
40
46
  await writeFile(filePath, JSON.stringify(samples, null, 2), "utf-8");
@@ -34,7 +34,13 @@ export default defineEventHandler(async (event) => {
34
34
  query = {
35
35
  ...query
36
36
  };
37
- const search = await flowrixApi.get(`search`, apiConfig, { query });
37
+ const options = {
38
+ headers: {
39
+ "x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
40
+ },
41
+ query
42
+ };
43
+ const search = await flowrixApi.get(`search`, apiConfig, options);
38
44
  if (config.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
39
45
  await ensureCacheDir();
40
46
  await writeFile(filePath, JSON.stringify(search, null, 2), "utf-8");
@@ -39,7 +39,12 @@ export default defineEventHandler(async (event) => {
39
39
  ...config,
40
40
  cookies: rawCookies
41
41
  };
42
- const service = await flowrixApi.get(`services/${slug}`, apiConfig, {});
42
+ const options = {
43
+ headers: {
44
+ "x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
45
+ }
46
+ };
47
+ const service = await flowrixApi.get(`services/${slug}`, apiConfig, options);
43
48
  if (config.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
44
49
  await ensureCacheDir();
45
50
  await writeFile(filePath, JSON.stringify(service, null, 2), "utf-8");
@@ -10,9 +10,13 @@ export default defineEventHandler(async (event) => {
10
10
  ...config,
11
11
  cookies: rawCookies
12
12
  };
13
- const response = await flowrixApi.post(`services/availability`, apiConfig, {
13
+ const options = {
14
+ headers: {
15
+ "x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
16
+ },
14
17
  body: JSON.stringify(body)
15
- });
18
+ };
19
+ const response = await flowrixApi.post(`services/availability`, apiConfig, options);
16
20
  return response;
17
21
  } catch (error) {
18
22
  return {
@@ -39,7 +39,12 @@ export default defineEventHandler(async (event) => {
39
39
  ...config,
40
40
  cookies: rawCookies
41
41
  };
42
- const service = await flowrixApi.get(`services`, apiConfig, {});
42
+ const options = {
43
+ headers: {
44
+ "x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
45
+ }
46
+ };
47
+ const service = await flowrixApi.get(`services`, apiConfig, options);
43
48
  if (config.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
44
49
  await ensureCacheDir();
45
50
  await writeFile(filePath, JSON.stringify(service, null, 2), "utf-8");
@@ -34,7 +34,13 @@ export default defineEventHandler(async (event) => {
34
34
  query = {
35
35
  ...query
36
36
  };
37
- const search = await flowrixApi.get(`search`, apiConfig, { query });
37
+ const options = {
38
+ headers: {
39
+ "x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
40
+ },
41
+ query
42
+ };
43
+ const search = await flowrixApi.get(`search`, apiConfig, options);
38
44
  if (config.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
39
45
  await ensureCacheDir();
40
46
  await writeFile(filePath, JSON.stringify(search, null, 2), "utf-8");
@@ -10,9 +10,13 @@ export default defineEventHandler(async (event) => {
10
10
  ...config,
11
11
  cookies: rawCookies
12
12
  };
13
- const subscribe = await flowrixApi.post(`subscribe`, apiConfig, {
13
+ const options = {
14
+ headers: {
15
+ "x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
16
+ },
14
17
  body: JSON.stringify(body)
15
- });
18
+ };
19
+ const subscribe = await flowrixApi.post(`subscribe`, apiConfig, options);
16
20
  return subscribe;
17
21
  } catch (error) {
18
22
  setResponseStatus(event, 500);
@@ -12,7 +12,12 @@ export default defineEventHandler(async (event) => {
12
12
  ...config,
13
13
  cookies: rawCookies
14
14
  };
15
- const page = await flowrixApi.get(`permalink/${slug}`, apiConfig);
15
+ const options = {
16
+ headers: {
17
+ "x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
18
+ }
19
+ };
20
+ const page = await flowrixApi.get(`permalink/${slug}`, apiConfig, options);
16
21
  console.log("config.FLOWRIX_CACHE", config);
17
22
  if (config.FLOWRIX_CACHE != "true" || config.public?.FLOWRIX_CACHE != "true") {
18
23
  const CACHE_DIR = join("/tmp", ".cache");
@@ -36,7 +36,12 @@ export default defineEventHandler(async (event) => {
36
36
  ...config,
37
37
  cookies: rawCookies
38
38
  };
39
- const webfrom = await flowrixApi.get(`contact-center/webforms/${slug}/details`, apiConfig, {});
39
+ const options = {
40
+ headers: {
41
+ "x-api-secret": apiConfig?.FLOWRIX_API_SECRET || ""
42
+ }
43
+ };
44
+ const webfrom = await flowrixApi.get(`contact-center/webforms/${slug}/details`, apiConfig, options);
40
45
  if (config.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
41
46
  await ensureCacheDir();
42
47
  await writeFile(filePath, JSON.stringify(webfrom, null, 2), "utf-8");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowrix",
3
- "version": "1.0.1-beta.105",
3
+ "version": "1.0.1-beta.107",
4
4
  "description": "Plug-and-play Nuxt eCommerce cart powered by FLOWRiX. Subscription required.",
5
5
  "license": "MIT",
6
6
  "type": "module",