flowrix 1.0.1-beta.53 → 1.0.1-beta.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "flowrix",
3
3
  "configKey": "flowrix",
4
- "version": "1.0.1-beta.53",
4
+ "version": "1.0.1-beta.54",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { defineNuxtModule, createResolver, installModule, addServerHandler, addImportsDir, addPlugin, addImports } from '@nuxt/kit';
2
2
 
3
- const module = defineNuxtModule({
3
+ const module$1 = defineNuxtModule({
4
4
  meta: {
5
5
  name: "flowrix",
6
6
  configKey: "flowrix"
@@ -122,6 +122,10 @@ const module = defineNuxtModule({
122
122
  route: "/api/catalog/categories",
123
123
  handler: resolver.resolve("./runtime/server/api/catalog/categories")
124
124
  });
125
+ addServerHandler({
126
+ route: "/api/catalog/categories/all",
127
+ handler: resolver.resolve("./runtime/server/api/catalog/categoriesall")
128
+ });
125
129
  addServerHandler({
126
130
  route: "/api/catalog/featured",
127
131
  handler: resolver.resolve("./runtime/server/api/catalog/featured")
@@ -301,4 +305,4 @@ const module = defineNuxtModule({
301
305
  }
302
306
  });
303
307
 
304
- export { module as default };
308
+ export { module$1 as default };
@@ -15,7 +15,7 @@ export default function() {
15
15
  } = useAuth();
16
16
  const { profile } = useCompanyProfile();
17
17
  const cartStore = useCartStore();
18
- const companyCountryId = computed(() => profile?.value?.country_id || 235);
18
+ const companyCountryId = computed(() => profile?.data.country_id || "");
19
19
  const checkoutStore = useCheckoutStore();
20
20
  const AuthStore = ref();
21
21
  const shippingFormEnabled = ref(true);
@@ -1,4 +1,4 @@
1
- export default function (): {
1
+ export default function (inputData: any): {
2
2
  checkoutStore: import("pinia").Store<"checkout", import("../../stores/Checkout.js").CheckoutState, {}, {
3
3
  resetState(): void;
4
4
  paymentMethods(formData: any): Promise<any>;
@@ -1,7 +1,7 @@
1
1
  import { ref } from "vue";
2
2
  import { useCheckoutStore } from "../../stores/Checkout.js";
3
3
  import { usePasswordFormatter } from "../Extras/usePasswordFormatter.js";
4
- export default function() {
4
+ export default function(inputData) {
5
5
  const checkoutStore = useCheckoutStore();
6
6
  const passwordShow = ref("password");
7
7
  const password = ref("");
@@ -1,4 +1,4 @@
1
- export default function (): {
1
+ export default function (inputData: any): {
2
2
  checkoutStore: import("pinia").Store<"checkout", import("../../stores/Checkout.js").CheckoutState, {}, {
3
3
  resetState(): void;
4
4
  paymentMethods(formData: any): Promise<any>;
@@ -1,13 +1,13 @@
1
1
  import { useCheckoutStore } from "../../stores/Checkout.js";
2
2
  import useStripe from "./PaymentMethods/useStripe.js";
3
- export default function() {
3
+ export default function(inputData) {
4
4
  const checkoutStore = useCheckoutStore();
5
- const updateDeliveryMethod = (async (inputData) => {
6
- await checkoutStore.saveToCheckoutSession(inputData);
5
+ const updateDeliveryMethod = (async (inputData2) => {
6
+ await checkoutStore.saveToCheckoutSession(inputData2);
7
7
  const { getpaymentMethod } = useStripe();
8
8
  const totalPrice = checkoutStore.config ? checkoutStore.config.calculations.total : checkoutStore.config.total;
9
- if (inputData.paymentmethod && inputData.paymentmethod == "web-stripe") {
10
- getpaymentMethod("web-stripe", inputData, totalPrice);
9
+ if (inputData2.paymentmethod && inputData2.paymentmethod == "web-stripe") {
10
+ getpaymentMethod("web-stripe", inputData2, totalPrice);
11
11
  }
12
12
  const cart = [];
13
13
  cart.items = checkoutStore.config.cart;
@@ -26,7 +26,7 @@ export function useAddresses() {
26
26
  store.setError(null);
27
27
  try {
28
28
  userData.shipping = 1;
29
- const response = await post("/customer/address/add", userData);
29
+ const response = await post("/mystore/customer/address/add", userData);
30
30
  if (response.status === "Success" && response.data) {
31
31
  await fetchProfile();
32
32
  return response;
@@ -48,7 +48,7 @@ export function useAddresses() {
48
48
  store.setLoading(true);
49
49
  store.setError(null);
50
50
  try {
51
- const response = await patch(`/customer/address/${userData.id}/update`, userData);
51
+ const response = await patch(`/mystore/customer/address/${userData.id}/update`, userData);
52
52
  if (response.status === "Success" && response.data) {
53
53
  await fetchProfile();
54
54
  return response;
@@ -70,7 +70,7 @@ export function useAddresses() {
70
70
  store.setLoading(true);
71
71
  store.setError(null);
72
72
  try {
73
- const response = await patch(`/customer/address/${id}/delete`, {});
73
+ const response = await patch(`/mystore/customer/address/${id}/delete`, {});
74
74
  if (response.status === "Success") {
75
75
  await fetchProfile();
76
76
  return response;
@@ -92,7 +92,7 @@ export function useAddresses() {
92
92
  store.setLoading(true);
93
93
  store.setError(null);
94
94
  try {
95
- const response = await post(`/customer/address/${addressId}/setshipping`, {});
95
+ const response = await post(`/mystore/customer/address/${addressId}/setshipping`, {});
96
96
  if (response.status === "Success") {
97
97
  await fetchProfile();
98
98
  return response;
@@ -41,7 +41,7 @@ export function useAuth() {
41
41
  }
42
42
  async function register(data) {
43
43
  try {
44
- const response = await post("/customer/create", data);
44
+ const response = await post("/mystore/customer/create", data);
45
45
  return response;
46
46
  } catch (error) {
47
47
  console.error("Registration error:", error);
@@ -101,7 +101,7 @@ export function useAuth() {
101
101
  }
102
102
  async function logout() {
103
103
  try {
104
- await post("/customer/logout", {});
104
+ await post("/mystore/customer/logout", {});
105
105
  } catch (error) {
106
106
  console.error("Logout API failed:", error);
107
107
  } finally {
@@ -110,7 +110,7 @@ export function useAuth() {
110
110
  }
111
111
  async function fetchProfile() {
112
112
  try {
113
- const response = await get("/customer/profile");
113
+ const response = await get("/mystore/customer/profile");
114
114
  if (response.status === "Success" && response.data) {
115
115
  authStore.user = response.data;
116
116
  if (import.meta.client) {
@@ -126,7 +126,7 @@ export function useAuth() {
126
126
  }
127
127
  async function updateProfile(userData) {
128
128
  try {
129
- const response = await post("/customer/profile/update", userData);
129
+ const response = await post("/mystore/customer/profile/update", userData);
130
130
  if (response.status === "Success") {
131
131
  await fetchProfile();
132
132
  return { status: response.status, message: response.message || "Profile Updated Successfully" };
@@ -142,7 +142,7 @@ export function useAuth() {
142
142
  }
143
143
  async function changePassword(passwordData) {
144
144
  try {
145
- const response = await post("/customer/change-password", passwordData);
145
+ const response = await post("/mystore/customer/change-password", passwordData);
146
146
  if (response.status === "Success") {
147
147
  return { status: "Success", message: "Password updated successfully" };
148
148
  } else {
@@ -23,7 +23,7 @@ export function useCards() {
23
23
  store.setLoading(true);
24
24
  store.setError(null);
25
25
  try {
26
- const response = await get("/customer/cards");
26
+ const response = await get("/mystore/customer/cards");
27
27
  if (response.status === "Success" && response.data) {
28
28
  store.setCards(response.data.data);
29
29
  return response;
@@ -45,7 +45,7 @@ export function useCards() {
45
45
  store.setLoading(true);
46
46
  store.setError(null);
47
47
  try {
48
- const response = await del(`/customer/cards/${cardId}`);
48
+ const response = await del(`/mystore/customer/cards/${cardId}`);
49
49
  if (response.status === "Success") {
50
50
  store.removeCard(cardId);
51
51
  return response;
@@ -25,7 +25,7 @@ export function useOrders() {
25
25
  store.setLoading(true);
26
26
  store.setError(null);
27
27
  try {
28
- const response = await get("/customer/orders");
28
+ const response = await get("/mystore/customer/orders");
29
29
  if (response.status === "Success" && response.data) {
30
30
  store.setOrders(response.data);
31
31
  return response;
@@ -47,7 +47,7 @@ export function useOrders() {
47
47
  loadingInvoice.value = orderNo;
48
48
  error.value = null;
49
49
  try {
50
- const response = await get(`customer/orders/${orderNo}/tax-invoice`, {
50
+ const response = await get(`/mystore/customer/orders/${orderNo}/tax-invoice`, {
51
51
  params: { orderNo },
52
52
  responseType: "blob"
53
53
  });
@@ -23,7 +23,7 @@ export function useQuotations() {
23
23
  store.setLoading(true);
24
24
  store.setError(null);
25
25
  try {
26
- const response = await get("/customer/quotations");
26
+ const response = await get("/mystore/customer/quotations");
27
27
  if (response.status === "Success" && response.data) {
28
28
  store.setQuotations(response.data);
29
29
  return response;
@@ -23,7 +23,7 @@ export function useWishlists() {
23
23
  store.setLoading(true);
24
24
  store.setError(null);
25
25
  try {
26
- const response = await get("/customer/wishlist");
26
+ const response = await get("/mystore/customer/wishlist");
27
27
  if (response.status === "Success" && response.data) {
28
28
  store.setWishlists(response.data);
29
29
  return response;
@@ -45,7 +45,7 @@ export function useWishlists() {
45
45
  store.setLoading(true);
46
46
  store.setError(null);
47
47
  try {
48
- const response = await get(`/customer/wishlist/${listId}/products`);
48
+ const response = await get(`/mystore/customer/wishlist/${listId}/products`);
49
49
  if (response.status === "Success" && response.data) {
50
50
  const products = response.data.products || [];
51
51
  store.setWishlistProducts(listId, products);
@@ -68,7 +68,7 @@ export function useWishlists() {
68
68
  store.setLoading(true);
69
69
  store.setError(null);
70
70
  try {
71
- const response = await post("/customer/wishlist/add", data);
71
+ const response = await post("/mystore/customer/wishlist/add", data);
72
72
  if (response.status === "Success" && response.data) {
73
73
  store.addWishlist(response.data);
74
74
  return response;
@@ -90,7 +90,7 @@ export function useWishlists() {
90
90
  store.setLoading(true);
91
91
  store.setError(null);
92
92
  try {
93
- const response = await post(`/customer/wishlist/${listId}/${productSlug}/add`, data);
93
+ const response = await post(`/mystore/customer/wishlist/${listId}/${productSlug}/add`, data);
94
94
  if (response.status === "Success" && response.data) {
95
95
  store.addWishlistProduct(listId, response.data);
96
96
  return response;
@@ -112,7 +112,7 @@ export function useWishlists() {
112
112
  store.setLoading(true);
113
113
  store.setError(null);
114
114
  try {
115
- const response = await post(`/customer/wishlist/${listId}/item/delete`, { ids: { productSlug } });
115
+ const response = await post(`/mystore/customer/wishlist/${listId}/item/delete`, { ids: { productSlug } });
116
116
  if (response.status === "Success") {
117
117
  store.removeWishlistProduct(listId, productSlug);
118
118
  return response;
@@ -134,7 +134,7 @@ export function useWishlists() {
134
134
  store.setLoading(true);
135
135
  store.setError(null);
136
136
  try {
137
- const response = await post(`/customer/wishlist/${id}/update`, data);
137
+ const response = await post(`/mystore/customer/wishlist/${id}/update`, data);
138
138
  if (response.status === "Success" && response.data) {
139
139
  store.updateWishlist(response.data);
140
140
  return response;
@@ -156,7 +156,7 @@ export function useWishlists() {
156
156
  store.setLoading(true);
157
157
  store.setError(null);
158
158
  try {
159
- const response = await post(`/customer/wishlist/${id}/delete`, {});
159
+ const response = await post(`/mystore/customer/wishlist/${id}/delete`, {});
160
160
  if (response.status === "Success") {
161
161
  store.removeWishlist(id);
162
162
  store.clearWishlistProducts(id);
@@ -0,0 +1,3 @@
1
+ export declare const catelogCache: Map<any, any>;
2
+ declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<any>>;
3
+ export default _default;
@@ -0,0 +1,43 @@
1
+ import { defineEventHandler, getQuery, createError } from "h3";
2
+ import { $fetch } from "ofetch";
3
+ import { writeFile, mkdir, readFile } from "fs/promises";
4
+ import { join } from "path";
5
+ const CACHE_DIR = join(process.cwd(), ".nuxt", "cache", "nitro", "catalog");
6
+ export const catelogCache = /* @__PURE__ */ new Map();
7
+ async function ensureCacheDir() {
8
+ try {
9
+ await mkdir(CACHE_DIR, { recursive: true });
10
+ } catch (error) {
11
+ console.error("Error creating cache directory:", error);
12
+ }
13
+ }
14
+ export default defineEventHandler(async (event) => {
15
+ const query = getQuery(event);
16
+ const fileName = "categoriesall";
17
+ const filePath = join(CACHE_DIR, `${fileName}.json`);
18
+ try {
19
+ const fileContent = await readFile(filePath, "utf-8");
20
+ const catelog = JSON.parse(fileContent);
21
+ return catelog;
22
+ } catch (error) {
23
+ }
24
+ try {
25
+ const categories = await $fetch(`${process.env.FLOWRIX_API_BASE}categories/all`, {
26
+ query,
27
+ headers: {
28
+ "x-public-key": process.env.FLOWRIX_API_KEY,
29
+ "x-api-secret": process.env.FLOWRIX_API_SECRET,
30
+ "Origin": process.env.FLOWRIX_API_ORIGIN
31
+ }
32
+ });
33
+ await ensureCacheDir();
34
+ await writeFile(filePath, JSON.stringify(categories, null, 2), "utf-8");
35
+ return categories;
36
+ } catch (error) {
37
+ throw createError({
38
+ statusCode: 500,
39
+ statusMessage: `Failed to fetch catelog for slug: ${slug}`,
40
+ data: error.message
41
+ });
42
+ }
43
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowrix",
3
- "version": "1.0.1-beta.53",
3
+ "version": "1.0.1-beta.54",
4
4
  "description": "lug-and-play Nuxt eCommerce cart powered by FLOWRiX. Subscription required.",
5
5
  "license": "MIT",
6
6
  "type": "module",