flowrix 1.0.1-beta.155 → 1.0.1-beta.157

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 (226) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +23 -192
  3. package/dist/runtime/components/Types/page/index.d.vue.ts +5 -4
  4. package/dist/runtime/components/Types/page/index.vue +7 -11
  5. package/dist/runtime/components/Types/page/index.vue.d.ts +5 -4
  6. package/dist/runtime/composables/Blog/useBlogSingle.js +4 -5
  7. package/dist/runtime/composables/Category/useCategoryIndex.js +5 -5
  8. package/dist/runtime/composables/Checkout/useCheckout.d.ts +4 -0
  9. package/dist/runtime/composables/Checkout/useCheckout.js +15 -3
  10. package/dist/runtime/composables/Customer/useBillingAddress.d.ts +3 -0
  11. package/dist/runtime/composables/Customer/useBillingAddress.js +2 -0
  12. package/dist/runtime/composables/Customer/useShippingAddress.d.ts +3 -0
  13. package/dist/runtime/composables/Customer/useShippingAddress.js +2 -1
  14. package/dist/runtime/composables/Customer/useWishlists.d.ts +1 -1
  15. package/dist/runtime/composables/Product/CustomProduct/useCustomeScript.d.ts +4 -0
  16. package/dist/runtime/composables/Product/CustomProduct/useCustomeScript.js +5 -11
  17. package/dist/runtime/composables/Product/useProductCard.d.ts +90 -9
  18. package/dist/runtime/composables/Product/useProductCard.js +257 -55
  19. package/dist/runtime/composables/Product/useProductComponent.js +3 -10
  20. package/dist/runtime/composables/Product/useQuickView.d.ts +1 -1
  21. package/dist/runtime/composables/Product/useService.d.ts +1 -12
  22. package/dist/runtime/composables/Product/useService.js +2 -2
  23. package/dist/runtime/composables/index.d.ts +1 -1
  24. package/dist/runtime/composables/index.js +1 -1
  25. package/dist/runtime/composables/useAddresses.js +27 -6
  26. package/dist/runtime/composables/useApp.js +3 -4
  27. package/dist/runtime/composables/useCards.js +0 -1
  28. package/dist/runtime/composables/useClientApi.d.ts +8 -8
  29. package/dist/runtime/composables/useClientApi.js +74 -30
  30. package/dist/runtime/composables/useLocation.d.ts +3 -15
  31. package/dist/runtime/composables/useLocation.js +6 -27
  32. package/dist/runtime/composables/usePriceCalculation.d.ts +33 -0
  33. package/dist/runtime/composables/usePriceCalculation.js +107 -0
  34. package/dist/runtime/composables/useQuotationCheckout.d.ts +1 -1
  35. package/dist/runtime/middleware/flowrix.d.ts +5 -5
  36. package/dist/runtime/middleware/flowrix.js +2 -2
  37. package/dist/runtime/middleware/flowrixs3.d.ts +3 -0
  38. package/dist/runtime/middleware/flowrixs3.js +65 -0
  39. package/dist/runtime/pages/flowrix-default.vue +62 -15
  40. package/dist/runtime/plugins/full-reload.client.d.ts +2 -0
  41. package/dist/runtime/plugins/full-reload.client.js +28 -0
  42. package/dist/runtime/server/api/albums.d.ts +0 -1
  43. package/dist/runtime/server/api/albums.js +13 -40
  44. package/dist/runtime/server/api/auth/login.d.ts +0 -18
  45. package/dist/runtime/server/api/auth/login.js +0 -57
  46. package/dist/runtime/server/api/banners.d.ts +0 -1
  47. package/dist/runtime/server/api/banners.js +13 -40
  48. package/dist/runtime/server/api/brand/[...slug].d.ts +0 -1
  49. package/dist/runtime/server/api/brand/[...slug].js +14 -43
  50. package/dist/runtime/server/api/brand/index.d.ts +0 -1
  51. package/dist/runtime/server/api/brand/index.js +13 -39
  52. package/dist/runtime/server/api/cache/[...slug].delete.js +1 -2
  53. package/dist/runtime/server/api/cache/clean.get.js +1 -2
  54. package/dist/runtime/server/api/cart/[slug]/add.d.ts +0 -2
  55. package/dist/runtime/server/api/cart/[slug]/add.js +0 -21
  56. package/dist/runtime/server/api/cart/[slug]/update.d.ts +0 -2
  57. package/dist/runtime/server/api/cart/[slug]/update.js +0 -21
  58. package/dist/runtime/server/api/cart/related.d.ts +0 -2
  59. package/dist/runtime/server/api/cart/related.js +0 -34
  60. package/dist/runtime/server/api/cart/remove.d.ts +0 -2
  61. package/dist/runtime/server/api/cart/remove.js +0 -21
  62. package/dist/runtime/server/api/catalog/brands.d.ts +0 -1
  63. package/dist/runtime/server/api/catalog/brands.js +13 -45
  64. package/dist/runtime/server/api/catalog/categories.d.ts +0 -1
  65. package/dist/runtime/server/api/catalog/categories.js +13 -45
  66. package/dist/runtime/server/api/catalog/categoriesall.d.ts +0 -1
  67. package/dist/runtime/server/api/catalog/categoriesall.js +13 -45
  68. package/dist/runtime/server/api/catalog/featured.d.ts +0 -1
  69. package/dist/runtime/server/api/catalog/featured.js +13 -45
  70. package/dist/runtime/server/api/catalog/posts.d.ts +0 -1
  71. package/dist/runtime/server/api/catalog/posts.js +13 -45
  72. package/dist/runtime/server/api/catalog/samples.d.ts +0 -1
  73. package/dist/runtime/server/api/catalog/samples.js +13 -46
  74. package/dist/runtime/server/api/catalog/search.d.ts +0 -1
  75. package/dist/runtime/server/api/catalog/search.js +13 -46
  76. package/dist/runtime/server/api/category/[...slug].d.ts +1 -2
  77. package/dist/runtime/server/api/category/[...slug].js +34 -49
  78. package/dist/runtime/server/api/checkout/applyCoupon.d.ts +0 -2
  79. package/dist/runtime/server/api/checkout/applyCoupon.js +0 -20
  80. package/dist/runtime/server/api/checkout/configs.d.ts +0 -2
  81. package/dist/runtime/server/api/checkout/configs.js +0 -20
  82. package/dist/runtime/server/api/checkout/countries.d.ts +0 -2
  83. package/dist/runtime/server/api/checkout/countries.js +0 -13
  84. package/dist/runtime/server/api/checkout/paymentmethod.d.ts +0 -2
  85. package/dist/runtime/server/api/checkout/paymentmethod.js +0 -25
  86. package/dist/runtime/server/api/checkout/quotation/guest/customer.d.ts +0 -2
  87. package/dist/runtime/server/api/checkout/quotation/guest/customer.js +0 -20
  88. package/dist/runtime/server/api/checkvariables.js +1 -2
  89. package/dist/runtime/server/api/cmspost/[...slug].d.ts +0 -1
  90. package/dist/runtime/server/api/cmspost/[...slug].js +14 -44
  91. package/dist/runtime/server/api/cmspost/all.js +1 -2
  92. package/dist/runtime/server/api/company/profile.d.ts +1 -1
  93. package/dist/runtime/server/api/company/profile.js +13 -17
  94. package/dist/runtime/server/api/contact-center/webforms/[id]/details.d.ts +0 -3
  95. package/dist/runtime/server/api/contact-center/webforms/[id]/details.js +0 -54
  96. package/dist/runtime/server/api/countries.js +13 -38
  97. package/dist/runtime/server/api/customer/wishlist/deleteFromWishList.d.ts +0 -2
  98. package/dist/runtime/server/api/customer/wishlist/deleteFromWishList.js +0 -45
  99. package/dist/runtime/server/api/featured.d.ts +0 -3
  100. package/dist/runtime/server/api/featured.js +0 -52
  101. package/dist/runtime/server/api/generate/robots.get.js +0 -2
  102. package/dist/runtime/server/api/generate/sitemap.get.d.ts +1 -1
  103. package/dist/runtime/server/api/generate/sitemap.get.js +8 -12
  104. package/dist/runtime/server/api/global/[...slug].js +20 -0
  105. package/dist/runtime/server/api/location.d.ts +0 -2
  106. package/dist/runtime/server/api/location.js +0 -25
  107. package/dist/runtime/server/api/nav/[id]/links.d.ts +0 -1
  108. package/dist/runtime/server/api/nav/[id]/links.js +13 -43
  109. package/dist/runtime/server/api/page/[...slug].d.ts +0 -1
  110. package/dist/runtime/server/api/page/[...slug].js +14 -44
  111. package/dist/runtime/server/api/permalink/[...slug].get.js +31 -0
  112. package/dist/runtime/server/api/product/[...slug].d.ts +0 -1
  113. package/dist/runtime/server/api/product/[...slug].js +14 -49
  114. package/dist/runtime/server/api/quickview/[slug].d.ts +1 -1
  115. package/dist/runtime/server/api/quickview/[slug].js +15 -16
  116. package/dist/runtime/server/api/reviews.d.ts +1 -1
  117. package/dist/runtime/server/api/reviews.js +1 -2
  118. package/dist/runtime/server/api/reviews3.js +19 -0
  119. package/dist/runtime/server/api/samples.d.ts +0 -1
  120. package/dist/runtime/server/api/samples.js +13 -46
  121. package/dist/runtime/server/api/search.d.ts +0 -1
  122. package/dist/runtime/server/api/search.js +13 -46
  123. package/dist/runtime/server/api/service/[slug].d.ts +0 -1
  124. package/dist/runtime/server/api/service/[slug].js +13 -44
  125. package/dist/runtime/server/api/service/availability.d.ts +1 -1
  126. package/dist/runtime/server/api/service/getall.d.ts +0 -1
  127. package/dist/runtime/server/api/service/getall.js +13 -51
  128. package/dist/runtime/server/api/shop.d.ts +0 -1
  129. package/dist/runtime/server/api/shop.js +13 -46
  130. package/dist/runtime/server/api/subscribe.d.ts +0 -2
  131. package/dist/runtime/server/api/subscribe.js +0 -25
  132. package/dist/runtime/server/api/webform.d.ts +0 -3
  133. package/dist/runtime/server/api/webform.js +0 -54
  134. package/dist/runtime/server/middleware/powertools.d.ts +9 -0
  135. package/dist/runtime/server/middleware/powertools.js +30 -0
  136. package/dist/runtime/stores/Booking.js +23 -7
  137. package/dist/runtime/stores/Cart.js +18 -3
  138. package/dist/runtime/stores/Checkout.js +14 -3
  139. package/dist/runtime/stores/NavMenu.js +2 -4
  140. package/dist/runtime/stores/Search.js +9 -3
  141. package/dist/runtime/stores/auth.d.ts +28 -1
  142. package/dist/runtime/stores/auth.js +0 -5
  143. package/dist/runtime/stores/countries.js +1 -1
  144. package/dist/runtime/stores/index.d.ts +0 -1
  145. package/dist/runtime/stores/index.js +0 -1
  146. package/dist/runtime/stores/locations.d.ts +1 -5
  147. package/dist/runtime/stores/locations.js +8 -5
  148. package/dist/runtime/stores/product.js +9 -3
  149. package/dist/runtime/stores/promotions.d.ts +51 -0
  150. package/dist/runtime/stores/promotions.js +65 -0
  151. package/dist/runtime/stores/useCompanyProfile.js +5 -2
  152. package/dist/runtime/stores/wishlists.d.ts +1 -1
  153. package/dist/runtime/stores/wishlists.js +1 -1
  154. package/package.json +11 -3
  155. package/dist/runtime/composables/useLocations.d.ts +0 -12
  156. package/dist/runtime/composables/useLocations.js +0 -53
  157. package/dist/runtime/server/api/auth/forgot.d.ts +0 -5
  158. package/dist/runtime/server/api/auth/forgot.js +0 -43
  159. package/dist/runtime/server/api/auth/logout.d.ts +0 -5
  160. package/dist/runtime/server/api/auth/logout.js +0 -22
  161. package/dist/runtime/server/api/auth/register.js +0 -50
  162. package/dist/runtime/server/api/auth/session.get.js +0 -44
  163. package/dist/runtime/server/api/auth/user/reset-password.d.ts +0 -5
  164. package/dist/runtime/server/api/auth/user/reset-password.js +0 -39
  165. package/dist/runtime/server/api/auth/user/session.js +0 -42
  166. package/dist/runtime/server/api/auth/user/verify-token.d.ts +0 -6
  167. package/dist/runtime/server/api/auth/user/verify-token.js +0 -49
  168. package/dist/runtime/server/api/cart/service/[slug]/add.d.ts +0 -2
  169. package/dist/runtime/server/api/cart/service/[slug]/add.js +0 -16
  170. package/dist/runtime/server/api/check-404.d.ts +0 -4
  171. package/dist/runtime/server/api/check-404.js +0 -8
  172. package/dist/runtime/server/api/checkout/quotation/[slug].d.ts +0 -2
  173. package/dist/runtime/server/api/checkout/quotation/[slug].js +0 -20
  174. package/dist/runtime/server/api/checkout/quotation/guest/[slug].d.ts +0 -2
  175. package/dist/runtime/server/api/checkout/quotation/guest/[slug].js +0 -35
  176. package/dist/runtime/server/api/checkout/quotation/submit/[slug].d.ts +0 -2
  177. package/dist/runtime/server/api/checkout/quotation/submit/[slug].js +0 -22
  178. package/dist/runtime/server/api/contact-center/webforms/create.d.ts +0 -2
  179. package/dist/runtime/server/api/contact-center/webforms/create.js +0 -20
  180. package/dist/runtime/server/api/customer/address/add.d.ts +0 -14
  181. package/dist/runtime/server/api/customer/address/add.js +0 -32
  182. package/dist/runtime/server/api/customer/address/delete.d.ts +0 -20
  183. package/dist/runtime/server/api/customer/address/delete.js +0 -36
  184. package/dist/runtime/server/api/customer/address/setshipping.d.ts +0 -20
  185. package/dist/runtime/server/api/customer/address/setshipping.js +0 -40
  186. package/dist/runtime/server/api/customer/address/update.d.ts +0 -20
  187. package/dist/runtime/server/api/customer/address/update.js +0 -41
  188. package/dist/runtime/server/api/customer/cards/delete.d.ts +0 -2
  189. package/dist/runtime/server/api/customer/cards/delete.js +0 -22
  190. package/dist/runtime/server/api/customer/cards/get.d.ts +0 -2
  191. package/dist/runtime/server/api/customer/cards/get.js +0 -16
  192. package/dist/runtime/server/api/customer/change-password.d.ts +0 -14
  193. package/dist/runtime/server/api/customer/change-password.js +0 -33
  194. package/dist/runtime/server/api/customer/checkout.d.ts +0 -2
  195. package/dist/runtime/server/api/customer/checkout.js +0 -19
  196. package/dist/runtime/server/api/customer/orders.d.ts +0 -2
  197. package/dist/runtime/server/api/customer/orders.js +0 -16
  198. package/dist/runtime/server/api/customer/profile/update.d.ts +0 -14
  199. package/dist/runtime/server/api/customer/profile/update.js +0 -33
  200. package/dist/runtime/server/api/customer/quotations.d.ts +0 -2
  201. package/dist/runtime/server/api/customer/quotations.js +0 -16
  202. package/dist/runtime/server/api/customer/search.d.ts +0 -2
  203. package/dist/runtime/server/api/customer/search.js +0 -14
  204. package/dist/runtime/server/api/customer/tax-invoice.d.ts +0 -8
  205. package/dist/runtime/server/api/customer/tax-invoice.js +0 -35
  206. package/dist/runtime/server/api/customer/wishlist/add.d.ts +0 -2
  207. package/dist/runtime/server/api/customer/wishlist/add.js +0 -29
  208. package/dist/runtime/server/api/customer/wishlist/createWishList.d.ts +0 -2
  209. package/dist/runtime/server/api/customer/wishlist/createWishList.js +0 -28
  210. package/dist/runtime/server/api/customer/wishlist/deleteWishList.d.ts +0 -2
  211. package/dist/runtime/server/api/customer/wishlist/deleteWishList.js +0 -29
  212. package/dist/runtime/server/api/customer/wishlist/get.d.ts +0 -2
  213. package/dist/runtime/server/api/customer/wishlist/get.js +0 -16
  214. package/dist/runtime/server/api/customer/wishlist/getWishListItems.d.ts +0 -2
  215. package/dist/runtime/server/api/customer/wishlist/getWishListItems.js +0 -20
  216. package/dist/runtime/server/api/customer/wishlist/updateWishList.d.ts +0 -2
  217. package/dist/runtime/server/api/customer/wishlist/updateWishList.js +0 -29
  218. package/dist/runtime/server/api/v2/[...slug].get.d.ts +0 -2
  219. package/dist/runtime/server/api/v2/[...slug].get.js +0 -34
  220. package/dist/runtime/stores/IpLocation.d.ts +0 -109
  221. package/dist/runtime/stores/IpLocation.js +0 -107
  222. package/dist/runtime/utils/api.d.ts +0 -13
  223. package/dist/runtime/utils/api.js +0 -96
  224. /package/dist/runtime/server/api/{auth/register.d.ts → global/[...slug].d.ts} +0 -0
  225. /package/dist/runtime/server/api/{auth/session.get.d.ts → permalink/[...slug].get.d.ts} +0 -0
  226. /package/dist/runtime/server/api/{auth/user/session.d.ts → reviews3.d.ts} +0 -0
@@ -1,54 +0,0 @@
1
- import { defineEventHandler, getRouterParam, getQuery, createError, readBody, getCookie, setResponseStatus } from "h3";
2
- import { writeFile, mkdir, readFile } from "fs/promises";
3
- import { join } from "path";
4
- import { useRuntimeConfig } from "#imports";
5
- import { flowrixApi } from "../../middleware/flowrix.js";
6
- const CACHE_DIR = join("/tmp", ".cache", "nitro", "webfroms");
7
- export const webfromCache = /* @__PURE__ */ new Map();
8
- async function ensureCacheDir() {
9
- try {
10
- await mkdir(CACHE_DIR, { recursive: true });
11
- } catch (error) {
12
- console.error("Error creating cache directory:", error);
13
- }
14
- }
15
- export default defineEventHandler(async (event) => {
16
- const slug = getRouterParam(event, "id");
17
- const customerType = getCookie(event, "customertype") || "";
18
- let query = getQuery(event);
19
- const body = await readBody(event);
20
- if (!slug) {
21
- throw createError({ statusCode: 400, statusMessage: "Missing slug parameter" });
22
- }
23
- const cacheKey = `${slug}-${JSON.stringify(query)}`;
24
- const fileName = cacheKey.replace(/[^a-zA-Z0-9-_]/g, "_");
25
- const filePath = join(CACHE_DIR, `${fileName}-${customerType}.json`);
26
- try {
27
- const fileContent = await readFile(filePath, "utf-8");
28
- const webfrom = JSON.parse(fileContent);
29
- return webfrom;
30
- } catch (error) {
31
- }
32
- try {
33
- const config = useRuntimeConfig();
34
- const rawCookies = event.req.headers.cookie || "";
35
- const apiConfig = {
36
- ...config,
37
- cookies: rawCookies
38
- };
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);
45
- if (config.FLOWRIX_CACHE == "true" || config.public.FLOWRIX_CACHE == "true") {
46
- await ensureCacheDir();
47
- await writeFile(filePath, JSON.stringify(webfrom, null, 2), "utf-8");
48
- }
49
- return webfrom;
50
- } catch (error) {
51
- setResponseStatus(event, 500);
52
- return { success: false, error: error.message };
53
- }
54
- });
@@ -0,0 +1,9 @@
1
+ import { Logger } from '@aws-lambda-powertools/logger';
2
+ import { Metrics } from '@aws-lambda-powertools/metrics';
3
+ import { Tracer } from '@aws-lambda-powertools/tracer';
4
+ declare const logger: Logger;
5
+ declare const metrics: Metrics;
6
+ declare const tracer: Tracer;
7
+ export { logger, metrics, tracer };
8
+ declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, void>;
9
+ export default _default;
@@ -0,0 +1,30 @@
1
+ import { defineEventHandler } from "h3";
2
+ import { Logger } from "@aws-lambda-powertools/logger";
3
+ import { Metrics, MetricUnit } from "@aws-lambda-powertools/metrics";
4
+ import { Tracer } from "@aws-lambda-powertools/tracer";
5
+ const isLambda = !!process.env.AWS_LAMBDA_FUNCTION_NAME;
6
+ const logger = new Logger({
7
+ serviceName: process.env.POWERTOOLS_SERVICE_NAME || "flowrix",
8
+ logLevel: process.env.LOG_LEVEL || "INFO"
9
+ });
10
+ const metrics = new Metrics({
11
+ namespace: process.env.POWERTOOLS_METRICS_NAMESPACE || "Flowrix",
12
+ serviceName: process.env.POWERTOOLS_SERVICE_NAME || "flowrix"
13
+ });
14
+ const tracer = new Tracer({
15
+ serviceName: process.env.POWERTOOLS_SERVICE_NAME || "flowrix"
16
+ });
17
+ export { logger, metrics, tracer };
18
+ export default defineEventHandler((event) => {
19
+ event.context.logger = logger;
20
+ event.context.metrics = metrics;
21
+ event.context.tracer = tracer;
22
+ const method = event.method;
23
+ const path = event.path;
24
+ logger.info("Incoming request", { method, path });
25
+ if (isLambda) {
26
+ metrics.addMetric("RequestCount", MetricUnit.Count, 1);
27
+ metrics.addDimension("path", path);
28
+ metrics.publishStoredMetrics();
29
+ }
30
+ });
@@ -1,5 +1,6 @@
1
1
  import { defineStore } from "pinia";
2
- import { useApi } from "../utils/api.js";
2
+ import { flowrixApi } from "../middleware/flowrix.js";
3
+ import { useRuntimeConfig } from "#imports";
3
4
  export const useBookingStore = defineStore("booking", {
4
5
  state: () => ({
5
6
  calendar: [],
@@ -13,12 +14,17 @@ export const useBookingStore = defineStore("booking", {
13
14
  async getCalendar(calendarId = 4) {
14
15
  try {
15
16
  this.isLoading = true;
16
- const { get } = useApi();
17
+ const config = useRuntimeConfig();
18
+ let rawCookies = "";
19
+ if (process.client) {
20
+ rawCookies = document.cookie || "";
21
+ }
22
+ const apiConfig = { ...config, cookies: rawCookies };
17
23
  const apiUrl = "services/calendar";
18
24
  const params = {
19
25
  calendar: calendarId
20
26
  };
21
- const response = await get(apiUrl, { params });
27
+ const response = await flowrixApi.get(apiUrl, apiConfig, { params });
22
28
  if (response) {
23
29
  this.calendar = response.data || response;
24
30
  }
@@ -33,13 +39,18 @@ export const useBookingStore = defineStore("booking", {
33
39
  try {
34
40
  this.isLoading = true;
35
41
  this.selectedDate = bookingDate;
36
- const { get } = useApi();
42
+ const config = useRuntimeConfig();
43
+ let rawCookies = "";
44
+ if (process.client) {
45
+ rawCookies = document.cookie || "";
46
+ }
47
+ const apiConfig = { ...config, cookies: rawCookies };
37
48
  const apiUrl = "services/gettimeslots";
38
49
  const params = {
39
50
  calendar: calendarId,
40
51
  booking_date: bookingDate
41
52
  };
42
- const response = await get(apiUrl, { params });
53
+ const response = await flowrixApi.get(apiUrl, apiConfig, { params });
43
54
  if (response) {
44
55
  this.timeSlots = response.data || response;
45
56
  }
@@ -53,9 +64,14 @@ export const useBookingStore = defineStore("booking", {
53
64
  async saveBookingSlot(bookingData) {
54
65
  try {
55
66
  this.isLoading = true;
56
- const { post } = useApi();
67
+ const config = useRuntimeConfig();
68
+ let rawCookies = "";
69
+ if (process.client) {
70
+ rawCookies = document.cookie || "";
71
+ }
72
+ const apiConfig = { ...config, cookies: rawCookies };
57
73
  const apiUrl = "services/calendar/save";
58
- const response = await post(apiUrl, bookingData);
74
+ const response = await flowrixApi.post(apiUrl, apiConfig, { body: bookingData });
59
75
  if (response) {
60
76
  this.responseData = response;
61
77
  return response;
@@ -68,9 +68,14 @@ export const useCartStore = defineStore("cart", {
68
68
  }
69
69
  try {
70
70
  const config = useRuntimeConfig();
71
+ const rawCookies = document.cookie;
72
+ const apiConfig = {
73
+ ...config,
74
+ cookies: rawCookies
75
+ };
71
76
  const response = await flowrixApi.post(
72
77
  apiUrl,
73
- config,
78
+ apiConfig,
74
79
  {
75
80
  body: formData
76
81
  }
@@ -183,7 +188,12 @@ export const useCartStore = defineStore("cart", {
183
188
  request.vouchercodes = this.coupon;
184
189
  }
185
190
  const config = useRuntimeConfig();
186
- const response = await flowrixApi.post(apiUrl, config, {
191
+ const rawCookies = document.cookie;
192
+ const apiConfig = {
193
+ ...config,
194
+ cookies: rawCookies
195
+ };
196
+ const response = await flowrixApi.post(apiUrl, apiConfig, {
187
197
  body: request
188
198
  });
189
199
  if (response?.status == "Success") {
@@ -233,7 +243,12 @@ export const useCartStore = defineStore("cart", {
233
243
  abndToken: this.cart.abndToken
234
244
  };
235
245
  const config = useRuntimeConfig();
236
- const response = await flowrixApi.post(apiUrl, config, {
246
+ const rawCookies = document.cookie;
247
+ const apiConfig = {
248
+ ...config,
249
+ cookies: rawCookies
250
+ };
251
+ const response = await flowrixApi.post(apiUrl, apiConfig, {
237
252
  body: couponData
238
253
  });
239
254
  if (response?.status === "Success" && response?.data?.calculations) {
@@ -38,7 +38,7 @@ export const useCheckoutStore = defineStore("checkout", {
38
38
  ...config,
39
39
  cookies: rawCookies
40
40
  };
41
- const response = await flowrixApi.post(apiUrl, config, { body: formData });
41
+ const response = await flowrixApi.post(apiUrl, apiConfig, { body: formData });
42
42
  if (response?.data) {
43
43
  this.publishableKey = response.data;
44
44
  const cart = {
@@ -144,10 +144,16 @@ export const useCheckoutStore = defineStore("checkout", {
144
144
  const formData = this.checkoutSession.fields || {};
145
145
  const apiUrl = `customer/checkout`;
146
146
  formData.billing_address2 = formData.billing_address;
147
+ formData.shipping_address2 = formData.shipping_address;
147
148
  delete formData.fields;
148
149
  delete formData.calculations;
149
150
  const config = useRuntimeConfig();
150
- const response = await flowrixApi.post(apiUrl, config, { body: formData });
151
+ const rawCookies = document.cookie;
152
+ const apiConfig = {
153
+ ...config,
154
+ cookies: rawCookies
155
+ };
156
+ const response = await flowrixApi.post(apiUrl, apiConfig, { body: formData });
151
157
  if (response?.data?.order || response?.data?.order_no) {
152
158
  const orderData = response.data.order || response.data;
153
159
  const invoiceId = orderData.order_no;
@@ -179,7 +185,12 @@ export const useCheckoutStore = defineStore("checkout", {
179
185
  this.loading = true;
180
186
  const apiUrl = `customers/search`;
181
187
  const config = useRuntimeConfig();
182
- const response = await flowrixApi.post(apiUrl, config, { body: { email } });
188
+ const rawCookies = document.cookie;
189
+ const apiConfig = {
190
+ ...config,
191
+ cookies: rawCookies
192
+ };
193
+ const response = await flowrixApi.post(apiUrl, apiConfig, { body: { email } });
183
194
  this.checkCustomer = response;
184
195
  this.loading = false;
185
196
  return response;
@@ -8,15 +8,13 @@ export const useNavMenu = defineStore("NavMenu", {
8
8
  try {
9
9
  const existingMenu = this.Menu.find((menu) => menu.location === location);
10
10
  if (!existingMenu) {
11
- const response = await $fetch(`/api/nav/${id}/links`, {
11
+ const response = await $fetch(`/api/global/nav_${id}_links`, {
12
12
  method: "GET",
13
13
  headers: {
14
14
  "Content-Type": "application/json"
15
15
  }
16
16
  });
17
- if (response.status === "Success") {
18
- this.Menu.push({ location, items: response.data });
19
- }
17
+ this.Menu.push({ location, items: response.data });
20
18
  }
21
19
  } catch (error) {
22
20
  console.error("Error fetching data:", error);
@@ -1,4 +1,5 @@
1
- import { useApi } from "../utils/api.js";
1
+ import { flowrixApi } from "../middleware/flowrix.js";
2
+ import { useRuntimeConfig } from "#imports";
2
3
  import { defineStore } from "pinia";
3
4
  export const useSearchStore = defineStore("SearchStore", {
4
5
  state: () => ({
@@ -6,7 +7,12 @@ export const useSearchStore = defineStore("SearchStore", {
6
7
  }),
7
8
  actions: {
8
9
  async fetchSearchData(query) {
9
- const { get } = useApi();
10
+ const config = useRuntimeConfig();
11
+ let rawCookies = "";
12
+ if (process.client) {
13
+ rawCookies = document.cookie || "";
14
+ }
15
+ const apiConfig = { ...config, cookies: rawCookies };
10
16
  try {
11
17
  this.data = [];
12
18
  const params = new URLSearchParams();
@@ -15,7 +21,7 @@ export const useSearchStore = defineStore("SearchStore", {
15
21
  params.append("ProductType[]", "simple");
16
22
  params.append("ProductType[]", "bundle");
17
23
  const apiUrl = `search?${params.toString()}`;
18
- const response = await get(apiUrl);
24
+ const response = await flowrixApi.get(apiUrl, apiConfig);
19
25
  if (response?.status === "Success" && Array.isArray(response.data.products.data)) {
20
26
  this.data = response.data.products.data;
21
27
  return this.data;
@@ -56,4 +56,31 @@ export declare const useAuthStore: import("pinia").StoreDefinition<"auth", AuthS
56
56
  getToken: (state: AuthState) => string | null;
57
57
  isLoggedIn: (state: AuthState) => boolean;
58
58
  isHydrated: (state: AuthState) => boolean;
59
- }, {}>;
59
+ }, {
60
+ userLogin(userFields: any): Promise<any>;
61
+ signUp(userFields: any): Promise<any>;
62
+ fetchProfile(): Promise<User | null>;
63
+ updateProfile(userData: any): Promise<{
64
+ status: string;
65
+ message: string;
66
+ }>;
67
+ fetchUserCards(): Promise<User | null>;
68
+ changePassword(userData: any): Promise<any>;
69
+ deleteCard(cardId: string): Promise<{
70
+ status: string;
71
+ message: string;
72
+ }>;
73
+ fetchOrders(): Promise<User | null>;
74
+ downloadInvoice(orderNo: string): Promise<void>;
75
+ fetchQuotations(): Promise<User | null>;
76
+ setAddress(addressData: any, method?: string): Promise<{
77
+ status: string;
78
+ message: string;
79
+ }>;
80
+ verifyEmail(email: string): Promise<AuthResponse>;
81
+ verifyToken(email: string, token: string): Promise<AuthResponse>;
82
+ resetPassword(token: string, password: string, password_confirmation: string): Promise<AuthResponse>;
83
+ loadAuth(): void;
84
+ logout(): void;
85
+ setHydrated(): void;
86
+ }>;
@@ -427,10 +427,5 @@ export const useAuthStore = defineStore("auth", {
427
427
  getToken: (state) => state.token,
428
428
  isLoggedIn: (state) => state.isAuthenticated,
429
429
  isHydrated: (state) => state._hydrated
430
- },
431
- persist: {
432
- enabled: true,
433
- key: "user",
434
- storage: typeof window !== "undefined" ? localStorage : void 0
435
430
  }
436
431
  });
@@ -7,7 +7,7 @@ export const useCountriesStore = defineStore("countries", {
7
7
  }),
8
8
  actions: {
9
9
  async getCountries() {
10
- const response = await $fetch("/api/countries");
10
+ const response = await $fetch("/api/global/countries");
11
11
  this.countries = response;
12
12
  return response;
13
13
  }
@@ -9,7 +9,6 @@ export * from './Categories.js';
9
9
  export * from './Checkout.js';
10
10
  export * from './compareStore.js';
11
11
  export * from './countries.js';
12
- export * from './IpLocation.js';
13
12
  export * from './locations.js';
14
13
  export * from './NavMenu.js';
15
14
  export * from './orders.js';
@@ -7,7 +7,6 @@ export * from "./Categories.js";
7
7
  export * from "./Checkout.js";
8
8
  export * from "./compareStore.js";
9
9
  export * from "./countries.js";
10
- export * from "./IpLocation.js";
11
10
  export * from "./locations.js";
12
11
  export * from "./NavMenu.js";
13
12
  export * from "./orders.js";
@@ -4,8 +4,4 @@ export declare const useLocationsStore: import("pinia").StoreDefinition<"locatio
4
4
  location: LocationData | null;
5
5
  loading: boolean;
6
6
  error: string | null;
7
- }, {}, {
8
- setLocation(location: LocationData | null): void;
9
- setLoading(loading: boolean): void;
10
- setError(error: string | null): void;
11
- }>;
7
+ }, {}, {}>;
@@ -9,11 +9,14 @@ export const useLocationsStore = defineStore("locations", {
9
9
  setLocation(location) {
10
10
  this.location = location;
11
11
  },
12
- setLoading(loading) {
13
- this.loading = loading;
14
- },
15
- setError(error) {
16
- this.error = error;
12
+ getLocation(location) {
13
+ return this.location;
17
14
  }
15
+ },
16
+ persist: {
17
+ enabled: true,
18
+ // simple shape that works with most versions:
19
+ key: "location",
20
+ storage: typeof window !== "undefined" ? localStorage : void 0
18
21
  }
19
22
  });
@@ -1,12 +1,18 @@
1
1
  import { defineStore } from "pinia";
2
- import { useApi } from "../utils/api.js";
2
+ import { flowrixApi } from "../middleware/flowrix.js";
3
+ import { useRuntimeConfig } from "#imports";
3
4
  export const useProduct = defineStore("Product", {
4
5
  state: () => ({
5
6
  data: {}
6
7
  }),
7
8
  actions: {
8
9
  async getProduct(slug, queryperameters = "") {
9
- const { post } = useApi();
10
+ const config = useRuntimeConfig();
11
+ let rawCookies = "";
12
+ if (process.client) {
13
+ rawCookies = document.cookie || "";
14
+ }
15
+ const apiConfig = { ...config, cookies: rawCookies };
10
16
  try {
11
17
  let attributes = {};
12
18
  if (queryperameters.customize) {
@@ -24,7 +30,7 @@ export const useProduct = defineStore("Product", {
24
30
  attributes["fraction"] = fractions;
25
31
  }
26
32
  const apiUrl = `product/${slug}`;
27
- const response = await post(apiUrl, attributes);
33
+ const response = await flowrixApi.post(apiUrl, apiConfig, { body: attributes });
28
34
  if (response.status === 200) {
29
35
  this.data = response.data.data;
30
36
  }
@@ -0,0 +1,51 @@
1
+ export interface PromotionsState {
2
+ promotions: any;
3
+ loading: boolean;
4
+ error: string | null;
5
+ fetchPromise: Promise<void> | null;
6
+ }
7
+ export interface ApiResponse {
8
+ status?: string;
9
+ data?: any;
10
+ [key: string]: any;
11
+ }
12
+ export declare const usePromotions: import("pinia").StoreDefinition<"promotions", PromotionsState, {
13
+ hasPromotions: (state: {
14
+ promotions: any;
15
+ loading: boolean;
16
+ error: string | null;
17
+ fetchPromise: {
18
+ then: <TResult1 = void, TResult2 = never>(onfulfilled?: ((value: void) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined) => Promise<TResult1 | TResult2>;
19
+ catch: <TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null | undefined) => Promise<void | TResult>;
20
+ finally: (onfinally?: (() => void) | null | undefined) => Promise<void>;
21
+ readonly [Symbol.toStringTag]: string;
22
+ } | null;
23
+ } & import("pinia").PiniaCustomStateProperties<PromotionsState>) => boolean;
24
+ isLoading: (state: {
25
+ promotions: any;
26
+ loading: boolean;
27
+ error: string | null;
28
+ fetchPromise: {
29
+ then: <TResult1 = void, TResult2 = never>(onfulfilled?: ((value: void) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined) => Promise<TResult1 | TResult2>;
30
+ catch: <TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null | undefined) => Promise<void | TResult>;
31
+ finally: (onfinally?: (() => void) | null | undefined) => Promise<void>;
32
+ readonly [Symbol.toStringTag]: string;
33
+ } | null;
34
+ } & import("pinia").PiniaCustomStateProperties<PromotionsState>) => boolean;
35
+ hasError: (state: {
36
+ promotions: any;
37
+ loading: boolean;
38
+ error: string | null;
39
+ fetchPromise: {
40
+ then: <TResult1 = void, TResult2 = never>(onfulfilled?: ((value: void) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined) => Promise<TResult1 | TResult2>;
41
+ catch: <TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null | undefined) => Promise<void | TResult>;
42
+ finally: (onfinally?: (() => void) | null | undefined) => Promise<void>;
43
+ readonly [Symbol.toStringTag]: string;
44
+ } | null;
45
+ } & import("pinia").PiniaCustomStateProperties<PromotionsState>) => boolean;
46
+ }, {
47
+ fetchPromotions(force?: boolean): Promise<any>;
48
+ _doFetch(): Promise<void>;
49
+ refreshPromotions(): Promise<any>;
50
+ clearPromotions(): void;
51
+ }>;
@@ -0,0 +1,65 @@
1
+ import { defineStore } from "pinia";
2
+ export const usePromotions = defineStore("promotions", {
3
+ state: () => ({
4
+ promotions: null,
5
+ loading: false,
6
+ error: null,
7
+ fetchPromise: null
8
+ }),
9
+ getters: {
10
+ hasPromotions: (state) => state.promotions !== null,
11
+ isLoading: (state) => state.loading,
12
+ hasError: (state) => state.error !== null
13
+ },
14
+ actions: {
15
+ async fetchPromotions(force = false) {
16
+ if (this.promotions && !force) {
17
+ return;
18
+ }
19
+ if (this.fetchPromise) {
20
+ return this.fetchPromise;
21
+ }
22
+ this.fetchPromise = this._doFetch();
23
+ try {
24
+ await this.fetchPromise;
25
+ } finally {
26
+ this.fetchPromise = null;
27
+ }
28
+ },
29
+ async _doFetch() {
30
+ this.loading = true;
31
+ this.error = null;
32
+ try {
33
+ const response = await $fetch("/api/global/promotions");
34
+ if (response.status === "Success" && response.data) {
35
+ this.promotions = response.data.data;
36
+ } else {
37
+ this.promotions = response.data;
38
+ this.error = null;
39
+ }
40
+ } catch (error) {
41
+ if (error.response) {
42
+ this.error = error.response.data.message || "An error occurred";
43
+ console.error(error.response);
44
+ } else {
45
+ this.error = "An error occurred";
46
+ console.error(error);
47
+ }
48
+ this.promotions = null;
49
+ } finally {
50
+ this.loading = false;
51
+ }
52
+ },
53
+ // Force refresh promotions (bypass cache)
54
+ async refreshPromotions() {
55
+ this.fetchPromise = null;
56
+ return this.fetchPromotions(true);
57
+ },
58
+ // Clear promotions cache
59
+ clearPromotions() {
60
+ this.promotions = null;
61
+ this.error = null;
62
+ this.fetchPromise = null;
63
+ }
64
+ }
65
+ });
@@ -10,10 +10,13 @@ export const useCompanyProfile = defineStore("company", {
10
10
  this.loading = true;
11
11
  this.error = null;
12
12
  try {
13
- const data = await $fetch("/api/company/profile");
13
+ const data = await $fetch("/api/global/company_profile");
14
14
  this.profile = data;
15
15
  } catch (err) {
16
- this.error = err;
16
+ this.error = {
17
+ message: err?.message,
18
+ statusCode: err?.statusCode
19
+ };
17
20
  } finally {
18
21
  this.loading = false;
19
22
  }
@@ -139,7 +139,7 @@ export declare const useWishlistsStore: import("pinia").StoreDefinition<"wishlis
139
139
  }>>;
140
140
  createWishlist(data: CreateWishlistData): Promise<ApiResponse<Wishlist>>;
141
141
  addToWishlist(listId: number, productSlug: string, data?: AddToWishlistData): Promise<ApiResponse<WishlistProduct>>;
142
- removeFromWishlist(listId: number, itemId: string): Promise<ApiResponse<void>>;
142
+ removeFromWishlist(listId: number, itemId: number): Promise<ApiResponse<void>>;
143
143
  updateWishlist(id: number, data: UpdateWishlistData): Promise<ApiResponse<Wishlist>>;
144
144
  deleteWishlist(id: number): Promise<ApiResponse<void>>;
145
145
  }>;
@@ -162,7 +162,7 @@ export const useWishlistsStore = defineStore("wishlists", {
162
162
  };
163
163
  const apiUrl = `mystore/customer/wishlist/${listId}/item/delete`;
164
164
  const response = await flowrixApi.post(apiUrl, apiConfig, {
165
- body: { ids: { productSlug: itemId } }
165
+ body: { ids: [itemId] }
166
166
  });
167
167
  console.log("[Store] Remove API response:", response.status);
168
168
  if (response.status === "Success") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowrix",
3
- "version": "1.0.1-beta.155",
3
+ "version": "1.0.1-beta.157",
4
4
  "description": "Plug-and-play Nuxt eCommerce cart powered by FLOWRiX. Subscription required.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -40,16 +40,24 @@
40
40
  "test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
41
41
  },
42
42
  "dependencies": {
43
+ "@aws-lambda-powertools/logger": "^2.32.0",
44
+ "@aws-lambda-powertools/metrics": "^2.32.0",
45
+ "@aws-lambda-powertools/tracer": "^2.32.0",
46
+ "@aws-sdk/client-s3": "^3.1016.0",
43
47
  "@nuxt/kit": "4.2.0",
44
48
  "@pinia/nuxt": "0.7.0",
45
49
  "@stripe/stripe-js": "8.2.0",
50
+ "@vueform/slider": "^2.1.10",
46
51
  "@vueuse/nuxt": "14.0.0",
47
52
  "bootstrap": "^5.3.8",
48
53
  "defu": "^6.1.4",
54
+ "htmlparser2": "^12.0.0",
55
+ "izitoast": "^1.4.0",
49
56
  "nuxt-swiper": "2.0.1",
50
57
  "nuxt-toast": "1.4.0",
51
- "pinia": "2.3.1",
52
- "pinia-plugin-persistedstate": "3.2.3"
58
+ "pinia": "^3.0.3",
59
+ "pinia-plugin-persistedstate": "4.5.0",
60
+ "tslib": "^2.8.1"
53
61
  },
54
62
  "devDependencies": {
55
63
  "@nuxt/devtools": "2.6.5",
@@ -1,12 +0,0 @@
1
- import { type LocationData } from '../stores/locations.js';
2
- export interface ApiResponse<T> {
3
- status: string;
4
- message: string | Record<string, string[]> | null;
5
- data: T | null;
6
- }
7
- export declare function useLocations(): {
8
- fetchLocation: () => Promise<ApiResponse<LocationData>>;
9
- location: import("vue").ComputedRef<LocationData | null>;
10
- loading: import("vue").ComputedRef<boolean>;
11
- error: import("vue").ComputedRef<string | null>;
12
- };